diff options
Diffstat (limited to 'spec/ruby/library/win32ole/win32ole_variable')
9 files changed, 160 insertions, 0 deletions
diff --git a/spec/ruby/library/win32ole/win32ole_variable/name_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/name_spec.rb new file mode 100644 index 0000000000..dd9bfa594f --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/name_spec.rb @@ -0,0 +1,12 @@ +require_relative "../../../spec_helper" +require_relative 'shared/name' + +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#name" do + it_behaves_like :win32ole_variable_new, :name + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb new file mode 100644 index 0000000000..a9232d2b28 --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb @@ -0,0 +1,20 @@ +require_relative "../../../spec_helper" +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#ole_type_detail" do + # not sure how WIN32OLE_VARIABLE objects are supposed to be generated + # WIN32OLE_VARIABLE.new even seg faults in some cases + before :each do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @var = ole_type.variables[0] + end + + it "returns a nonempty Array" do + @var.ole_type_detail.should.is_a? Array + @var.ole_type_detail.should_not.empty? + end + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb new file mode 100644 index 0000000000..f28cbfd37a --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb @@ -0,0 +1,19 @@ +require_relative "../../../spec_helper" +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#ole_type" do + # not sure how WIN32OLE_VARIABLE objects are supposed to be generated + # WIN32OLE_VARIABLE.new even seg faults in some cases + before :each do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @var = ole_type.variables[0] + end + + it "returns a String" do + @var.ole_type.should.is_a? String + end + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb b/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb new file mode 100644 index 0000000000..d079066616 --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb @@ -0,0 +1,18 @@ +platform_is :windows do + require 'win32ole' + + describe :win32ole_variable_new, shared: true do + # not sure how WIN32OLE_VARIABLE objects are supposed to be generated + # WIN32OLE_VARIABLE.new even seg faults in some cases + before :each do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @var = ole_type.variables[0] + end + + it "returns a String" do + @var.send(@method).should.is_a? String + end + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/to_s_spec.rb new file mode 100644 index 0000000000..d4cab8e924 --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/to_s_spec.rb @@ -0,0 +1,12 @@ +require_relative "../../../spec_helper" +require_relative 'shared/name' + +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#to_s" do + it_behaves_like :win32ole_variable_new, :to_s + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb new file mode 100644 index 0000000000..33066e40ef --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb @@ -0,0 +1,20 @@ +require_relative "../../../spec_helper" +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#value" do + # not sure how WIN32OLE_VARIABLE objects are supposed to be generated + # WIN32OLE_VARIABLE.new even seg faults in some cases + before :each do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @var = ole_type.variables[0] + end + + it "returns an Integer" do + # according to doc, this could return nil + @var.value.should.is_a? Integer + end + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb new file mode 100644 index 0000000000..2cf1d7f1f2 --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb @@ -0,0 +1,20 @@ +require_relative "../../../spec_helper" +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#variable_kind" do + # not sure how WIN32OLE_VARIABLE objects are supposed to be generated + # WIN32OLE_VARIABLE.new even seg faults in some cases + before :each do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @var = ole_type.variables[0] + end + + it "returns a String" do + @var.variable_kind.should.is_a? String + @var.variable_kind.should == 'CONSTANT' + end + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb new file mode 100644 index 0000000000..04ccb8d46f --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb @@ -0,0 +1,20 @@ +require_relative "../../../spec_helper" +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#varkind" do + # TODO review + # not sure how WIN32OLE_VARIABLE objects are supposed to be generated + # WIN32OLE_VARIABLE.new even seg faults in some cases + before :each do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @var = ole_type.variables[0] + end + + it "returns an Integer" do + @var.varkind.should.is_a? Integer + end + + end + +end diff --git a/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb new file mode 100644 index 0000000000..939468122c --- /dev/null +++ b/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb @@ -0,0 +1,19 @@ +require_relative "../../../spec_helper" +platform_is :windows do + require 'win32ole' + + describe "WIN32OLE_VARIABLE#visible?" do + # not sure how WIN32OLE_VARIABLE objects are supposed to be generated + # WIN32OLE_VARIABLE.new even seg faults in some cases + before :each do + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @var = ole_type.variables[0] + end + + it "returns a String" do + @var.visible?.should == true + end + + end + +end |
