Sha256: 40f44e9fed1c3d16d816d2269df69938b40783c7be57e5b94b2cdd4085da25fb

Contents?: true

Size: 901 Bytes

Versions: 18

Compression:

Stored size: 901 Bytes

Contents

RSpec.describe Rails::Auth::ACL::Matchers::AllowAll do
  let(:matcher)     { described_class.new(enabled) }
  let(:example_env) { env_for(:get, "/") }

  describe "#initialize" do
    it "raises if given nil" do
      expect { described_class.new(nil) }.to raise_error(ArgumentError)
    end

    it "raises if given a non-boolean" do
      expect { described_class.new(42) }.to raise_error(ArgumentError)
    end
  end

  describe "#match" do
    context "enabled" do
      let(:enabled) { true }

      it "allows all requests" do
        expect(matcher.match(example_env)).to eq true
      end
    end

    context "disabled" do
      let(:enabled) { false }

      it "rejects all requests" do
        expect(matcher.match(example_env)).to eq false
      end
    end
  end

  it "knows its attributes" do
    matcher = described_class.new(true)
    expect(matcher.attributes).to eq true
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rails-auth-2.1.4 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-2.1.3 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-2.1.2 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-2.1.1 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-2.1.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-2.0.3 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-2.0.2 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-2.0.1 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-1.3.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-1.2.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-1.1.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-1.0.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.5.3 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.5.2 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.5.1 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.5.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.4.1 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.4.0 spec/rails/auth/acl/matchers/allow_all_spec.rb