Sha256: b35a29a37a6bebc6403272d9c9a8f24235e8ba5bd5fccc7846d271734f350dd3

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'

describe Portier::ViewTagsPermission do
  describe "#can_view?" do
    context "with a view_tags permission" do
      before { @permission = Portier::ViewTagsPermission.new double(:app), double(:user) }

      context "with the undefined tag show_admin_link" do
        context "when checking if the user can view the show_admin_link" do
          specify { expect { @permission.can_view?(:show_admin_link) }.to raise_error(Portier::NoPermissionError) }
        end
      end

      context "with the tag show_admin_link restricting access to the user" do
        before { @permission.stub(:show_admin_link).and_return false }

        context "when checking if the user can view the show_admin_link" do
          specify { @permission.can_view?(:show_admin_link).should be_false }
        end
      end

      context "with the tag show_admin_link allowing access to the user" do
        before { @permission.stub(:show_admin_link).and_return true }

        context "when checking if the user can view the show_admin_link" do
          specify { @permission.can_view?(:show_admin_link).should be_true }
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
portier-1.0.3 spec/portier/view_tags_permission_spec.rb