gitlab-org--gitlab-foss/features/steps/snippets/snippets.rb

65 lines
1.7 KiB
Ruby
Raw Normal View History

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
step 'I click link "Personal snippet one"' do
2013-03-24 18:17:38 -04:00
click_link "Personal snippet one"
end
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
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
step 'I click link "Destroy"' do
click_link "remove"
2013-03-24 18:17:38 -04:00
end
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
click_button "Create snippet"
2013-03-24 18:17:38 -04:00
end
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
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
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
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
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
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