2014-09-02 18:07:02 +05:30
|
|
|
class Spinach::Features::ProjectStar < Spinach::FeatureSteps
|
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
include SharedUser
|
|
|
|
|
|
|
|
step "The project has no stars" do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_content '.toggle-star'
|
2014-09-02 18:07:02 +05:30
|
|
|
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
|
2015-04-26 12:48:37 +05:30
|
|
|
find(".star-btn", visible: true).click
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I redirected to sign in page' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(current_path).to eq new_user_session_path
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def has_n_stars(n)
|
2016-01-14 18:37:52 +05:30
|
|
|
expect(page).to have_css(".star-count", text: n, visible: true)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|