Sha256: 194cb75e83902f6471048901802e7c1e559bfc7cee01f5758ffe7d4fd7132bda

Contents?: true

Size: 1022 Bytes

Versions: 91

Compression:

Stored size: 1022 Bytes

Contents

require 'test_helper'

class RespondWithContentTypeMatcherTest < ActionController::TestCase # :nodoc:

  context "a controller responding with content type :xml" do
    setup do
      @controller = build_response { render :xml => { :user => "thoughtbot" }.to_xml }
    end

    should "accept responding with content type :xml" do
      assert_accepts respond_with_content_type(:xml), @controller
    end

    should "accept responding with content type 'application/xml'" do
      assert_accepts respond_with_content_type('application/xml'), @controller
    end

    should "accept responding with content type /xml/" do
      assert_accepts respond_with_content_type(/xml/), @controller
    end

    should "reject responding with another content type" do
      assert_rejects respond_with_content_type(:json), @controller
    end
  end

  should "generate the correct test name" do
    assert_equal "respond with content type of application/xml",
                 respond_with_content_type(:xml).description
  end

end

Version data entries

91 entries across 61 versions & 10 rubygems

Version Path
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
challah-0.6.2 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
challah-0.6.1 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
dirty_history-0.5.4 dirty_history/ruby/1.9.1/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb
challah-0.6.0 vendor/bundle/gems/shoulda-2.11.3/test/matchers/controller/respond_with_content_type_matcher_test.rb