Sha256: 1cf35226a2478de88001e6a61298176f0b36f176bbce15d6d1a6a7cb5de34db4
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 KB
Contents
# frozen_string_literal: true shared_examples "follows" do 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 followable_path expect do click_on "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:, user:) end context "when user clicks the Follow button" do it "makes the user follow the followable" do visit followable_path expect do click_on "Stop following" expect(page).to have_content "Follow" end.to change(Decidim::Follow, :count).by(-1) end end end end shared_examples "follows with a component" do include_context "with a component" include_examples "follows" context "when the user is following the followable's participatory space" do before do create(:follow, followable: followable.participatory_space, user:) end context "when user clicks the Follow button" do it "makes the user follow the followable" do visit followable_path expect do click_on "Follow" expect(page).to have_content "Stop following" end.to change(Decidim::Follow, :count).by(1) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems