Sha256: a9a6462ea86837b720ff55d0a5c373de78c2cb7d021a71034284c5888957ba92

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

require "spec_helper"

describe "Board", :js => false do
  describe "GET corkboard/authorizations#index" do
    context "when the authentication requirement for 'admin' is :disallow!" do
      it "raises an exception" do
        with_config(:authentication, { :admin => :disallow! }) do
          expect { visit corkboard.authorizations_path }
            .to raise_error(Corkboard::ActionForbidden)
        end
      end
    end

    context "when the authentication requirement for 'admin' is nil" do
      it "is successful" do
        with_config(:authentication, { :admin => nil }) do
          visit corkboard.authorizations_path
          expect(page).to have_content('Activated Services')
          expect(page).to have_content('Available Services')
        end
      end
    end

    context "given an authenticated Admin" do
      before do
        Corkboard::ApplicationController.any_instance
          .stub(:authenticate!).and_return(true)
      end

      it "is successful" do
        with_config(:authentication, { :admin => :authenticate! }) do
          visit corkboard.authorizations_path
          expect(page).to have_content('Activated Services')
          expect(page).to have_content('Available Services')
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
corkboard-0.1.3 spec/requests/authorizations_spec.rb
corkboard-0.1.2 spec/requests/authorizations_spec.rb
corkboard-0.1.1 spec/requests/authorizations_spec.rb