Sha256: f34dbb56b5a68ab4d82bdd26600168997861c4259347ebaee663efbfbf07eabc

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

RSpec.describe Rails::Auth::ACL::Matchers::AllowAll do
  let(:predicate)   { 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(predicate.match(example_env)).to eq true
      end
    end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails-auth-0.3.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.2.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.1.0 spec/rails/auth/acl/matchers/allow_all_spec.rb
rails-auth-0.0.1 spec/rails/auth/acl/matchers/allow_all_spec.rb