Sha256: 11f260bffb4f3285696731d3363cc79730cece7f3f346f8f1ec279dcdc1d7b35

Contents?: true

Size: 1010 Bytes

Versions: 28

Compression:

Stored size: 1010 Bytes

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
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
decidim-core-0.20.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.20.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.19.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.18.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.19.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.17.2 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.18.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.17.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.16.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.17.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.16.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.15.2 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.15.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.15.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.14.4 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.14.3 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.14.2 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.14.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.13.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.12.2 lib/decidim/core/test/shared_examples/follows_examples.rb