test/responder_test.rb in roar-rails-0.0.3 vs test/responder_test.rb in roar-rails-0.0.4
- old
+ new
@@ -1,33 +1,30 @@
require 'test_helper'
Singer = Struct.new(:name)
-class SingersController < ActionController::Base
- respond_to :json
- def explicit_representer
- singer = Musician.new("Bumi")
- respond_with singer, :with_representer => SingerRepresenter
- end
+class ResponderTest < ActionController::TestCase
+ include Roar::Rails::TestCase
+
+ class SingersController < ActionController::Base
+ include Roar::Rails::ControllerAdditions
+ respond_to :json
- def implicit_representer
- singer = Singer.new("Bumi")
- respond_with singer
- end
+ def explicit_representer
+ singer = Musician.new("Bumi")
+ respond_with singer, :with_representer => SingerRepresenter
+ end
- def collection_of_representers
- singers = [Singer.new("Bumi"), Singer.new("Bjork"), Singer.new("Sinead")]
- respond_with singers
- end
+ def implicit_representer
+ singer = Singer.new("Bumi")
+ respond_with singer
+ end
- def self.responder
- Class.new(super).send :include, Roar::Rails::Responder
+ def collection_of_representers
+ singers = [Singer.new("Bumi"), Singer.new("Bjork"), Singer.new("Sinead")]
+ respond_with singers
+ end
end
-
-end
-
-class ResponderTest < ActionController::TestCase
- include Roar::Rails::TestCase
tests SingersController
test "responder allows specifying representer" do
get :explicit_representer, :format => 'json'