2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
|
2014-09-02 18:07:02 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedSnippet
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I visit my snippets page' do
|
2014-09-02 18:07:02 +05:30
|
|
|
visit user_snippets_path(current_user)
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see "Personal snippet one" in snippets' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Personal snippet one"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see "Personal snippet private" in snippets' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Personal snippet private"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see "Personal snippet internal" in snippets' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_content "Personal snippet internal"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see "Personal snippet one" in snippets' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_content "Personal snippet one"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should not see "Personal snippet private" in snippets' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_content "Personal snippet private"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should not see "Personal snippet internal" in snippets' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_content "Personal snippet internal"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I click "Internal" filter' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within('.nav-tabs') do
|
2015-04-26 12:48:37 +05:30
|
|
|
click_link "Internal"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click "Private" filter' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within('.nav-tabs') do
|
2014-09-02 18:07:02 +05:30
|
|
|
click_link "Private"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I click "Public" filter' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within('.nav-tabs') do
|
2015-04-26 12:48:37 +05:30
|
|
|
click_link "Public"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
def snippet
|
|
|
|
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
|
|
|
|
end
|
|
|
|
end
|