spec/mongomodel/concerns/serialization/json_serialization_spec.rb in mongomodel-0.4.6 vs spec/mongomodel/concerns/serialization/json_serialization_spec.rb in mongomodel-0.4.7

- old
+ new

@@ -16,50 +16,50 @@ let(:instance) do TestModel.new(:name => 'Hello World', :age => 25, :paid => true, :prefs => { :foo => 'bar' }, :internal => 'hideme') end - it "should include root in json" do + it "includes root in json" do begin TestModel.include_root_in_json = true json = instance.to_json json.should match(/^\{"test_model":\{/) ensure TestModel.include_root_in_json = false end end - it "should encode all public attributes" do + it "encodes all public attributes" do json = instance.to_json json.should match(/"name":"Hello World"/) json.should match(/"age":25/) json.should match(/"paid":true/) json.should match(/"prefs":\{"foo":"bar"\}/) end - it "should not encode internal attributes" do + it "does not encode internal attributes" do json = instance.to_json json.should_not match(/"internal":"hideme"/) end - it "should allow attribute filtering with only" do + it "allows attribute filtering with only" do json = instance.to_json(:only => [:name, :age]) json.should match(/"name":"Hello World"/) json.should match(/"age":25/) json.should_not match(/"paid":true/) json.should_not match(/"prefs":\{"foo":"bar"\}/) end - it "should allow attribute filtering with except" do + it "allows attribute filtering with except" do json = instance.to_json(:except => [:name, :age]) json.should_not match(/"name":"Hello World"/) json.should_not match(/"age":25/) json.should match(/"paid":true/) json.should match(/"prefs":\{"foo":"bar"\}/) end - it "should allow methods to be included" do + it "allows methods to be included" do json = instance.to_json(:methods => [:hello, :type]) json.should match(/"hello":"Hi friend!"/) json.should match(/"type":"TestModel"/) end end