Sha256: a6a67abc57df060048ed924ddb340d4640e50ab26a2a52c32e1ecf727938feaf

Contents?: true

Size: 1.32 KB

Versions: 11

Compression:

Stored size: 1.32 KB

Contents

require "spec_helper"

describe Arrthorizer::Rails::ControllerConcern do
  describe :to_prepare_context do
    let(:controller_class) { Class.new(ApplicationController) }
    let(:expected_controller_configuration_type) { Arrthorizer::Rails::ControllerConfiguration }

    it "adds a ControllerConfiguration to the class" do
      expected_controller_configuration = an_instance_of(expected_controller_configuration_type)

      expect {
        controller_class.to_prepare_context do end
      }.to change { controller_class.arrthorizer_configuration }.to(expected_controller_configuration)
    end

    context "when we are dealing with a subclassed controller" do
      let(:controller_subclass) { Class.new(controller_class) }

      before :each do
        controller_class.to_prepare_context do end
      end

      it "does not alter the context config for the superclass" do
        expect {
          controller_subclass.to_prepare_context do end
        }.not_to change { controller_class.arrthorizer_configuration }
      end
    end

    context "when no configuration block is provided" do
      specify "an Arrthorizer::Rails::ControllerConfiguration::Error is raised" do
        expect {
          controller_class.to_prepare_context
        }.to raise_error(Arrthorizer::Rails::ControllerConfiguration::Error)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
arrthorizer-0.3.2 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.3.1 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.3.0 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.2.1 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.2.0 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.1.3 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.1.2 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.1.1 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.1.0 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.1.0.pre2 spec/rails/controller_concern/to_prepare_context_spec.rb
arrthorizer-0.1.0.pre spec/rails/controller_concern/to_prepare_context_spec.rb