2014-06-26 03:49:14 -04:00
|
|
|
class Spinach::Features::ProjectStar < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
include SharedUser
|
|
|
|
|
2014-07-24 16:25:38 -04:00
|
|
|
step "The project has no stars" do
|
|
|
|
page.should_not have_content '.star-buttons'
|
|
|
|
end
|
|
|
|
|
2014-06-26 03:49:14 -04:00
|
|
|
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
|
2015-03-29 21:50:45 -04:00
|
|
|
find(".star-btn", visible: true).click
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I redirected to sign in page' do
|
|
|
|
current_path.should == new_user_session_path
|
2014-06-26 03:49:14 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def has_n_stars(n)
|
2015-03-29 21:50:45 -04:00
|
|
|
expect(page).to have_css(".star-btn .count", text: n, visible: true)
|
2014-06-26 03:49:14 -04:00
|
|
|
end
|
|
|
|
end
|