summaryrefslogtreecommitdiff
path: root/features/steps/project/star.rb
blob: 50cdfd73c347501a0fcd69386f97fd8f3b376cd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Spinach::Features::ProjectStar < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject
  include SharedPaths
  include SharedUser

  step "The project has no stars" do
    page.should_not have_content '.star-buttons'
  end

  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
    find(".star-btn", visible: true).click
  end

  step 'I redirected to sign in page' do
    current_path.should == new_user_session_path
  end

  protected

  def has_n_stars(n)
    expect(page).to have_css(".star-btn .count", text: n, visible: true)
  end
end