Created
September 11, 2013 09:15
-
-
Save nyku/6521223 to your computer and use it in GitHub Desktop.
Simple way of testing ActiveModel Serializers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SimpleSerializer < ActiveModel::Serializer | |
attributes :name, :code | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe SimpleSerializer do | |
context "Object methods" do | |
describe "#to_json" do | |
it "generates correct JSON" do | |
SimpleSerializer._attributes.keys.should == [:name, :code] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment