mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
401b64c4e8
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
28 lines
940 B
Ruby
28 lines
940 B
Ruby
require_relative '../../spec_helper'
|
|
require "ostruct"
|
|
require_relative 'fixtures/classes'
|
|
|
|
describe "OpenStruct#==" do
|
|
before :each do
|
|
@os = OpenStruct.new(name: "John")
|
|
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
|
|
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 == OpenStruct.new(name: "Jonny")).should be_false
|
|
(@os == OpenStructSpecs::OpenStructSub.new(name: "Jonny")).should be_false
|
|
|
|
(@os == OpenStruct.new(name: "John", age: 20)).should be_false
|
|
(@os == OpenStructSpecs::OpenStructSub.new(name: "John", age: 20)).should be_false
|
|
end
|
|
end
|