Sha256: a91b41151041f6127480b2be26ba7ea146682ad93002e3b527205445e231e468

Contents?: true

Size: 864 Bytes

Versions: 3

Compression:

Stored size: 864 Bytes

Contents

require 'spec_helper'

describe "homepage/_home_header.html.erb" do
  let(:groups) { [] }
  let(:ability) { instance_double("Ability") }
  describe "share your work button" do
    before do
      allow(controller).to receive(:current_ability).and_return(ability)
      allow(ability).to receive(:can?).with(:view_share_work, GenericFile).and_return(can_view_share_work)
      stub_template "homepage/_marketing.html.erb" => "marketing"
      render
    end
    context "when the user can view" do
      let(:can_view_share_work) { true }
      it "should display" do
        expect(rendered).to have_content t("sufia.share_button")
      end
    end
    context "when the user can't view" do
      let(:can_view_share_work) { false }
      it "should not display" do
        expect(rendered).not_to have_content t("sufia.share_button")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sufia-6.2.0 spec/views/homepage/_home_header.html.erb_spec.rb
sufia-6.1.0 spec/views/homepage/_home_header.html.erb_spec.rb
sufia-6.0.0 spec/views/homepage/_home_header.html.erb_spec.rb