diff options
Diffstat (limited to 'spec/ruby/library/openstruct')
| -rw-r--r-- | spec/ruby/library/openstruct/delete_field_spec.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/equal_value_spec.rb | 22 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/frozen_spec.rb | 12 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/initialize_spec.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/marshal_load_spec.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/method_missing_spec.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/new_spec.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/shared/inspect.rb | 2 | ||||
| -rw-r--r-- | spec/ruby/library/openstruct/to_h_spec.rb | 10 |
9 files changed, 33 insertions, 33 deletions
diff --git a/spec/ruby/library/openstruct/delete_field_spec.rb b/spec/ruby/library/openstruct/delete_field_spec.rb index 9ac80196cc..12fed6c90d 100644 --- a/spec/ruby/library/openstruct/delete_field_spec.rb +++ b/spec/ruby/library/openstruct/delete_field_spec.rb @@ -8,12 +8,12 @@ describe "OpenStruct#delete_field" do it "removes the named field from self's method/value table" do @os.delete_field(:name) - @os[:name].should be_nil + @os[:name].should == nil end it "does remove the accessor methods" do @os.delete_field(:name) - @os.respond_to?(:name).should be_false - @os.respond_to?(:name=).should be_false + @os.respond_to?(:name).should == false + @os.respond_to?(:name=).should == false end end diff --git a/spec/ruby/library/openstruct/equal_value_spec.rb b/spec/ruby/library/openstruct/equal_value_spec.rb index 103ac13588..c72c09ce14 100644 --- a/spec/ruby/library/openstruct/equal_value_spec.rb +++ b/spec/ruby/library/openstruct/equal_value_spec.rb @@ -8,21 +8,21 @@ describe "OpenStruct#==" do end it "returns false when the passed argument is no OpenStruct" do - (@os == Object.new).should be_false - (@os == "Test").should be_false - (@os == 10).should be_false - (@os == :sym).should be_false + (@os == Object.new).should == false + (@os == "Test").should == false + (@os == 10).should == false + (@os == :sym).should == false end it "returns true when self and other are equal method/value wise" do - (@os == @os).should be_true - (@os == OpenStruct.new(name: "John")).should be_true - (@os == OpenStructSpecs::OpenStructSub.new(name: "John")).should be_true + (@os == @os).should == true + (@os == OpenStruct.new(name: "John")).should == true + (@os == OpenStructSpecs::OpenStructSub.new(name: "John")).should == true - (@os == OpenStruct.new(name: "Jonny")).should be_false - (@os == OpenStructSpecs::OpenStructSub.new(name: "Jonny")).should be_false + (@os == OpenStruct.new(name: "Jonny")).should == false + (@os == OpenStructSpecs::OpenStructSub.new(name: "Jonny")).should == false - (@os == OpenStruct.new(name: "John", age: 20)).should be_false - (@os == OpenStructSpecs::OpenStructSub.new(name: "John", age: 20)).should be_false + (@os == OpenStruct.new(name: "John", age: 20)).should == false + (@os == OpenStructSpecs::OpenStructSub.new(name: "John", age: 20)).should == false end end diff --git a/spec/ruby/library/openstruct/frozen_spec.rb b/spec/ruby/library/openstruct/frozen_spec.rb index c14a4bac55..c37fd18c8c 100644 --- a/spec/ruby/library/openstruct/frozen_spec.rb +++ b/spec/ruby/library/openstruct/frozen_spec.rb @@ -9,25 +9,25 @@ describe "OpenStruct.new when frozen" do # method_missing case handled in method_missing_spec.rb # it "is still readable" do - @os.age.should eql(70) - @os.pension.should eql(300) + @os.age.should.eql?(70) + @os.pension.should.eql?(300) @os.name.should == "John Smith" end it "is not writable" do - ->{ @os.age = 42 }.should raise_error( RuntimeError ) + ->{ @os.age = 42 }.should.raise( RuntimeError ) end it "cannot create new fields" do - ->{ @os.state = :new }.should raise_error( RuntimeError ) + ->{ @os.state = :new }.should.raise( RuntimeError ) end it "creates a frozen clone" do f = @os.clone f.frozen?.should == true f.age.should == 70 - ->{ f.age = 0 }.should raise_error( RuntimeError ) - ->{ f.state = :newer }.should raise_error( RuntimeError ) + ->{ f.age = 0 }.should.raise( RuntimeError ) + ->{ f.state = :newer }.should.raise( RuntimeError ) end it "creates an unfrozen dup" do diff --git a/spec/ruby/library/openstruct/initialize_spec.rb b/spec/ruby/library/openstruct/initialize_spec.rb index dee5de48c6..52304cf780 100644 --- a/spec/ruby/library/openstruct/initialize_spec.rb +++ b/spec/ruby/library/openstruct/initialize_spec.rb @@ -3,6 +3,6 @@ require 'ostruct' describe "OpenStruct#initialize" do it "is private" do - OpenStruct.should have_private_instance_method(:initialize) + OpenStruct.private_instance_methods(false).should.include?(:initialize) end end diff --git a/spec/ruby/library/openstruct/marshal_load_spec.rb b/spec/ruby/library/openstruct/marshal_load_spec.rb index 342e5e68cd..a8cdda3b43 100644 --- a/spec/ruby/library/openstruct/marshal_load_spec.rb +++ b/spec/ruby/library/openstruct/marshal_load_spec.rb @@ -6,7 +6,7 @@ describe "OpenStruct#marshal_load when passed [Hash]" do os = OpenStruct.new os.send :marshal_load, age: 20, name: "John" - os.age.should eql(20) + os.age.should.eql?(20) os.name.should == "John" end end diff --git a/spec/ruby/library/openstruct/method_missing_spec.rb b/spec/ruby/library/openstruct/method_missing_spec.rb index 89f83d07b3..cf6734d629 100644 --- a/spec/ruby/library/openstruct/method_missing_spec.rb +++ b/spec/ruby/library/openstruct/method_missing_spec.rb @@ -7,18 +7,18 @@ describe "OpenStruct#method_missing when called with a method name ending in '=' end it "raises an ArgumentError when not passed any additional arguments" do - -> { @os.send(:test=) }.should raise_error(ArgumentError) + -> { @os.send(:test=) }.should.raise(ArgumentError) end end describe "OpenStruct#method_missing when passed additional arguments" do it "raises a NoMethodError when the key does not exist" do os = OpenStruct.new - -> { os.test(1, 2, 3) }.should raise_error(NoMethodError) + -> { os.test(1, 2, 3) }.should.raise(NoMethodError) end it "raises an ArgumentError when the key exists" do os = OpenStruct.new(test: 20) - -> { os.test(1, 2, 3) }.should raise_error(ArgumentError) + -> { os.test(1, 2, 3) }.should.raise(ArgumentError) end end diff --git a/spec/ruby/library/openstruct/new_spec.rb b/spec/ruby/library/openstruct/new_spec.rb index 5d2cacea40..9e53948c82 100644 --- a/spec/ruby/library/openstruct/new_spec.rb +++ b/spec/ruby/library/openstruct/new_spec.rb @@ -7,8 +7,8 @@ describe "OpenStruct.new when passed [Hash]" do end it "creates an attribute for each key of the passed Hash" do - @os.age.should eql(70) - @os.pension.should eql(300) + @os.age.should.eql?(70) + @os.pension.should.eql?(300) @os.name.should == "John Smith" end end diff --git a/spec/ruby/library/openstruct/shared/inspect.rb b/spec/ruby/library/openstruct/shared/inspect.rb index ffcd690e1f..d5fffa0e2e 100644 --- a/spec/ruby/library/openstruct/shared/inspect.rb +++ b/spec/ruby/library/openstruct/shared/inspect.rb @@ -4,7 +4,7 @@ describe :ostruct_inspect, shared: true do os.send(@method).should == "#<OpenStruct name=\"John Smith\">" os = OpenStruct.new(age: 20, name: "John Smith") - os.send(@method).should be_kind_of(String) + os.send(@method).should.is_a?(String) end it "correctly handles self-referential OpenStructs" do diff --git a/spec/ruby/library/openstruct/to_h_spec.rb b/spec/ruby/library/openstruct/to_h_spec.rb index 6c272bcc71..7d9c7db5dc 100644 --- a/spec/ruby/library/openstruct/to_h_spec.rb +++ b/spec/ruby/library/openstruct/to_h_spec.rb @@ -19,7 +19,7 @@ describe "OpenStruct#to_h" do end it "does not return the hash used as initializer" do - @to_h.should_not equal(@h) + @to_h.should_not.equal?(@h) end it "returns a Hash that is independent from the struct" do @@ -36,17 +36,17 @@ describe "OpenStruct#to_h" do it "raises ArgumentError if block returns longer or shorter array" do -> do @os.to_h { |k, v| [k.to_s, v*2, 1] } - end.should raise_error(ArgumentError, /element has wrong array length/) + end.should.raise(ArgumentError, /element has wrong array length/) -> do @os.to_h { |k, v| [k] } - end.should raise_error(ArgumentError, /element has wrong array length/) + end.should.raise(ArgumentError, /element has wrong array length/) end it "raises TypeError if block returns something other than Array" do -> do @os.to_h { |k, v| "not-array" } - end.should raise_error(TypeError, /wrong element type String/) + end.should.raise(TypeError, /wrong element type String/) end it "coerces returned pair to Array with #to_ary" do @@ -62,7 +62,7 @@ describe "OpenStruct#to_h" do -> do @os.to_h { |k| x } - end.should raise_error(TypeError, /wrong element type MockObject/) + end.should.raise(TypeError, /wrong element type MockObject/) end end end |
