Skip to content

Commit

Permalink
moving controller into responder_test namespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
apotonick committed Mar 6, 2012
1 parent accaa41 commit 7ad3528
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
41 changes: 20 additions & 21 deletions test/responder_test.rb
@@ -1,28 +1,27 @@
require 'test_helper'

Singer = Struct.new(:name)
class SingersController < ActionController::Base
include Roar::Rails::ControllerAdditions
respond_to :json

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

def implicit_representer
singer = Singer.new("Bumi")
respond_with singer
end

def collection_of_representers
singers = [Singer.new("Bumi"), Singer.new("Bjork"), Singer.new("Sinead")]
respond_with singers
end
end

class ResponderTest < ActionController::TestCase
include Roar::Rails::TestCase

class SingersController < ActionController::Base
include Roar::Rails::ControllerAdditions
respond_to :json

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

def implicit_representer
singer = Singer.new("Bumi")
respond_with singer
end

def collection_of_representers
singers = [Singer.new("Bumi"), Singer.new("Bjork"), Singer.new("Sinead")]
respond_with singers
end
end

tests SingersController

Expand Down
2 changes: 2 additions & 0 deletions test/test_helper.rb
Expand Up @@ -8,3 +8,5 @@
require "dummy/config/environment"
require "rails/test_help" # adds stuff like @routes, etc.
require "roar/rails/test_case"

Singer = Struct.new(:name)

0 comments on commit 7ad3528

Please sign in to comment.