Sha256: 30dd4f84b01612a63deef815629565307b1d29aa32746c41570fb7e4ac41b4b1

Contents?: true

Size: 1.04 KB

Versions: 38

Compression:

Stored size: 1.04 KB

Contents

require File.join(File.dirname(__FILE__), '..', '..', '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

38 entries across 38 versions & 10 rubygems

Version Path
auser-poolparty-1.3.0 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.1 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.10 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.11 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.12 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.13 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.14 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.15 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.16 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.17 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.2 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.3 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.4 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.5 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.6 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.7 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
auser-poolparty-1.3.8 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
fairchild-poolparty-1.3.17 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
fairchild-poolparty-1.3.5 vendor/gems/shoulda/test/matchers/controller/respond_with_content_type_matcher_test.rb
iGEL-shoulda-2.10.2 test/matchers/controller/respond_with_content_type_matcher_test.rb