diff options
Diffstat (limited to 'spec/ruby/library')
79 files changed, 614 insertions, 556 deletions
diff --git a/spec/ruby/library/cgi/escapeElement_spec.rb b/spec/ruby/library/cgi/escapeElement_spec.rb index 528433d252..7bfa3f4feb 100644 --- a/spec/ruby/library/cgi/escapeElement_spec.rb +++ b/spec/ruby/library/cgi/escapeElement_spec.rb @@ -1,9 +1,11 @@ require_relative '../../spec_helper' -begin - require 'cgi/escape' -rescue LoadError + +ruby_version_is ""..."3.5" do require 'cgi' end +ruby_version_is "3.5" do + require 'cgi/escape' +end describe "CGI.escapeElement when passed String, elements, ..." do it "escapes only the tags of the passed elements in the passed String" do diff --git a/spec/ruby/library/cgi/unescapeElement_spec.rb b/spec/ruby/library/cgi/unescapeElement_spec.rb index 3453393282..af2fa8a47d 100644 --- a/spec/ruby/library/cgi/unescapeElement_spec.rb +++ b/spec/ruby/library/cgi/unescapeElement_spec.rb @@ -1,9 +1,11 @@ require_relative '../../spec_helper' -begin - require 'cgi/escape' -rescue LoadError + +ruby_version_is ""..."3.5" do require 'cgi' end +ruby_version_is "3.5" do + require 'cgi/escape' +end describe "CGI.unescapeElement when passed String, elements, ..." do it "unescapes only the tags of the passed elements in the passed String" do diff --git a/spec/ruby/library/cgi/unescape_spec.rb b/spec/ruby/library/cgi/unescape_spec.rb index 52e1cb0243..e750c72921 100644 --- a/spec/ruby/library/cgi/unescape_spec.rb +++ b/spec/ruby/library/cgi/unescape_spec.rb @@ -1,10 +1,12 @@ # -*- encoding: utf-8 -*- require_relative '../../spec_helper' -begin - require 'cgi/escape' -rescue LoadError + +ruby_version_is ""..."3.5" do require 'cgi' end +ruby_version_is "3.5" do + require 'cgi/escape' +end describe "CGI.unescape" do it "url-decodes the passed argument" do diff --git a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb index fc030e75b9..cd22ea56cf 100644 --- a/spec/ruby/library/socket/socket/udp_server_loop_spec.rb +++ b/spec/ruby/library/socket/socket/udp_server_loop_spec.rb @@ -50,10 +50,10 @@ describe 'Socket.udp_server_loop' do end end + thread.join + msg.should == 'hello' src.should be_an_instance_of(Socket::UDPSource) - - thread.join end end end diff --git a/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb b/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb index f0e98778f5..5a2c704f35 100644 --- a/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb +++ b/spec/ruby/library/socket/tcpsocket/gethostbyname_spec.rb @@ -2,7 +2,7 @@ require_relative '../spec_helper' require_relative '../fixtures/classes' # TODO: verify these for windows -describe "TCPSocket#gethostbyname" do +describe "TCPSocket.gethostbyname" do before :each do suppress_warning do @host_info = TCPSocket.gethostbyname(SocketSpecs.hostname) @@ -52,7 +52,7 @@ describe "TCPSocket#gethostbyname" do end end -describe 'TCPSocket#gethostbyname' do +describe 'TCPSocket.gethostbyname' do it 'returns an Array' do suppress_warning do TCPSocket.gethostbyname('127.0.0.1').should be_an_instance_of(Array) diff --git a/spec/ruby/library/stringio/each_line_spec.rb b/spec/ruby/library/stringio/each_line_spec.rb index c68f7dae82..4ac0db7c45 100644 --- a/spec/ruby/library/stringio/each_line_spec.rb +++ b/spec/ruby/library/stringio/each_line_spec.rb @@ -21,3 +21,7 @@ end describe "StringIO#each_line when passed limit" do it_behaves_like :stringio_each_limit, :each_line end + +describe "StringIO#each when passed separator and limit" do + it_behaves_like :stringio_each_separator_and_limit, :each_line +end diff --git a/spec/ruby/library/stringio/each_spec.rb b/spec/ruby/library/stringio/each_spec.rb index 2c30ed5cda..7eb322f3ff 100644 --- a/spec/ruby/library/stringio/each_spec.rb +++ b/spec/ruby/library/stringio/each_spec.rb @@ -25,3 +25,7 @@ end describe "StringIO#each when passed limit" do it_behaves_like :stringio_each_limit, :each end + +describe "StringIO#each when passed separator and limit" do + it_behaves_like :stringio_each_separator_and_limit, :each +end diff --git a/spec/ruby/library/stringio/gets_spec.rb b/spec/ruby/library/stringio/gets_spec.rb index 4af7704a41..ac876f0b4f 100644 --- a/spec/ruby/library/stringio/gets_spec.rb +++ b/spec/ruby/library/stringio/gets_spec.rb @@ -1,250 +1,61 @@ require_relative '../../spec_helper' require "stringio" +require_relative "shared/gets" -describe "StringIO#gets when passed [separator]" do - before :each do - @io = StringIO.new("this>is>an>example") - end - - it "returns the data read till the next occurrence of the passed separator" do - @io.gets(">").should == "this>" - @io.gets(">").should == "is>" - @io.gets(">").should == "an>" - @io.gets(">").should == "example" - end - - it "sets $_ to the read content" do - @io.gets(">") - $_.should == "this>" - @io.gets(">") - $_.should == "is>" - @io.gets(">") - $_.should == "an>" - @io.gets(">") - $_.should == "example" - @io.gets(">") - $_.should be_nil - end - - it "accepts string as separator" do - @io.gets("is>") - $_.should == "this>" - @io.gets("an>") - $_.should == "is>an>" - @io.gets("example") - $_.should == "example" - @io.gets("ple") - $_.should be_nil - end - - it "updates self's lineno by one" do - @io.gets(">") - @io.lineno.should eql(1) - - @io.gets(">") - @io.lineno.should eql(2) - - @io.gets(">") - @io.lineno.should eql(3) - end - - it "returns the next paragraph when the passed separator is an empty String" do - io = StringIO.new("this is\n\nan example") - io.gets("").should == "this is\n\n" - io.gets("").should == "an example" - end - - it "returns the remaining content starting at the current position when passed nil" do - io = StringIO.new("this is\n\nan example") - io.pos = 5 - io.gets(nil).should == "is\n\nan example" - end +describe "StringIO#gets" do + describe "when passed [separator]" do + it_behaves_like :stringio_gets_separator, :gets - it "tries to convert the passed separator to a String using #to_str" do - obj = mock('to_str') - obj.should_receive(:to_str).and_return(">") - @io.gets(obj).should == "this>" - end -end - -describe "StringIO#gets when passed no argument" do - before :each do - @io = StringIO.new("this is\nan example\nfor StringIO#gets") - end + it "returns nil if self is at the end" do + @io = StringIO.new("this>is>an>example") - it "returns the data read till the next occurrence of $/ or till eof" do - @io.gets.should == "this is\n" - - begin - old_sep = $/ - suppress_warning {$/ = " "} - @io.gets.should == "an " - @io.gets.should == "example\nfor " - @io.gets.should == "StringIO#gets" - ensure - suppress_warning {$/ = old_sep} + @io.pos = 36 + @io.gets(">").should be_nil + @io.gets(">").should be_nil end end - it "sets $_ to the read content" do - @io.gets - $_.should == "this is\n" - @io.gets - $_.should == "an example\n" - @io.gets - $_.should == "for StringIO#gets" - @io.gets - $_.should be_nil - end - - it "updates self's position" do - @io.gets - @io.pos.should eql(8) - - @io.gets - @io.pos.should eql(19) - - @io.gets - @io.pos.should eql(36) - end - - it "updates self's lineno" do - @io.gets - @io.lineno.should eql(1) - - @io.gets - @io.lineno.should eql(2) - - @io.gets - @io.lineno.should eql(3) - end - - it "returns nil if self is at the end" do - @io.pos = 36 - @io.gets.should be_nil - @io.gets.should be_nil - end -end - -describe "StringIO#gets when passed [limit]" do - before :each do - @io = StringIO.new("this>is>an>example") - end - - it "returns the data read until the limit is met" do - @io.gets(4).should == "this" - @io.gets(3).should == ">is" - @io.gets(5).should == ">an>e" - @io.gets(6).should == "xample" - end - - it "sets $_ to the read content" do - @io.gets(4) - $_.should == "this" - @io.gets(3) - $_.should == ">is" - @io.gets(5) - $_.should == ">an>e" - @io.gets(6) - $_.should == "xample" - @io.gets(3) - $_.should be_nil - end - - it "updates self's lineno by one" do - @io.gets(3) - @io.lineno.should eql(1) - - @io.gets(3) - @io.lineno.should eql(2) - - @io.gets(3) - @io.lineno.should eql(3) - end - - it "tries to convert the passed limit to an Integer using #to_int" do - obj = mock('to_int') - obj.should_receive(:to_int).and_return(4) - @io.gets(obj).should == "this" - end - - it "returns a blank string when passed a limit of 0" do - @io.gets(0).should == "" - end - - it "ignores it when passed a negative limit" do - @io.gets(-4).should == "this>is>an>example" - end -end + describe "when passed [limit]" do + it_behaves_like :stringio_gets_limit, :gets -describe "StringIO#gets when passed [separator] and [limit]" do - before :each do - @io = StringIO.new("this>is>an>example") - end - - it "returns the data read until the limit is consumed or the separator is met" do - @io.gets('>', 8).should == "this>" - @io.gets('>', 2).should == "is" - @io.gets('>', 10).should == ">" - @io.gets('>', 6).should == "an>" - @io.gets('>', 5).should == "examp" - end + it "returns nil if self is at the end" do + @io = StringIO.new("this>is>an>example") - it "sets $_ to the read content" do - @io.gets('>', 8) - $_.should == "this>" - @io.gets('>', 2) - $_.should == "is" - @io.gets('>', 10) - $_.should == ">" - @io.gets('>', 6) - $_.should == "an>" - @io.gets('>', 5) - $_.should == "examp" + @io.pos = 36 + @io.gets(3).should be_nil + @io.gets(3).should be_nil + end end - it "updates self's lineno by one" do - @io.gets('>', 3) - @io.lineno.should eql(1) + describe "when passed [separator] and [limit]" do + it_behaves_like :stringio_gets_separator_and_limit, :gets - @io.gets('>', 3) - @io.lineno.should eql(2) + it "returns nil if self is at the end" do + @io = StringIO.new("this>is>an>example") - @io.gets('>', 3) - @io.lineno.should eql(3) + @io.pos = 36 + @io.gets(">", 3).should be_nil + @io.gets(">", 3).should be_nil + end end - it "tries to convert the passed separator to a String using #to_str" do - obj = mock('to_str') - obj.should_receive(:to_str).and_return('>') - @io.gets(obj, 5).should == "this>" - end + describe "when passed no argument" do + it_behaves_like :stringio_gets_no_argument, :gets - it "does not raise TypeError if passed separator is nil" do - @io.gets(nil, 5).should == "this>" - end + it "returns nil if self is at the end" do + @io = StringIO.new("this>is>an>example") - it "tries to convert the passed limit to an Integer using #to_int" do - obj = mock('to_int') - obj.should_receive(:to_int).and_return(5) - @io.gets('>', obj).should == "this>" + @io.pos = 36 + @io.gets.should be_nil + @io.gets.should be_nil + end end -end - -describe "StringIO#gets when in write-only mode" do - it "raises an IOError" do - io = StringIO.new(+"xyz", "w") - -> { io.gets }.should raise_error(IOError) - io = StringIO.new("xyz") - io.close_read - -> { io.gets }.should raise_error(IOError) + describe "when passed [chomp]" do + it_behaves_like :stringio_gets_chomp, :gets end -end -describe "StringIO#gets when passed [chomp]" do - it "returns the data read without a trailing newline character" do - io = StringIO.new("this>is>an>example\n") - io.gets(chomp: true).should == "this>is>an>example" + describe "when in write-only mode" do + it_behaves_like :stringio_gets_write_only, :gets end end diff --git a/spec/ruby/library/stringio/readline_spec.rb b/spec/ruby/library/stringio/readline_spec.rb index b16a16e23f..085360707f 100644 --- a/spec/ruby/library/stringio/readline_spec.rb +++ b/spec/ruby/library/stringio/readline_spec.rb @@ -1,150 +1,58 @@ require_relative '../../spec_helper' +require "stringio" require_relative 'fixtures/classes' +require_relative "shared/gets" +describe "StringIO#readline" do + describe "when passed [separator]" do + it_behaves_like :stringio_gets_separator, :readline -describe "StringIO#readline when passed [separator]" do - before :each do - @io = StringIO.new("this>is>an>example") - end - - it "returns the data read till the next occurrence of the passed separator" do - @io.readline(">").should == "this>" - @io.readline(">").should == "is>" - @io.readline(">").should == "an>" - @io.readline(">").should == "example" - end - - it "sets $_ to the read content" do - @io.readline(">") - $_.should == "this>" - @io.readline(">") - $_.should == "is>" - @io.readline(">") - $_.should == "an>" - @io.readline(">") - $_.should == "example" - end - - it "updates self's lineno by one" do - @io.readline(">") - @io.lineno.should eql(1) - - @io.readline(">") - @io.lineno.should eql(2) - - @io.readline(">") - @io.lineno.should eql(3) - end - - it "returns the next paragraph when the passed separator is an empty String" do - io = StringIO.new("this is\n\nan example") - io.readline("").should == "this is\n\n" - io.readline("").should == "an example" - end - - it "returns the remaining content starting at the current position when passed nil" do - io = StringIO.new("this is\n\nan example") - io.pos = 5 - io.readline(nil).should == "is\n\nan example" - end - - it "tries to convert the passed separator to a String using #to_str" do - obj = mock('to_str') - obj.should_receive(:to_str).and_return(">") - @io.readline(obj).should == "this>" - end -end - -describe "StringIO#readline when passed no argument" do - before :each do - @io = StringIO.new("this is\nan example\nfor StringIO#readline") - end - - it "returns the data read till the next occurrence of $/ or till eof" do - @io.readline.should == "this is\n" + it "raises an IOError if self is at the end" do + @io = StringIO.new("this>is>an>example") - begin - old_sep = $/ - suppress_warning {$/ = " "} - @io.readline.should == "an " - @io.readline.should == "example\nfor " - @io.readline.should == "StringIO#readline" - ensure - suppress_warning {$/ = old_sep} + @io.pos = 36 + -> { @io.readline(">") }.should raise_error(IOError) end end - it "sets $_ to the read content" do - @io.readline - $_.should == "this is\n" - @io.readline - $_.should == "an example\n" - @io.readline - $_.should == "for StringIO#readline" - end + describe "when passed [limit]" do + it_behaves_like :stringio_gets_limit, :readline - it "updates self's position" do - @io.readline - @io.pos.should eql(8) + it "raises an IOError if self is at the end" do + @io = StringIO.new("this>is>an>example") - @io.readline - @io.pos.should eql(19) - - @io.readline - @io.pos.should eql(40) + @io.pos = 36 + -> { @io.readline(3) }.should raise_error(IOError) + end end - it "updates self's lineno" do - @io.readline - @io.lineno.should eql(1) + describe "when passed [separator] and [limit]" do + it_behaves_like :stringio_gets_separator_and_limit, :readline - @io.readline - @io.lineno.should eql(2) + it "raises an IOError if self is at the end" do + @io = StringIO.new("this>is>an>example") - @io.readline - @io.lineno.should eql(3) - end - - it "raises an IOError if self is at the end" do - @io.pos = 40 - -> { @io.readline }.should raise_error(IOError) - end -end - -describe "StringIO#readline when in write-only mode" do - it "raises an IOError" do - io = StringIO.new(+"xyz", "w") - -> { io.readline }.should raise_error(IOError) - - io = StringIO.new("xyz") - io.close_read - -> { io.readline }.should raise_error(IOError) + @io.pos = 36 + -> { @io.readline(">", 3) }.should raise_error(IOError) + end end -end -describe "StringIO#readline when passed [chomp]" do - it "returns the data read without a trailing newline character" do - io = StringIO.new("this>is>an>example\n") - io.readline(chomp: true).should == "this>is>an>example" - end -end + describe "when passed no argument" do + it_behaves_like :stringio_gets_no_argument, :readline -describe "StringIO#readline when passed [limit]" do - before :each do - @io = StringIO.new("this>is>an>example") - end + it "raises an IOError if self is at the end" do + @io = StringIO.new("this>is>an>example") - it "returns the data read until the limit is met" do - io = StringIO.new("this>is>an>example\n") - io.readline(3).should == "thi" + @io.pos = 36 + -> { @io.readline }.should raise_error(IOError) + end end - it "returns a blank string when passed a limit of 0" do - @io.readline(0).should == "" + describe "when passed [chomp]" do + it_behaves_like :stringio_gets_chomp, :readline end - it "ignores it when the limit is negative" do - seen = [] - @io.readline(-4).should == "this>is>an>example" + describe "when in write-only mode" do + it_behaves_like :stringio_gets_write_only, :readline end end diff --git a/spec/ruby/library/stringio/shared/each.rb b/spec/ruby/library/stringio/shared/each.rb index 33f1c0e359..626b41a4d3 100644 --- a/spec/ruby/library/stringio/shared/each.rb +++ b/spec/ruby/library/stringio/shared/each.rb @@ -150,3 +150,60 @@ describe :stringio_each_limit, shared: true do seen.should == ["a b ", "c d ", "e\n", "1 2 ", "3 4 ", "5"] end end + +describe :stringio_each_separator_and_limit, shared: true do + before :each do + @io = StringIO.new("this>is>an>example") + end + + it "returns the data read until the limit is consumed or the separator is met" do + @io.send(@method, '>', 8) { |s| break s }.should == "this>" + @io.send(@method, '>', 2) { |s| break s }.should == "is" + @io.send(@method, '>', 10) { |s| break s }.should == ">" + @io.send(@method, '>', 6) { |s| break s }.should == "an>" + @io.send(@method, '>', 5) { |s| break s }.should == "examp" + end + + it "truncates the multi-character separator at the end to meet the limit" do + @io.send(@method, "is>an", 7) { |s| break s }.should == "this>is" + end + + it "does not change $_" do + $_ = "test" + @io.send(@method, '>', 8) { |s| s } + $_.should == "test" + end + + it "updates self's lineno by one" do + @io.send(@method, '>', 3) { |s| break s } + @io.lineno.should eql(1) + + @io.send(@method, '>', 3) { |s| break s } + @io.lineno.should eql(2) + + @io.send(@method, '>', 3) { |s| break s } + @io.lineno.should eql(3) + end + + it "tries to convert the passed separator to a String using #to_str" do # TODO + obj = mock('to_str') + obj.should_receive(:to_str).and_return('>') + + seen = [] + @io.send(@method, obj, 5) { |s| seen << s } + seen.should == ["this>", "is>", "an>", "examp", "le"] + end + + it "does not raise TypeError if passed separator is nil" do + @io.send(@method, nil, 5) { |s| break s }.should == "this>" + end + + it "tries to convert the passed limit to an Integer using #to_int" do # TODO + obj = mock('to_int') + obj.should_receive(:to_int).and_return(5) + + seen = [] + @io.send(@method, '>', obj) { |s| seen << s } + seen.should == ["this>", "is>", "an>", "examp", "le"] + end +end diff --git a/spec/ruby/library/stringio/shared/gets.rb b/spec/ruby/library/stringio/shared/gets.rb new file mode 100644 index 0000000000..8396b161f1 --- /dev/null +++ b/spec/ruby/library/stringio/shared/gets.rb @@ -0,0 +1,249 @@ +describe :stringio_gets_separator, shared: true do + describe "when passed [separator]" do + before :each do + @io = StringIO.new("this>is>an>example") + end + + it "returns the data read till the next occurrence of the passed separator" do + @io.send(@method, ">").should == "this>" + @io.send(@method, ">").should == "is>" + @io.send(@method, ">").should == "an>" + @io.send(@method, ">").should == "example" + end + + it "sets $_ to the read content" do + @io.send(@method, ">") + $_.should == "this>" + @io.send(@method, ">") + $_.should == "is>" + @io.send(@method, ">") + $_.should == "an>" + @io.send(@method, ">") + $_.should == "example" + end + + it "accepts string as separator" do + @io.send(@method, "is>") + $_.should == "this>" + @io.send(@method, "an>") + $_.should == "is>an>" + @io.send(@method, "example") + $_.should == "example" + end + + it "updates self's lineno by one" do + @io.send(@method, ">") + @io.lineno.should eql(1) + + @io.send(@method, ">") + @io.lineno.should eql(2) + + @io.send(@method, ">") + @io.lineno.should eql(3) + end + + it "returns the next paragraph when the passed separator is an empty String" do + io = StringIO.new("this is\n\nan example") + io.send(@method, "").should == "this is\n\n" + io.send(@method, "").should == "an example" + end + + it "returns the remaining content starting at the current position when passed nil" do + io = StringIO.new("this is\n\nan example") + io.pos = 5 + io.send(@method, nil).should == "is\n\nan example" + end + + it "tries to convert the passed separator to a String using #to_str" do + obj = mock('to_str') + obj.should_receive(:to_str).and_return(">") + @io.send(@method, obj).should == "this>" + end + end +end + +describe :stringio_gets_limit, shared: true do + describe "when passed [limit]" do + before :each do + @io = StringIO.new("this>is>an>example") + end + + it "returns the data read until the limit is met" do + @io.send(@method, 4).should == "this" + @io.send(@method, 3).should == ">is" + @io.send(@method, 5).should == ">an>e" + @io.send(@method, 6).should == "xample" + end + + it "sets $_ to the read content" do + @io.send(@method, 4) + $_.should == "this" + @io.send(@method, 3) + $_.should == ">is" + @io.send(@method, 5) + $_.should == ">an>e" + @io.send(@method, 6) + $_.should == "xample" + end + + it "updates self's lineno by one" do + @io.send(@method, 3) + @io.lineno.should eql(1) + + @io.send(@method, 3) + @io.lineno.should eql(2) + + @io.send(@method, 3) + @io.lineno.should eql(3) + end + + it "tries to convert the passed limit to an Integer using #to_int" do + obj = mock('to_int') + obj.should_receive(:to_int).and_return(4) + @io.send(@method, obj).should == "this" + end + + it "returns a blank string when passed a limit of 0" do + @io.send(@method, 0).should == "" + end + + it "ignores it when passed a negative limit" do + @io.send(@method, -4).should == "this>is>an>example" + end + end +end + +describe :stringio_gets_separator_and_limit, shared: true do + describe "when passed [separator] and [limit]" do + before :each do + @io = StringIO.new("this>is>an>example") + end + + it "returns the data read until the limit is consumed or the separator is met" do + @io.send(@method, '>', 8).should == "this>" + @io.send(@method, '>', 2).should == "is" + @io.send(@method, '>', 10).should == ">" + @io.send(@method, '>', 6).should == "an>" + @io.send(@method, '>', 5).should == "examp" + end + + it "truncates the multi-character separator at the end to meet the limit" do + @io.send(@method, "is>an", 7).should == "this>is" + end + + it "sets $_ to the read content" do + @io.send(@method, '>', 8) + $_.should == "this>" + @io.send(@method, '>', 2) + $_.should == "is" + @io.send(@method, '>', 10) + $_.should == ">" + @io.send(@method, '>', 6) + $_.should == "an>" + @io.send(@method, '>', 5) + $_.should == "examp" + end + + it "updates self's lineno by one" do + @io.send(@method, '>', 3) + @io.lineno.should eql(1) + + @io.send(@method, '>', 3) + @io.lineno.should eql(2) + + @io.send(@method, '>', 3) + @io.lineno.should eql(3) + end + + it "tries to convert the passed separator to a String using #to_str" do + obj = mock('to_str') + obj.should_receive(:to_str).and_return('>') + @io.send(@method, obj, 5).should == "this>" + end + + it "does not raise TypeError if passed separator is nil" do + @io.send(@method, nil, 5).should == "this>" + end + + it "tries to convert the passed limit to an Integer using #to_int" do + obj = mock('to_int') + obj.should_receive(:to_int).and_return(5) + @io.send(@method, '>', obj).should == "this>" + end + end +end + +describe :stringio_gets_no_argument, shared: true do + describe "when passed no argument" do + before :each do + @io = StringIO.new("this is\nan example\nfor StringIO#gets") + end + + it "returns the data read till the next occurrence of $/ or till eof" do + @io.send(@method).should == "this is\n" + + begin + old_sep = $/ + suppress_warning {$/ = " "} + @io.send(@method).should == "an " + @io.send(@method).should == "example\nfor " + @io.send(@method).should == "StringIO#gets" + ensure + suppress_warning {$/ = old_sep} + end + end + + it "sets $_ to the read content" do + @io.send(@method) + $_.should == "this is\n" + @io.send(@method) + $_.should == "an example\n" + @io.send(@method) + $_.should == "for StringIO#gets" + end + + it "updates self's position" do + @io.send(@method) + @io.pos.should eql(8) + + @io.send(@method) + @io.pos.should eql(19) + + @io.send(@method) + @io.pos.should eql(36) + end + + it "updates self's lineno" do + @io.send(@method) + @io.lineno.should eql(1) + + @io.send(@method) + @io.lineno.should eql(2) + + @io.send(@method) + @io.lineno.should eql(3) + end + end +end + +describe :stringio_gets_chomp, shared: true do + describe "when passed [chomp]" do + it "returns the data read without a trailing newline character" do + io = StringIO.new("this>is>an>example\n") + io.send(@method, chomp: true).should == "this>is>an>example" + end + end +end + +describe :stringio_gets_write_only, shared: true do + describe "when in write-only mode" do + it "raises an IOError" do + io = StringIO.new(+"xyz", "w") + -> { io.send(@method) }.should raise_error(IOError) + + io = StringIO.new("xyz") + io.close_read + -> { io.send(@method) }.should raise_error(IOError) + end + end +end diff --git a/spec/ruby/library/timeout/timeout_spec.rb b/spec/ruby/library/timeout/timeout_spec.rb index 584b38d8ec..e16bcaea6a 100644 --- a/spec/ruby/library/timeout/timeout_spec.rb +++ b/spec/ruby/library/timeout/timeout_spec.rb @@ -39,4 +39,12 @@ describe "Timeout.timeout" do 42 end.should == 42 end + + ruby_version_is "3.4" do + it "raises an ArgumentError when provided with a negative duration" do + -> { + Timeout.timeout(-1) + }.should raise_error(ArgumentError, "Timeout sec must be a non-negative number") + end + end end diff --git a/spec/ruby/library/win32ole/fixtures/classes.rb b/spec/ruby/library/win32ole/fixtures/classes.rb index f61cf6ba69..5a16fcca45 100644 --- a/spec/ruby/library/win32ole/fixtures/classes.rb +++ b/spec/ruby/library/win32ole/fixtures/classes.rb @@ -1,14 +1,25 @@ require 'win32ole' +# win32ole deprecated constants like WIN32OLE_TYPELIB in Ruby 3.4 +# but only added the replacements like WIN32OLE::TypeLib in Ruby 3.4. +# So we use the new-style constants in specs to avoid deprecation warnings +# and we define the new-style constants as the old ones if they don't exist yet. +WIN32OLE::TypeLib ||= WIN32OLE_TYPELIB +WIN32OLE::RuntimeError ||= WIN32OLERuntimeError +WIN32OLE::Method ||= WIN32OLE_METHOD +WIN32OLE::Type ||= WIN32OLE_TYPE +WIN32OLE::Event ||= WIN32OLE_EVENT +WIN32OLE::Param ||= WIN32OLE_PARAM + module WIN32OLESpecs - MSXML_AVAILABLE = WIN32OLE_TYPELIB.typelibs.any? { |t| t.name.start_with?('Microsoft XML') } - SYSTEM_MONITOR_CONTROL_AVAILABLE = WIN32OLE_TYPELIB.typelibs.any? { |t| t.name.start_with?('System Monitor Control') } + MSXML_AVAILABLE = WIN32OLE::TypeLib.typelibs.any? { |t| t.name.start_with?('Microsoft XML') } + SYSTEM_MONITOR_CONTROL_AVAILABLE = WIN32OLE::TypeLib.typelibs.any? { |t| t.name.start_with?('System Monitor Control') } def self.new_ole(name) tries = 0 begin WIN32OLE.new(name) - rescue WIN32OLERuntimeError => e + rescue WIN32OLE::RuntimeError => e if tries < 3 tries += 1 $stderr.puts "WIN32OLESpecs#new_ole retry (#{tries}): #{e.class}: #{e.message}" diff --git a/spec/ruby/library/win32ole/win32ole/locale_spec.rb b/spec/ruby/library/win32ole/win32ole/locale_spec.rb index 78ede4375a..89e84d8038 100644 --- a/spec/ruby/library/win32ole/win32ole/locale_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/locale_spec.rb @@ -13,14 +13,14 @@ platform_is :windows do begin begin WIN32OLE.locale = 1041 - rescue WIN32OLERuntimeError + rescue WIN32OLE::RuntimeError STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_locale_set is skipped(Japanese locale is not installed)") return end WIN32OLE.locale.should == 1041 WIN32OLE.locale = WIN32OLE::LOCALE_SYSTEM_DEFAULT - -> { WIN32OLE.locale = 111 }.should raise_error WIN32OLERuntimeError + -> { WIN32OLE.locale = 111 }.should raise_error WIN32OLE::RuntimeError WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT ensure WIN32OLE.locale.should == WIN32OLE::LOCALE_SYSTEM_DEFAULT diff --git a/spec/ruby/library/win32ole/win32ole/new_spec.rb b/spec/ruby/library/win32ole/win32ole/new_spec.rb index 7e91c2d3ea..b2a0a5da18 100644 --- a/spec/ruby/library/win32ole/win32ole/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/new_spec.rb @@ -17,8 +17,8 @@ platform_is :windows do -> { WIN32OLESpecs.new_ole(42) }.should raise_error( TypeError ) end - it "raises WIN32OLERuntimeError if invalid string is given" do - -> { WIN32OLE.new('foo') }.should raise_error( WIN32OLERuntimeError ) + it "raises WIN32OLE::RuntimeError if invalid string is given" do + -> { WIN32OLE.new('foo') }.should raise_error( WIN32OLE::RuntimeError ) end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb index 2bbe8c27d4..b846685518 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_func_methods_spec.rb @@ -11,8 +11,8 @@ platform_is :windows do -> { @dict.ole_func_methods(1) }.should raise_error ArgumentError end - it "returns an array of WIN32OLE_METHODs" do - @dict.ole_func_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + it "returns an array of WIN32OLE::Methods" do + @dict.ole_func_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should be_true end it "contains a 'AddRef' method for Scripting Dictionary" do diff --git a/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb index c1d1970214..b6e7f960bb 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_get_methods_spec.rb @@ -8,8 +8,8 @@ platform_is :windows do @win32ole = WIN32OLESpecs.new_ole('Shell.Application') end - it "returns an array of WIN32OLE_METHOD objects" do - @win32ole.ole_get_methods.all? {|m| m.kind_of? WIN32OLE_METHOD}.should be_true + it "returns an array of WIN32OLE::Method objects" do + @win32ole.ole_get_methods.all? {|m| m.kind_of? WIN32OLE::Method}.should be_true end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb index fe161ce9f0..92c4363f78 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_methods_spec.rb @@ -11,8 +11,8 @@ platform_is :windows do -> { @dict.ole_methods(1) }.should raise_error ArgumentError end - it "returns an array of WIN32OLE_METHODs" do - @dict.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + it "returns an array of WIN32OLE::Methods" do + @dict.ole_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should be_true end it "contains a 'AddRef' method for Scripting Dictionary" do diff --git a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb index afcf16a051..f298f19dba 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_obj_help_spec.rb @@ -12,8 +12,8 @@ platform_is :windows do -> { @dict.ole_obj_help(1) }.should raise_error ArgumentError end - it "returns an instance of WIN32OLE_TYPE" do - @dict.ole_obj_help.kind_of?(WIN32OLE_TYPE).should be_true + it "returns an instance of WIN32OLE::Type" do + @dict.ole_obj_help.kind_of?(WIN32OLE::Type).should be_true end end end diff --git a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb index c091c83c95..2b46ae47de 100644 --- a/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole/ole_put_methods_spec.rb @@ -11,8 +11,8 @@ platform_is :windows do -> { @dict.ole_put_methods(1) }.should raise_error ArgumentError end - it "returns an array of WIN32OLE_METHODs" do - @dict.ole_put_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + it "returns an array of WIN32OLE::Methods" do + @dict.ole_put_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should be_true end it "contains a 'Key' method for Scripting Dictionary" do diff --git a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb index f1fd8713a4..bae424a604 100644 --- a/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb +++ b/spec/ruby/library/win32ole/win32ole/shared/ole_method.rb @@ -10,9 +10,9 @@ platform_is :windows do -> { @dict.send(@method) }.should raise_error ArgumentError end - it "returns the WIN32OLE_METHOD 'Add' if given 'Add'" do + it "returns the WIN32OLE::Method 'Add' if given 'Add'" do result = @dict.send(@method, "Add") - result.kind_of?(WIN32OLE_METHOD).should be_true + result.kind_of?(WIN32OLE::Method).should be_true result.name.should == 'Add' end end diff --git a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb index 94fabb1e3b..4efd4c3e0f 100644 --- a/spec/ruby/library/win32ole/win32ole_event/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_event/new_spec.rb @@ -3,7 +3,7 @@ platform_is :windows do require_relative '../fixtures/classes' guard -> { WIN32OLESpecs::MSXML_AVAILABLE } do - describe "WIN32OLE_EVENT.new" do + describe "WIN32OLE::Event.new" do before :all do @xml_dom = WIN32OLESpecs.new_ole('MSXML.DOMDocument') end @@ -13,21 +13,21 @@ platform_is :windows do end it "raises TypeError given invalid argument" do - -> { WIN32OLE_EVENT.new "A" }.should raise_error TypeError + -> { WIN32OLE::Event.new "A" }.should raise_error TypeError end it "raises RuntimeError if event does not exist" do - -> { WIN32OLE_EVENT.new(@xml_dom, 'A') }.should raise_error RuntimeError + -> { WIN32OLE::Event.new(@xml_dom, 'A') }.should raise_error RuntimeError end it "raises RuntimeError if OLE object has no events" do dict = WIN32OLESpecs.new_ole('Scripting.Dictionary') - -> { WIN32OLE_EVENT.new(dict) }.should raise_error RuntimeError + -> { WIN32OLE::Event.new(dict) }.should raise_error RuntimeError end - it "creates WIN32OLE_EVENT object" do - ev = WIN32OLE_EVENT.new(@xml_dom) - ev.should be_kind_of WIN32OLE_EVENT + it "creates WIN32OLE::Event object" do + ev = WIN32OLE::Event.new(@xml_dom) + ev.should be_kind_of WIN32OLE::Event end end end diff --git a/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb b/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb index 0957bdd2d4..acc7d2d6b6 100644 --- a/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_event/on_event_spec.rb @@ -15,7 +15,7 @@ platform_is :windows do @event_spec_alt = "spec_alt" end - describe "WIN32OLE_EVENT#on_event" do + describe "WIN32OLE::Event#on_event" do before :all do @fn_xml = File.absolute_path "../fixtures/event.xml", __dir__ end @@ -23,7 +23,7 @@ platform_is :windows do before :each do @xml_dom = WIN32OLESpecs.new_ole 'MSXML.DOMDocument' @xml_dom.async = true - @ev = WIN32OLE_EVENT.new @xml_dom + @ev = WIN32OLE::Event.new @xml_dom @event_global = '' @event_specific = '' @event_spec_alt = '' @@ -37,21 +37,21 @@ platform_is :windows do it "sets global event handler properly, and the handler is invoked by event loop" do @ev.on_event { |*args| handler_global(*args) } @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>" - WIN32OLE_EVENT.message_loop + WIN32OLE::Event.message_loop @event_global.should =~ /onreadystatechange/ end it "accepts a String argument and the handler is invoked by event loop" do @ev.on_event("onreadystatechange") { |*args| @event = 'foo' } @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>" - WIN32OLE_EVENT.message_loop + WIN32OLE::Event.message_loop @event.should =~ /foo/ end it "accepts a Symbol argument and the handler is invoked by event loop" do @ev.on_event(:onreadystatechange) { |*args| @event = 'bar' } @xml_dom.loadXML "<program><name>Ruby</name><version>trunk</version></program>" - WIN32OLE_EVENT.message_loop + WIN32OLE::Event.message_loop @event.should =~ /bar/ end @@ -60,7 +60,7 @@ platform_is :windows do @ev.on_event("onreadystatechange") { |*args| handler_specific(*args) } @ev.on_event("onreadystatechange") { |*args| handler_spec_alt(*args) } @xml_dom.load @fn_xml - WIN32OLE_EVENT.message_loop + WIN32OLE::Event.message_loop @event_global.should == 'ondataavailable' @event_global.should_not =~ /onreadystatechange/ @event_specific.should == '' diff --git a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb index ece71df0d4..e5f55f2d38 100644 --- a/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/dispid_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#dispid" do + describe "WIN32OLE::Method#dispid" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m = WIN32OLE_METHOD.new(ole_type, "namespace") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m = WIN32OLE::Method.new(ole_type, "namespace") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb index 78634d2fde..bea47348ee 100644 --- a/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/event_interface_spec.rb @@ -3,12 +3,12 @@ platform_is :windows do require_relative '../fixtures/classes' guard -> { WIN32OLESpecs::SYSTEM_MONITOR_CONTROL_AVAILABLE } do - describe "WIN32OLE_METHOD#event_interface" do + describe "WIN32OLE::Method#event_interface" do before :each do - ole_type = WIN32OLE_TYPE.new("System Monitor Control", "SystemMonitor") - @on_dbl_click_method = WIN32OLE_METHOD.new(ole_type, "OnDblClick") - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @namespace_method = WIN32OLE_METHOD.new(ole_type, "namespace") + ole_type = WIN32OLE::Type.new("System Monitor Control", "SystemMonitor") + @on_dbl_click_method = WIN32OLE::Method.new(ole_type, "OnDblClick") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @namespace_method = WIN32OLE::Method.new(ole_type, "namespace") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb index 9b642a010c..5a94cf5ce6 100644 --- a/spec/ruby/library/win32ole/win32ole_method/event_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/event_spec.rb @@ -3,10 +3,10 @@ platform_is :windows do require_relative '../fixtures/classes' guard -> { WIN32OLESpecs::SYSTEM_MONITOR_CONTROL_AVAILABLE } do - describe "WIN32OLE_METHOD#event?" do + describe "WIN32OLE::Method#event?" do before :each do - ole_type = WIN32OLE_TYPE.new("System Monitor Control", "SystemMonitor") - @on_dbl_click_method = WIN32OLE_METHOD.new(ole_type, "OnDblClick") + ole_type = WIN32OLE::Type.new("System Monitor Control", "SystemMonitor") + @on_dbl_click_method = WIN32OLE::Method.new(ole_type, "OnDblClick") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb index d1c5ee3be2..83f34b9c10 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpcontext_spec.rb @@ -2,12 +2,12 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#helpcontext" do + describe "WIN32OLE::Method#helpcontext" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "FileSystemObject") - @get_file_version = WIN32OLE_METHOD.new(ole_type, "GetFileVersion") - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + @get_file_version = WIN32OLE::Method.new(ole_type, "GetFileVersion") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb index 59dad9244c..9cf9d63d3b 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpfile_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#helpfile" do + describe "WIN32OLE::Method#helpfile" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb index b2f24ba151..5ae4a5e090 100644 --- a/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/helpstring_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#helpstring" do + describe "WIN32OLE::Method#helpstring" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb index d7fedf0d36..06acbb58a5 100644 --- a/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/invkind_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#invkind" do + describe "WIN32OLE::Method#invkind" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb index d5536fd17b..0e97ec3305 100644 --- a/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/invoke_kind_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#invoke_kind" do + describe "WIN32OLE::Method#invoke_kind" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/name_spec.rb b/spec/ruby/library/win32ole/win32ole_method/name_spec.rb index 477b820f4d..6e2e233a62 100644 --- a/spec/ruby/library/win32ole/win32ole_method/name_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/name_spec.rb @@ -4,7 +4,7 @@ require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#name" do + describe "WIN32OLE::Method#name" do it_behaves_like :win32ole_method_name, :name end diff --git a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb index 4e427421b9..46186ae566 100644 --- a/spec/ruby/library/win32ole/win32ole_method/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/new_spec.rb @@ -2,31 +2,31 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD.new" do + describe "WIN32OLE::Method.new" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end it "raises TypeError when given non-strings" do - -> { WIN32OLE_METHOD.new(1, 2) }.should raise_error TypeError + -> { WIN32OLE::Method.new(1, 2) }.should raise_error TypeError end it "raises ArgumentError if only 1 argument is given" do - -> { WIN32OLE_METHOD.new("hello") }.should raise_error ArgumentError - -> { WIN32OLE_METHOD.new(@ole_type) }.should raise_error ArgumentError + -> { WIN32OLE::Method.new("hello") }.should raise_error ArgumentError + -> { WIN32OLE::Method.new(@ole_type) }.should raise_error ArgumentError end - it "returns a valid WIN32OLE_METHOD object" do - WIN32OLE_METHOD.new(@ole_type, "Open").should be_kind_of WIN32OLE_METHOD - WIN32OLE_METHOD.new(@ole_type, "open").should be_kind_of WIN32OLE_METHOD + it "returns a valid WIN32OLE::Method object" do + WIN32OLE::Method.new(@ole_type, "Open").should be_kind_of WIN32OLE::Method + WIN32OLE::Method.new(@ole_type, "open").should be_kind_of WIN32OLE::Method end - it "raises WIN32OLERuntimeError if the method does not exist" do - -> { WIN32OLE_METHOD.new(@ole_type, "NonexistentMethod") }.should raise_error WIN32OLERuntimeError + it "raises WIN32OLE::RuntimeError if the method does not exist" do + -> { WIN32OLE::Method.new(@ole_type, "NonexistentMethod") }.should raise_error WIN32OLE::RuntimeError end it "raises TypeError if second argument is not a String" do - -> { WIN32OLE_METHOD.new(@ole_type, 5) }.should raise_error TypeError + -> { WIN32OLE::Method.new(@ole_type, 5) }.should raise_error TypeError end end diff --git a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb index b3da9a8303..3c80cb3c2a 100644 --- a/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/offset_vtbl_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#offset_vtbl" do + describe "WIN32OLE::Method#offset_vtbl" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb index 09fb0eb5ac..0b1b4595a3 100644 --- a/spec/ruby/library/win32ole/win32ole_method/params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/params_spec.rb @@ -2,12 +2,12 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#params" do + describe "WIN32OLE::Method#params" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") - ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") - @m_browse_for_folder = WIN32OLE_METHOD.new(ole_type, "BrowseForFolder") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do @@ -19,8 +19,8 @@ platform_is :windows do @m_file_name.params.should be_empty end - it "returns 4-element array of WIN32OLE_PARAM for Shell's 'BrowseForFolder' method" do - @m_browse_for_folder.params.all? { |p| p.kind_of? WIN32OLE_PARAM }.should be_true + it "returns 4-element array of WIN32OLE::Param for Shell's 'BrowseForFolder' method" do + @m_browse_for_folder.params.all? { |p| p.kind_of? WIN32OLE::Param }.should be_true @m_browse_for_folder.params.size == 4 end diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb index 582a5951d5..c3725bfef2 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_type_detail_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#return_type_detail" do + describe "WIN32OLE::Method#return_type_detail" 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb index dd8add402d..9e5a1eb1df 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_type_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#return_type" do + describe "WIN32OLE::Method#return_type" do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb index 3fca3d54ed..34fd135b8c 100644 --- a/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/return_vtype_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#return_vtype" do + describe "WIN32OLE::Method#return_vtype" 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb index ddaff4011b..7e2197ca5a 100644 --- a/spec/ruby/library/win32ole/win32ole_method/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_method/shared/name.rb @@ -3,8 +3,8 @@ platform_is :windows do describe :win32ole_method_name, shared: true do before :each do - ole_type = WIN32OLE_TYPE.new("Microsoft Scripting Runtime", "File") - @m_file_name = WIN32OLE_METHOD.new(ole_type, "name") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "File") + @m_file_name = WIN32OLE::Method.new(ole_type, "name") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb index fe9facb53a..38cb21ccef 100644 --- a/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/size_opt_params_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#size_opt_params" do + describe "WIN32OLE::Method#size_opt_params" 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb index 8ea6e61e7d..5d0a35a0ef 100644 --- a/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/size_params_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#size_params" do + describe "WIN32OLE::Method#size_params" 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb index 11107a77fc..cdcc4525b1 100644 --- a/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/to_s_spec.rb @@ -4,7 +4,7 @@ require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#name" do + describe "WIN32OLE::Method#name" do it_behaves_like :win32ole_method_name, :to_s end diff --git a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb index d1a50523fc..2f02c15c8b 100644 --- a/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_method/visible_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_METHOD#visible?" do + describe "WIN32OLE::Method#visible?" 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") + @m_browse_for_folder = WIN32OLE::Method.new(ole_type, "BrowseForFolder") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb index 44bd3d7fd3..a37b03866d 100644 --- a/spec/ruby/library/win32ole/win32ole_param/default_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/default_spec.rb @@ -2,14 +2,14 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#default" do + 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") + 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") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end @@ -17,7 +17,7 @@ platform_is :windows do -> { @params[0].default(1) }.should raise_error ArgumentError end - it "returns nil for each of WIN32OLE_PARAM for Shell's 'BrowseForFolder' method" do + it "returns nil for each of WIN32OLE::Param for Shell's 'BrowseForFolder' method" do @params.each do |p| p.default.should be_nil end diff --git a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb index e9134b1df8..d7e27d7739 100644 --- a/spec/ruby/library/win32ole/win32ole_param/input_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/input_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#input?" do + 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") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end diff --git a/spec/ruby/library/win32ole/win32ole_param/name_spec.rb b/spec/ruby/library/win32ole/win32ole_param/name_spec.rb index 67a8955ba4..2c3474ffb3 100644 --- a/spec/ruby/library/win32ole/win32ole_param/name_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/name_spec.rb @@ -4,7 +4,7 @@ require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#name" do + describe "WIN32OLE::Param#name" do it_behaves_like :win32ole_param_name, :name 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 index f05455e3f1..e3379dbf3e 100644 --- a/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_detail_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#ole_type_detail" do + 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") + 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 diff --git a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb index 1467130e03..a7b6666807 100644 --- a/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/ole_type_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#ole_type" do + 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") + ole_type = WIN32OLE::Type.new("Microsoft Scripting Runtime", "FileSystemObject") + m_copyfile = WIN32OLE::Method.new(ole_type, "CopyFile") @param_overwritefiles = m_copyfile.params[2] end diff --git a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb index b39ee41179..50e95fc77f 100644 --- a/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/optional_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#optional?" do + 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") + 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 diff --git a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb index dd613dd29a..fa4a09ea0c 100644 --- a/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/retval_spec.rb @@ -2,10 +2,10 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#retval?" do + 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") + 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 diff --git a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb index 043bc32856..56ff24ddc8 100644 --- a/spec/ruby/library/win32ole/win32ole_param/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_param/shared/name.rb @@ -3,8 +3,8 @@ platform_is :windows do 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") + 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 diff --git a/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb index e9153a2eb2..c59f426692 100644 --- a/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_param/to_s_spec.rb @@ -4,7 +4,7 @@ require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_PARAM#to_s" do + describe "WIN32OLE::Param#to_s" do it_behaves_like :win32ole_param_name, :to_s end diff --git a/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb b/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb index abdf8d34b9..e574a945ad 100644 --- a/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/guid_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#guid for Shell Controls" do + describe "WIN32OLE::Type#guid for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb index eee23abc56..35911fec52 100644 --- a/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/helpcontext_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#helpcontext for Shell Controls" do + describe "WIN32OLE::Type#helpcontext for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb index 3a0a9ead94..7bd61a1c40 100644 --- a/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/helpfile_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#helpfile for Shell Controls" do + describe "WIN32OLE::Type#helpfile for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb b/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb index 9ab0004668..940475b25e 100644 --- a/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/helpstring_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#helpstring for Shell Controls" do + describe "WIN32OLE::Type#helpstring for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb b/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb index 7d2731f778..598e5bcef8 100644 --- a/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/major_version_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#major_version for Shell Controls" do + describe "WIN32OLE::Type#major_version for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb b/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb index 3904e78d42..59cfb94012 100644 --- a/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/minor_version_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#minor_version for Shell Controls" do + describe "WIN32OLE::Type#minor_version for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/name_spec.rb b/spec/ruby/library/win32ole/win32ole_type/name_spec.rb index d76998d7dc..4cc3426872 100644 --- a/spec/ruby/library/win32ole/win32ole_type/name_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/name_spec.rb @@ -4,7 +4,7 @@ require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#name" do + describe "WIN32OLE::Type#name" do it_behaves_like :win32ole_type_name, :name end diff --git a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb index cc691ffa67..185a235940 100644 --- a/spec/ruby/library/win32ole/win32ole_type/new_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/new_spec.rb @@ -2,39 +2,39 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.new" do + describe "WIN32OLE::Type.new" do it "raises ArgumentError with no argument" do - -> { WIN32OLE_TYPE.new }.should raise_error ArgumentError + -> { WIN32OLE::Type.new }.should raise_error ArgumentError end it "raises ArgumentError with invalid string" do - -> { WIN32OLE_TYPE.new("foo") }.should raise_error ArgumentError + -> { WIN32OLE::Type.new("foo") }.should raise_error ArgumentError end it "raises TypeError if second argument is not a String" do - -> { WIN32OLE_TYPE.new(1,2) }.should raise_error TypeError + -> { WIN32OLE::Type.new(1,2) }.should raise_error TypeError -> { - WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation',2) + 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 + it "raise WIN32OLE::RuntimeError if OLE object specified is not found" do -> { - WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','foo') - }.should raise_error WIN32OLERuntimeError + WIN32OLE::Type.new('Microsoft Shell Controls And Automation','foo') + }.should raise_error WIN32OLE::RuntimeError -> { - WIN32OLE_TYPE.new('Microsoft Shell Controls And Automation','Application') - }.should raise_error WIN32OLERuntimeError + WIN32OLE::Type.new('Microsoft Shell Controls And Automation','Application') + }.should raise_error WIN32OLE::RuntimeError 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 + 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 + 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 diff --git a/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb b/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb index a3a1d4ac58..ed14e37a95 100644 --- a/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/ole_classes_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.ole_classes for Shell Controls" do + describe "WIN32OLE::Type.ole_classes for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -12,7 +12,7 @@ platform_is :windows do 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 + WIN32OLE::Type.ole_classes("Microsoft Shell Controls And Automation").all? {|e| e.kind_of? WIN32OLE::Type }.should be_true 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 index 3b99b97a61..0c031abaa6 100644 --- a/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/ole_methods_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#ole_methods for Shell Controls" do + describe "WIN32OLE::Type#ole_methods for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -12,7 +12,7 @@ platform_is :windows do end it "returns an Integer" do - @ole_type.ole_methods.all? { |m| m.kind_of? WIN32OLE_METHOD }.should be_true + @ole_type.ole_methods.all? { |m| m.kind_of? WIN32OLE::Method }.should be_true 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 index 24292b1c4f..49c1902f8c 100644 --- a/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/ole_type_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#ole_type for Shell Controls" do + describe "WIN32OLE::Type#ole_type for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb index 340fdb34e8..9a700426d9 100644 --- a/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/progid_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#progid for Shell Controls" do + describe "WIN32OLE::Type#progid for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb index 793535b48d..b1b57960cd 100644 --- a/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/progids_spec.rb @@ -2,13 +2,13 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.progids" do + describe "WIN32OLE::Type.progids" do it "raises ArgumentError if an argument is given" do - -> { WIN32OLE_TYPE.progids(1) }.should raise_error ArgumentError + -> { 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 + WIN32OLE::Type.progids().include?('Shell.Explorer').should be_true end end diff --git a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb index 6f37446b23..efae7aeec1 100644 --- a/spec/ruby/library/win32ole/win32ole_type/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_type/shared/name.rb @@ -3,7 +3,7 @@ platform_is :windows do describe :win32ole_type_name, shared: true do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") end it "raises ArgumentError if argument is given" do diff --git a/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb b/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb index 3f89fe702a..3c7651cc1f 100644 --- a/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/src_type_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#src_type for Shell Controls" do + describe "WIN32OLE::Type#src_type for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb b/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb index 9f086a5a35..03a0344fdb 100644 --- a/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/to_s_spec.rb @@ -4,7 +4,7 @@ require_relative 'shared/name' platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#to_s" do + describe "WIN32OLE::Type#to_s" do it_behaves_like :win32ole_type_name, :to_s end diff --git a/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb index 391d505e01..8b62f3e2eb 100644 --- a/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/typekind_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#typekind for Shell Controls" do + describe "WIN32OLE::Type#typekind for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb index a487208caa..71d7cf00f7 100644 --- a/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/typelibs_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE.typelibs for Shell Controls" do + describe "WIN32OLE::Type.typelibs for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do @@ -12,11 +12,11 @@ platform_is :windows do end it "raises ArgumentError if any argument is give" do - -> { WIN32OLE_TYPE.typelibs(1) }.should raise_error ArgumentError + -> { 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 + WIN32OLE::Type.typelibs().include?("Microsoft Shell Controls And Automation").should be_true end end diff --git a/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb b/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb index 7f61b8af95..b1a407523c 100644 --- a/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/variables_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#variables for Shell Controls" do + describe "WIN32OLE::Type#variables for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do diff --git a/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb index 99e34edcdd..05c54c8838 100644 --- a/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_type/visible_spec.rb @@ -2,9 +2,9 @@ require_relative "../../../spec_helper" platform_is :windows do require 'win32ole' - describe "WIN32OLE_TYPE#visible? for Shell Controls" do + describe "WIN32OLE::Type#visible? for Shell Controls" do before :each do - @ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell") + @ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "Shell") end after :each do 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 index 7a9c791494..89576ceedc 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/ole_type_detail_spec.rb @@ -6,7 +6,7 @@ platform_is :windows 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] 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 index 03a9aa4c74..441011f1e7 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/ole_type_spec.rb @@ -6,7 +6,7 @@ platform_is :windows 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end diff --git a/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb b/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb index 033e830fac..d02942ce0a 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/shared/name.rb @@ -5,7 +5,7 @@ platform_is :windows 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end diff --git a/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb index b7849793c5..d26273ebed 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/value_spec.rb @@ -6,7 +6,7 @@ platform_is :windows 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] 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 index 7a79d32ddc..17bc47160a 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/variable_kind_spec.rb @@ -6,7 +6,7 @@ platform_is :windows 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end diff --git a/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb index 9d7b8238c8..c5f8164509 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/varkind_spec.rb @@ -7,7 +7,7 @@ platform_is :windows 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end diff --git a/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb b/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb index 60252e8139..ba53a81de0 100644 --- a/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb +++ b/spec/ruby/library/win32ole/win32ole_variable/visible_spec.rb @@ -6,7 +6,7 @@ platform_is :windows 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") + ole_type = WIN32OLE::Type.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants") @var = ole_type.variables[0] end |