Sha256: 48f0ce89b6702cce537f7f7ff9b5e527114f0eec0c557bf54eff416c17745f6c

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 Bytes

Contents

require 'test_helper.rb'

class DecorateResponderTest < ActionController::TestCase
  tests AppController

  def json
    JSON[@response.body]
  end

  def test_non_decoration
    AppController.resource = ['abc']

    get :index, format: :json

    assert_equal 1, json.size
    assert_equal 'abc', json[0]
  end

  def test_decoration
    AppController.resource = User.new(name: 'John')

    get :index, format: :json

    assert_equal 'UserDecorator', json['class']
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
decorate-responder-2.1.0 test/decorate_responder_test.rb
decorate-responder-2.0.0 test/decorate_responder_test.rb