Sha256: 6823f500032c0b533b8055ed116682db1509fa24781b0b042c59250992505256

Contents?: true

Size: 1008 Bytes

Versions: 11

Compression:

Stored size: 1008 Bytes

Contents

# frozen_string_literal: true

shared_examples "follows" do
  include_context "with a feature"

  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

11 entries across 11 versions & 1 rubygems

Version Path
decidim-core-0.10.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.10.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.9.3 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.9.2 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.9.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.9.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.8.4 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.8.3 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.8.2 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.8.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.8.0 lib/decidim/core/test/shared_examples/follows_examples.rb