Sha256: 9cbbf2c78e4f55962050573600cfe11235ed173c0c41e30c423650d8a64562b8

Contents?: true

Size: 761 Bytes

Versions: 7

Compression:

Stored size: 761 Bytes

Contents

describe Sufia::HomepagePresenter do
  let(:presenter) { described_class.new(ability) }
  let(:ability) { instance_double("Ability") }
  subject { presenter }
  it { is_expected.to delegate_method(:can?).to(:current_ability) }

  describe "#display_share_button?" do
    subject { presenter.display_share_button? }
    context "when config is set to always_display_share_button" do
      it { is_expected.to be true }
    end
    context "when config is not set to always_display_share_button" do
      before do
        allow(Sufia.config).to receive(:always_display_share_button).and_return(false)
        allow(ability).to receive(:can?).with(:create, an_instance_of(Class)).and_return(false)
      end
      it { is_expected.to be false }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sufia-7.4.1 spec/presenters/sufia/homepage_presenter_spec.rb
sufia-7.4.0 spec/presenters/sufia/homepage_presenter_spec.rb
sufia-7.3.1 spec/presenters/sufia/homepage_presenter_spec.rb
sufia-7.3.0 spec/presenters/sufia/homepage_presenter_spec.rb
sufia-7.3.0.rc3 spec/presenters/sufia/homepage_presenter_spec.rb
sufia-7.3.0.rc2 spec/presenters/sufia/homepage_presenter_spec.rb
sufia-7.3.0.rc1 spec/presenters/sufia/homepage_presenter_spec.rb