Sha256: 6884304277c13d22ed6f7ec60d5d16f2a03bdace18717dbbc719dfb2e4dd454d
Contents?: true
Size: 1.49 KB
Versions: 13
Compression:
Stored size: 1.49 KB
Contents
describe "sufia/homepage/_announcement.html.erb", type: :view do let(:groups) { [] } let(:ability) { instance_double("Ability") } let(:announcement) { ContentBlock.new(name: ContentBlock::ANNOUNCEMENT, value: announcement_value) } subject { rendered } before do assign(:announcement_text, announcement) allow(controller).to receive(:current_ability).and_return(ability) allow(ability).to receive(:can?).with(:update, ContentBlock).and_return(can_update_content_block) render end context "when there is an announcement" do let(:announcement_value) { "I have an announcement!" } context "when the user can update content" do let(:can_update_content_block) { true } it { is_expected.to have_content announcement_value } it { is_expected.to have_button("Edit") } end context "when the user can't update content" do let(:can_update_content_block) { false } it { is_expected.to have_content announcement_value } it { is_expected.not_to have_button("Edit") } end end context "when there is no announcement" do let(:announcement_value) { "" } context "when the user can update content" do let(:can_update_content_block) { true } it { is_expected.to have_selector "#announcement" } it { is_expected.to have_button("Edit") } end context "when the user can't update content" do let(:can_update_content_block) { false } it { is_expected.not_to have_selector "#announcement" } end end end
Version data entries
13 entries across 13 versions & 1 rubygems