Sha256: 95f8243c4ed3311d4f644c70b2036d56c62f65859bd70f283a1aadf473f12a87

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

require "spec_helper"

describe Arrthorizer::Privilege do
  describe :get do
    context "when the privilege does not exist" do
      it "raises a Privilege::NotFound error" do
        expect {
          Arrthorizer::Privilege.get("computer_says_no")
        }.to raise_error(Arrthorizer::Registry::NotFound)
      end
    end

    context "when the privilege with the given name exists" do
      let(:name) { "computer_says_hi" }

      before do
        @privilege = Arrthorizer::Privilege.new(name: name)
      end

      it "returns that privilege" do
        fetched_privilege = Arrthorizer::Privilege.get(name)

        expect(fetched_privilege).to be @privilege
      end
    end

    context "when the parameter is already a privilege" do
      before do
        @privilege = Arrthorizer::Privilege.new(name: "irrelevant")
      end

      specify "that privilege is returned" do
        fetched_privilege = Arrthorizer::Privilege.get(@privilege)

        expect(fetched_privilege).to be @privilege
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arrthorizer-0.4.2 spec/privilege/get_spec.rb
arrthorizer-0.4.1 spec/privilege/get_spec.rb
arrthorizer-0.3.2 spec/privilege/get_spec.rb
arrthorizer-0.3.1 spec/privilege/get_spec.rb
arrthorizer-0.3.0 spec/privilege/get_spec.rb
arrthorizer-0.2.1 spec/privilege/get_spec.rb
arrthorizer-0.2.0 spec/privilege/get_spec.rb