summaryrefslogtreecommitdiff
path: root/spec/ruby/library/win32ole/win32ole_type
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/win32ole/win32ole_type')
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/guid_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/name_spec.rb11
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/new_spec.rb37
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/progid_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/progids_spec.rb14
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/shared/name.rb19
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb11
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb22
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/variables_spec.rb18
-rw-r--r--spec/ruby/library/win32ole/win32ole_type/visible_spec.rb18
20 files changed, 366 insertions, 0 deletions
diff --git a/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb b/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb
new file mode 100644
index 0000000000..25907c8e32
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#guid for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns String with expected format" do
+ @ole_type.guid.should =~ /\A\{[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}\}\z/
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb
new file mode 100644
index 0000000000..d436835188
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#helpcontext for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns an Integer" do
+ @ole_type.helpcontext.should be_kind_of Integer
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb
new file mode 100644
index 0000000000..01e6945138
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#helpfile for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns an empty string" do
+ @ole_type.helpfile.should be_empty
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb
new file mode 100644
index 0000000000..3bd2cbe5dd
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#helpstring for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns expected string" do
+ @ole_type.helpstring.should == "Shell Object Type Information"
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb b/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb
new file mode 100644
index 0000000000..7dae16617d
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#major_version for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns an Integer" do
+ @ole_type.major_version.should be_kind_of Integer
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb b/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb
new file mode 100644
index 0000000000..ff412dd100
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#minor_version for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns an Integer" do
+ @ole_type.minor_version.should be_kind_of Integer
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/name_spec.rb b/spec/ruby/library/win32ole/win32ole_type/name_spec.rb
new file mode 100644
index 0000000000..b395cf05d5
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/name_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path('../shared/name', __FILE__)
+
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#name" do
+ it_behaves_like :win32ole_type_name, :name
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb
new file mode 100644
index 0000000000..9443a64c75
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb
@@ -0,0 +1,37 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE.new" do
+ it "raises ArgumentError with no argument" do
+ lambda { WIN32OLE_TYPE.new }.should raise_error ArgumentError
+ end
+
+ it "raises ArgumentError with invalid string" do
+ lambda { WIN32OLE_TYPE.new("foo") }.should raise_error ArgumentError
+ end
+
+ it "raises TypeError if second argument is not a String" do
+ lambda { WIN32OLE_TYPE.new(1,2) }.should raise_error TypeError
+ lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation',2) }.
+ should raise_error TypeError
+ end
+
+ it "raise WIN32OLERuntimeError if OLE object specified is not found" do
+ lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','foo') }.
+ should raise_error WIN32OLERuntimeError
+ lambda { WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','Application') }.
+ should raise_error WIN32OLERuntimeError
+ end
+
+ it "creates WIN32OLE_TYPE object from name and valid type" do
+ ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ ole_type.should be_kind_of WIN32OLE_TYPE
+ end
+
+ it "creates WIN32OLE_TYPE object from CLSID and valid type" do
+ ole_type2 = WIN32OLE_TYPE.new("{13709620-C279-11CE-A49E-444553540000}", "Shell")
+ ole_type2.should be_kind_of WIN32OLE_TYPE
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb b/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb
new file mode 100644
index 0000000000..0ce0fc98a4
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE.ole_classes for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns array of WIN32OLE_TYPEs" do
+ WIN32OLE_TYPE.ole_classes("Microsoft Shell Controls And Automation").all? {|e| e.kind_of? WIN32OLE_TYPE }.should be_true
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb b/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb
new file mode 100644
index 0000000000..9265549d20
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#ole_methods for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns an Integer" do
+ @ole_type.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb
new file mode 100644
index 0000000000..2bc19aa85e
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#ole_type for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns string 'Class'" do
+ @ole_type.ole_type.should == "Class"
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb
new file mode 100644
index 0000000000..f0d80ba39e
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#progid for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns expected string" do
+ @ole_type.progid.should == "Shell.Application.1"
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb
new file mode 100644
index 0000000000..0cdd3514e3
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb
@@ -0,0 +1,14 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE.progids" do
+ it "raises ArgumentError if an argument is given" do
+ lambda { WIN32OLE_TYPE.progids(1) }.should raise_error ArgumentError
+ end
+
+ it "returns an array containing 'Shell.Explorer'" do
+ WIN32OLE_TYPE.progids().include?('Shell.Explorer').should be_true
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb
new file mode 100644
index 0000000000..6484ef0ef8
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb
@@ -0,0 +1,19 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe :win32ole_type_name, shared: true do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants")
+ end
+
+ it "raises ArgumentError if argument is given" do
+ lambda { @ole_type.send(@method, 1) }.should raise_error ArgumentError
+ end
+
+ it "returns a String" do
+ @ole_type.send(@method).should == 'ShellSpecialFolderConstants'
+ end
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb b/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb
new file mode 100644
index 0000000000..71e304d80a
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#src_type for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns nil" do
+ @ole_type.src_type.should be_nil
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb
new file mode 100644
index 0000000000..5a50bd11de
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path('../shared/name', __FILE__)
+
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#to_s" do
+ it_behaves_like :win32ole_type_name, :to_s
+
+ end
+
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb
new file mode 100644
index 0000000000..35f3562721
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#typekind for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns an Integer" do
+ @ole_type.typekind.should be_kind_of Integer
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb
new file mode 100644
index 0000000000..3a28c0496c
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb
@@ -0,0 +1,22 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE.typelibs for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "raises ArgumentError if any argument is give" do
+ lambda { WIN32OLE_TYPE.typelibs(1) }.should raise_error ArgumentError
+ end
+
+ it "returns array of type libraries" do
+ WIN32OLE_TYPE.typelibs().include?("Microsoft Shell Controls And Automation").should be_true
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb b/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb
new file mode 100644
index 0000000000..fbf3dd0341
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#variables for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns an empty array" do
+ @ole_type.variables.should == []
+ end
+
+ end
+end
diff --git a/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb
new file mode 100644
index 0000000000..403b2b843b
--- /dev/null
+++ b/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb
@@ -0,0 +1,18 @@
+platform_is :windows do
+ require 'win32ole'
+
+ describe "WIN32OLE_TYPE#visible? for Shell Controls" do
+ before :each do
+ @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
+ end
+
+ after :each do
+ @ole_type = nil
+ end
+
+ it "returns true" do
+ @ole_type.visible?.should be_true
+ end
+
+ end
+end