Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created March 20, 2011 02:31
Show Gist options
  • Save ukstudio/878004 to your computer and use it in GitHub Desktop.
Save ukstudio/878004 to your computer and use it in GitHub Desktop.
# coding: utf-8
RSpec.configure do |c|
c.filter_run_excluding :ruby => lambda{|version|
!(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
}
end
describe Hash do
context 'object_id' do
before(:all) do
@hash = {'object_id' => 7134}
end
subject { @hash }
# どっかのobject_idが呼ばれとる
its(['object_id']) { should_not eq 7134 }
its(['object_id']) { should_not eq subject.object_id }
its([:object_id]) { should_not be_nil }
its([:object_id]) { should_not eq 7134 }
its([:object_id]) { should_not eq subject.object_id }
end
context 'stringとsimbolで同名' do
before(:all) do
@hash = {'name' => 7134, :name => 1234}
end
subject { @hash }
its(['name']) { pending('simbolの方が呼ばれる'); should eq @hash['name'] }
its(['name']) { should eq @hash[:name] }
its([:name]) { should eq 1234 }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment