Sha256: 3a34a481ed10942da44ebceec4221e228f44380b6c0b4525072854a3b3e7281b

Contents?: true

Size: 1010 Bytes

Versions: 9

Compression:

Stored size: 1010 Bytes

Contents

# coding: UTF-8
require 'spec_helper'

describe Rescue::Controller::Dynamic do

  let(:object) { DynamicController.new }

  describe "respond method" do
    it "expects to be called in a subclass of ApplicationController" do
      expect(object.methods.include? Rescue.config.respond_name).to be_true
    end
  end

  TestCase::Controller::ERRORS.each do |name, code|

    describe "response when raise #{name}" do
      TestCase::Controller::FORMATS.each do |format|
        context "request format => #{format}" do
          before do
            visit "/dynamic/#{name.to_s.underscore}.#{format.to_sym}"
          end

          it { expect(page).to have_content name.to_s.gsub(/([A-Z]+)([A-Z][a-z])/,'\1 \2').gsub(/([a-z\d])([A-Z])/,'\1 \2') }
          it { expect(page).to have_content "This is an explanation of what caused the error." } unless format.to_sym == :html
          it { expect(response_headers["Content-Type"]).to include(format.to_s) }
        end
      end
    end
  end ## end each

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rescue-dog-0.3.8 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.3.7 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.3.5 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.3.4 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.3.2 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.3.1 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.3.0 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.2.1 spec/rescue/controllers/dynamic_spec.rb
rescue-dog-0.2.0 spec/rescue/controllers/dynamic_spec.rb