Skip to content

Commit

Permalink
Converts hash syntax for 1.8 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
joefiorini committed Jan 26, 2012
1 parent fcb42cc commit 24500b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SingersController < ApplicationController

def show
singer = Musician.find_by_id(params[:id])
respond_with singer, with_representer: SingerRepresenter
respond_with singer, :with_representer => SingerRepresenter
end

def self.responder
Expand Down
10 changes: 4 additions & 6 deletions test/responder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SingersController < ActionController::Base

def explicit_representer
singer = Musician.new("Bumi")
respond_with singer, with_representer: SingerRepresenter
respond_with singer, :with_representer => SingerRepresenter
end

def implicit_representer
Expand All @@ -31,17 +31,17 @@ class ResponderTest < ActionController::TestCase
tests SingersController

test "responder allows specifying representer" do
get :explicit_representer, format: 'json'
get :explicit_representer, :format => 'json'
assert_equal singer.to_json, @response.body
end

test "responder finds representer by convention" do
get :implicit_representer, format: 'json'
get :implicit_representer, :format => 'json'
assert_equal singer.to_json, @response.body
end

test "responder works with collections" do
get :collection_of_representers, format: 'json'
get :collection_of_representers, :format => 'json'
assert_equal singers.map(&:to_hash).to_json, @response.body
end

Expand All @@ -55,5 +55,3 @@ def singers
end

end


0 comments on commit 24500b9

Please sign in to comment.