Sha256: 0c08c5b690775b625c5e646255fd0aef9353235404dcc6f1c9208a9942ef08bb
Contents?: true
Size: 794 Bytes
Versions: 33
Compression:
Stored size: 794 Bytes
Contents
require 'spec_helper' describe RestPack::Serializer::Single do before(:each) do @album = FactoryGirl.create(:album_with_songs, song_count: 11) @song = @album.songs.first end let(:resource) { MyApp::SongSerializer.single(params, scope, context) } let(:params) { { id: @song.id } } let(:scope) { nil } let(:context) { { } } it "returns a resource by id" do resource[:id].should == @song.id.to_s resource[:title].should == @song.title end context "with context" do let(:context) { { reverse_title?: true } } it "returns reversed titles" do resource[:title].should == @song.title.reverse end end context "invalid id" do let(:params) { { id: @song.id + 100 } } it "returns nil" do resource.should == nil end end end
Version data entries
33 entries across 33 versions & 1 rubygems