2014-10-02 12:42:54 -04:00
|
|
|
class Spinach::Features::Snippets < Spinach::FeatureSteps
|
2013-03-24 18:17:38 -04:00
|
|
|
include SharedAuthentication
|
|
|
|
include SharedPaths
|
|
|
|
include SharedProject
|
2013-03-25 05:14:12 -04:00
|
|
|
include SharedSnippet
|
2013-03-24 18:17:38 -04:00
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click link "Personal snippet one"' do
|
2013-03-24 18:17:38 -04:00
|
|
|
click_link "Personal snippet one"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see "Personal snippet one" in snippets' do
|
2013-03-24 18:17:38 -04:00
|
|
|
page.should_not have_content "Personal snippet one"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click link "Edit"' do
|
2013-07-13 13:53:46 -04:00
|
|
|
within ".file-title" do
|
2013-03-24 18:17:38 -04:00
|
|
|
click_link "Edit"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I click link "Destroy"' do
|
2014-06-14 05:36:46 -04:00
|
|
|
click_link "remove"
|
2013-03-24 18:17:38 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I submit new snippet "Personal snippet three"' do
|
2013-03-24 18:17:38 -04:00
|
|
|
fill_in "personal_snippet_title", :with => "Personal snippet three"
|
|
|
|
fill_in "personal_snippet_file_name", :with => "my_snippet.rb"
|
|
|
|
within('.file-editor') do
|
|
|
|
find(:xpath, "//input[@id='personal_snippet_content']").set 'Content of snippet three'
|
|
|
|
end
|
2013-07-18 06:08:48 -04:00
|
|
|
click_button "Create snippet"
|
2013-03-24 18:17:38 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see snippet "Personal snippet three"' do
|
2013-03-24 18:17:38 -04:00
|
|
|
page.should have_content "Personal snippet three"
|
|
|
|
page.should have_content "Content of snippet three"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I submit new title "Personal snippet new title"' do
|
2013-03-24 18:17:38 -04:00
|
|
|
fill_in "personal_snippet_title", :with => "Personal snippet new title"
|
|
|
|
click_button "Save"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see "Personal snippet new title"' do
|
2013-03-24 18:17:38 -04:00
|
|
|
page.should have_content "Personal snippet new title"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I uncheck "Private" checkbox' do
|
2014-10-07 04:54:00 -04:00
|
|
|
choose "Internal"
|
2013-03-24 18:17:38 -04:00
|
|
|
click_button "Save"
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see "Personal snippet one" public' do
|
2013-03-24 18:46:56 -04:00
|
|
|
page.should have_no_xpath("//i[@class='public-snippet']")
|
2013-03-24 18:17:38 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I visit snippet page "Personal snippet one"' do
|
2013-03-24 18:17:38 -04:00
|
|
|
visit snippet_path(snippet)
|
|
|
|
end
|
|
|
|
|
|
|
|
def snippet
|
2014-01-19 13:55:59 -05:00
|
|
|
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
|
2013-03-24 18:17:38 -04:00
|
|
|
end
|
|
|
|
end
|