Sha256: 4182d55a2154bea48705acc9427316e7805ae7e5de4957d9e43fef8881944a0f

Contents?: true

Size: 660 Bytes

Versions: 4

Compression:

Stored size: 660 Bytes

Contents

require 'test_helper'

class ConsumeTest < ActionController::TestCase
  include Roar::Rails::TestCase
  
  class SingersController < ActionController::Base
    include Roar::Rails::ControllerAdditions
    respond_to :json, :xml

    def consume_json
      singer = consume!(Singer.new)
      render :text => singer.to_json
    end
  end

  tests SingersController
  
  test "#consume parses incoming document and updates the model" do
    post :consume_json, "{\"name\": \"Bumi\"}", :format => 'json'
    assert_equal singer.to_json, @response.body
  end

  def singer(name="Bumi")
    singer = Musician.new(name)
    singer.extend SingerRepresenter
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
roar-rails-0.0.7 test/consume_test.rb
roar-rails-0.0.6 test/consume_test.rb
roar-rails-0.0.5 test/consume_test.rb
roar-rails-0.0.4 test/consume_test.rb