Sha256: a2777d4a429a956765f4d9cec5afbae2305f976961f395eaa3e55c555d629c8a

Contents?: true

Size: 925 Bytes

Versions: 9

Compression:

Stored size: 925 Bytes

Contents

require 'spec_helper'

describe Shoulda::Matchers::ActionController::RespondWithContentTypeMatcher do
  it 'generates the correct description' do
    expected = 'respond with content type of application/xml'

    respond_with_content_type(:xml).description.should == expected
  end

  it 'accepts responding with content type as symbol' do
    xml_controller.should respond_with_content_type(:xml)
  end

  it 'accepts responding with qualified MIME-style content type' do
    xml_controller.should respond_with_content_type('application/xml')
  end

  it 'accepts responding with a regex matching the content type' do
    xml_controller.should respond_with_content_type(/xml/)
  end

  it 'rejects responding with another content type' do
    xml_controller.should_not respond_with_content_type(:json)
  end

  def xml_controller
    build_response do
      render :xml => { :user => 'thoughtbot' }.to_xml
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
challah-1.0.0.beta3 vendor/bundle/gems/shoulda-matchers-1.5.6/spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
challah-1.0.0.beta2 vendor/bundle/gems/shoulda-matchers-1.5.6/spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
challah-1.0.0.beta vendor/bundle/gems/shoulda-matchers-1.5.6/spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.5.6 spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.5.5 spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.5.4 spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.5.2 spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.5.1 spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb
shoulda-matchers-1.5.0 spec/shoulda/matchers/action_controller/respond_with_content_type_matcher_spec.rb