Sha256: 939f6382a2ce5f8a2d33ad389da7c514edbc2c7842541c291aa9a450c9dc4c5e

Contents?: true

Size: 1001 Bytes

Versions: 23

Compression:

Stored size: 1001 Bytes

Contents

# frozen_string_literal: true

shared_examples "follows" do
  include_context "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

23 entries across 23 versions & 2 rubygems

Version Path
decidim-core-0.7.4 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.7.3 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.7.2 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.7.1 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.7.0 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.8 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-0.6.8 decidim-core/lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.7 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-0.6.7 decidim-core/lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.6 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-0.6.6 decidim-core/lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.5 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-0.6.5 decidim-core/lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.4 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-0.6.4 decidim-core/lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.3 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-0.6.3 decidim-core/lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.2 lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-0.6.2 decidim-core/lib/decidim/core/test/shared_examples/follows_examples.rb
decidim-core-0.6.1 lib/decidim/core/test/shared_examples/follows_examples.rb