Sha256: 209ead7488dda5011669dead16f481e48a16455a856fc729477bb23b8e3ad367

Contents?: true

Size: 846 Bytes

Versions: 12

Compression:

Stored size: 846 Bytes

Contents

require 'test_helper'

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

  tests SingersController

  test "representers can use URL helpers" do
    get :show, :id => "bumi"
    assert_body "{\"name\":\"Bumi\",\"links\":[{\"rel\":\"self\",\"href\":\"http://http://roar.apotomo.de/singers/Bumi\"}]}"
  end

  test "it works with uninitialized config.representer.default_url_options" do
    url_options = Rails.application.config.representer.default_url_options
    
    begin
      Rails.application.config.representer.default_url_options = nil
      assert_raises RuntimeError, ArgumentError do
        get :show, :id => "bumi"
      end
      assert $!.message =~ /Missing host to link to/
    rescue
    ensure
      Rails.application.config.representer.default_url_options = url_options    
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
roar-rails-0.0.14 test/representer_test.rb
roar-rails-0.0.13 test/representer_test.rb
roar-rails-0.0.12 test/representer_test.rb
roar-rails-0.0.11 test/representer_test.rb
roar-rails-0.0.10 test/representer_test.rb
roar-rails-0.0.9 test/representer_test.rb
roar-rails-0.0.8 test/representer_test.rb
roar-rails-0.0.7 test/representer_test.rb
roar-rails-0.0.6 test/representer_test.rb
roar-rails-0.0.5 test/representer_test.rb
roar-rails-0.0.4 test/representer_test.rb
roar-rails-0.0.3 test/representer_test.rb