Sha256: fc3348d2ecb8476529423399dca79b53771739e55aa68b670cdc9cf43e9dff7f

Contents?: true

Size: 969 Bytes

Versions: 28

Compression:

Stored size: 969 Bytes

Contents

require 'spec_helper'

describe Shoulda::Matchers::ActionController::RespondWithContentTypeMatcher do
  context "a controller responding with content type :xml" do
    let(:controller) { build_response { render :xml => { :user => "thoughtbot" }.to_xml } }

    it "should accept responding with content type :xml" do
      controller.should respond_with_content_type(:xml)
    end

    it "should accept responding with content type 'application/xml'" do
      controller.should respond_with_content_type('application/xml')
    end

    it "should accept responding with content type /xml/" do
      controller.should respond_with_content_type(/xml/)
    end

    it "should reject responding with another content type" do
      controller.should_not respond_with_content_type(:json)
    end
  end

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

Version data entries

28 entries across 20 versions & 4 rubygems

Version Path
challah-1.0.0.beta vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
devise_sociable-0.1.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-0.9.1.beta vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-0.9.0 vendor/bundle/gems/shoulda-matchers-1.4.2/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.4.2 spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-0.8.3 vendor/bundle/gems/shoulda-matchers-1.4.1/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.4.1 spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.4.0 spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-0.8.1 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.2.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb
challah-rolls-0.1.0 vendor/bundle/gems/shoulda-matchers-1.3.0/spec/shoulda/action_controller/respond_with_content_type_matcher_spec.rb