Sha256: 44a37256f7aae1766271176dbf48b812051144dc57750ca1ffea6299cb9cd8f2

Contents?: true

Size: 1.97 KB

Versions: 64

Compression:

Stored size: 1.97 KB

Contents

require 'spec_helper'

describe CurationConcerns::AbilityHelper do
  describe "#visibility_badge" do
    subject { helper.visibility_badge visibility }
    {
      Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC =>
        "<span class=\"label label-success\">Open Access</span>",
      Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED =>
        "<span class=\"label label-info\">%s</span>",
      Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE =>
        "<span class=\"label label-danger\">Private</span>",
      Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO =>
        "<span class=\"label label-warning\">Embargo</span>",
      Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE =>
        "<span class=\"label label-warning\">Lease</span>"
    }.each do |value, output|
      context value do
        let(:visibility) { value }
        it { expect(subject).to eql(output % t('curation_concerns.institution_name')) }
      end
    end
  end
  describe "#visibility_options" do
    let(:public_opt) { ['Open Access', Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC] }
    let(:authenticated_opt) { [t('curation_concerns.institution_name'), Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED] }
    let(:private_opt) { ['Private', Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE] }
    subject { helper.visibility_options(option) }
    context 'all options' do
      let(:options) { [public_opt, authenticated_opt, private_opt] }
      let(:option) { nil }
      it { is_expected.to eql(options) }
    end
    context 'restricting options' do
      let(:options) { [private_opt, authenticated_opt] }
      let(:option) { :restrict }
      it { is_expected.to eql(options) }
    end
    context 'loosening options' do
      let(:options) { [public_opt, authenticated_opt] }
      let(:option) { :loosen }
      it { is_expected.to eql(options) }
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.7 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-2.0.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-2.0.0.rc2 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.6 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.5 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.4 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.3 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.2 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-2.0.0.rc1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.7.0.beta1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.6.3 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.6.2 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.6.1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.6.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.5.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.4.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-1.3.3 spec/helpers/curation_concerns/ability_helper_spec.rb