BigW Consortium Gitlab

star.rb 775 Bytes
Newer Older
Ciro Santilli committed
1 2 3 4 5 6
class Spinach::Features::ProjectStar < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths
  include SharedUser

Dmitriy Zaporozhets committed
7
  step "The project has no stars" do
8
    expect(page).not_to have_content '.toggle-star'
Dmitriy Zaporozhets committed
9 10
  end

Ciro Santilli committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24
  step "The project has 0 stars" do
    has_n_stars(0)
  end

  step "The project has 1 star" do
    has_n_stars(1)
  end

  step "The project has 2 stars" do
    has_n_stars(2)
  end

  # Requires @javascript
  step "I click on the star toggle button" do
25 26 27 28
    find(".star-btn", visible: true).click
  end

  step 'I redirected to sign in page' do
29
    expect(current_path).to eq new_user_session_path
Ciro Santilli committed
30 31 32 33 34
  end

  protected

  def has_n_stars(n)
35
    expect(page).to have_css(".star-count", text: n, visible: true)
Ciro Santilli committed
36 37
  end
end