Sha256: 8f3c555bb786098e2b1830151c269ea0e6f59d8cf4e1ca50c2612560bbe6381a
Contents?: true
Size: 1.55 KB
Versions: 1
Compression:
Stored size: 1.55 KB
Contents
# frozen_string_literal: true shared_examples "follows" do include_context "with a component" before do login_as user, scope: :user end context "when not following the followable" do context "when user clicks the Follow button" do it "makes the user follow the followable" do visit resource_locator(followable).path expect do click_button "Follow" expect(page).to have_content "Stop following" end.to change(Decidim::Follow, :count).by(1) end end end context "when the user is following the followable" do before do create(:follow, followable: followable, user: user) end context "when user clicks the Follow button" do it "makes the user follow the followable" do visit resource_locator(followable).path expect do click_button "Stop following" expect(page).to have_content "Follow" end.to change(Decidim::Follow, :count).by(-1) end end end context "when the user is following the followable's participatory space" do before do create(:follow, followable: followable.participatory_space, user: user) end context "when user clicks the Follow button" do it "makes the user follow the followable" do visit resource_locator(followable).path expect do click_button "Already following #{translated(followable.participatory_space.title)}" expect(page).to have_content "Stop following" end.to change(Decidim::Follow, :count).by(1) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.22.0 | lib/decidim/core/test/shared_examples/follows_examples.rb |