summaryrefslogtreecommitdiff
path: root/spec/ruby/library/win32ole/win32ole_param
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/win32ole/win32ole_param')
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/default_spec.rb31
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/input_spec.rb21
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/name_spec.rb11
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb21
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb21
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/optional_spec.rb21
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/retval_spec.rb21
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/shared/name.rb21
-rw-r--r--spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb11
9 files changed, 179 insertions, 0 deletions
diff --git a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb
new file mode 100644
index 0000000000..7a1337ec7c
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb
@@ -0,0 +1,31 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#default" do
+ before :each do
+ ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder")
+ @params = m_browse_for_folder.params
+
+ ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @params[0].default(1) }.should raise_error ArgumentError
+ end
+
+ it "returns nil for each of WIN32OLE_PARAM for Shell's 'BrowseForFolder' method" do
+ @params.each do |p|
+ p.default.should be_nil
+ end
+ end
+
+ it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do
+ @param_overwritefiles.default.should == true # not be_true
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb
new file mode 100644
index 0000000000..bdf4bccc79
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb
@@ -0,0 +1,21 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#input?" do
+ before :each do
+ ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @param_overwritefiles.input?(1) }.should raise_error ArgumentError
+ end
+
+ it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do
+ @param_overwritefiles.input?.should == true
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/name_spec.rb b/spec/ruby/library/win32ole/win32ole_param/name_spec.rb
new file mode 100644
index 0000000000..b3c947d6fb
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/name_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path('../shared/name', __FILE__)
+
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#name" do
+ it_behaves_like :win32ole_param_name, :name
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb
new file mode 100644
index 0000000000..3ba51c02f1
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb
@@ -0,0 +1,21 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#ole_type_detail" do
+ before :each do
+ ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @param_overwritefiles.ole_type_detail(1) }.should raise_error ArgumentError
+ end
+
+ it "returns ['BOOL'] for 3rd parameter of FileSystemObject's 'CopyFile' method" do
+ @param_overwritefiles.ole_type_detail.should == ['BOOL']
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb
new file mode 100644
index 0000000000..52bee2c9b8
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb
@@ -0,0 +1,21 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#ole_type" do
+ before :each do
+ ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @param_overwritefiles.ole_type(1) }.should raise_error ArgumentError
+ end
+
+ it "returns 'BOOL' for 3rd parameter of FileSystemObject's 'CopyFile' method" do
+ @param_overwritefiles.ole_type.should == 'BOOL'
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb
new file mode 100644
index 0000000000..2476df8641
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb
@@ -0,0 +1,21 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#optional?" do
+ before :each do
+ ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @param_overwritefiles.optional?(1) }.should raise_error ArgumentError
+ end
+
+ it "returns true for 3rd parameter of FileSystemObject's 'CopyFile' method" do
+ @param_overwritefiles.optional?.should be_true
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb
new file mode 100644
index 0000000000..90946c0774
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb
@@ -0,0 +1,21 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#retval?" do
+ before :each do
+ ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @param_overwritefiles.retval?(1) }.should raise_error ArgumentError
+ end
+
+ it "returns false for 3rd parameter of FileSystemObject's 'CopyFile' method" do
+ @param_overwritefiles.retval?.should be_false
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb
new file mode 100644
index 0000000000..b7892d92fb
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb
@@ -0,0 +1,21 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe :win32ole_param_name, shared: true do
+ before :each do
+ ole_type_detail = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject")
+ m_copyfile = WIN32OLE_METHOD.new(ole_type_detail, "CopyFile")
+ @param_overwritefiles = m_copyfile.params[2]
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @param_overwritefiles.send(@method, 1) }.should raise_error ArgumentError
+ end
+
+ it "returns expected value for Scripting Runtime's 'name' method" do
+ @param_overwritefiles.send(@method).should == 'OverWriteFiles' # note the capitalization
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb
new file mode 100644
index 0000000000..7852bb0494
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path('../shared/name', __FILE__)
+
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_PARAM#to_s" do
+ it_behaves_like :win32ole_param_name, :to_s
+
+ end
+
+end