Browse files

Get the tests green. Eliminate the String/Symbol equality

  • Loading branch information...
1 parent 092e531 commit d87130d545fcda5e612b03deea9aabf2ae9e2b3f @wycats wycats committed Sep 9, 2010
View
0 spec/fixtures/real_world/frameworks/sproutcore/demo3.scss
No changes.
View
33 spec/lib/models/hash_struct/hash_spec.rb
@@ -26,37 +26,4 @@
e[:foo].should eql(:bar)
end
- it "should treat string and hash keys as the same for writing, but not reading" do
- e = SC::HashStruct.new
- e['foo'] = :bar
- e[:foo].should eql(:bar)
-
- e[:foo2] = :bar
- e['foo2'].should eql(nil)
- end
-
- it "should convert all keys to symbols (i.e. if you get keys, they will always be symbols)" do
- e = SC::HashStruct.new
- e['string'] = :foo
- e[:symbol] = :foo
-
- expected = [:string, :symbol]
- idx=0
- e.keys.sort { |a,b| a.to_s <=> b.to_s }.each do |k|
- k.should eql(expected[idx])
- idx += 1
- end
- end
-
- it "should raise error if key cannot be converted to symbol" do
- a = SC::HashStruct.new
-
- # numbers respond to to_sym but return nil
- lambda { a[1] = :foo }.should raise_error
-
- # Object does not respond to to_sym
- lambda { a[Object.new] = :foo }.should raise_error
- end
-
-
end
View
7 spec/lib/models/hash_struct/merge_spec.rb
@@ -2,13 +2,6 @@
describe SC::HashStruct, 'merge!' do
- it "should convert all keys to symbols - if symbol and string is passed, they will overrwite" do
- a = SC::HashStruct.new
- a.merge! :foo => :bar1, 'foo' => :bar2
- a.keys.size.should eql(1)
- a.keys.first.should eql(:foo)
- end
-
it "should do nothing if we merge self!" do
a = SC::HashStruct.new :foo => :bar
a.merge! a

0 comments on commit d87130d

Please sign in to comment.