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-0.14.0.pre3 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.14.0.pre2 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.14.0.pre1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.13.1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.13.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre9 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre8 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre7 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre6 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre5 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre4 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre3 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre2 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.12.0.pre1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.11.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.11.0.rc1 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.10.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.9.0 spec/helpers/curation_concerns/ability_helper_spec.rb
curation_concerns-0.8.0 spec/helpers/curation_concerns/ability_helper_spec.rb