debian-mirror-gitlab/features/steps/snippets/snippets.rb

65 lines
1.7 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Spinach::Features::Snippets < Spinach::FeatureSteps
2014-09-02 18:07:02 +05:30
include SharedAuthentication
include SharedPaths
include SharedProject
include SharedSnippet
2015-04-26 12:48:37 +05:30
step 'I click link "Personal snippet one"' do
2014-09-02 18:07:02 +05:30
click_link "Personal snippet one"
end
2015-04-26 12:48:37 +05:30
step 'I should not see "Personal snippet one" in snippets' do
2014-09-02 18:07:02 +05:30
page.should_not have_content "Personal snippet one"
end
2015-04-26 12:48:37 +05:30
step 'I click link "Edit"' do
2014-09-02 18:07:02 +05:30
within ".file-title" do
click_link "Edit"
end
end
2015-04-26 12:48:37 +05:30
step 'I click link "Destroy"' do
2014-09-02 18:07:02 +05:30
click_link "remove"
end
2015-04-26 12:48:37 +05:30
step 'I submit new snippet "Personal snippet three"' do
2014-09-02 18:07:02 +05:30
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"
end
2015-04-26 12:48:37 +05:30
step 'I should see snippet "Personal snippet three"' do
2014-09-02 18:07:02 +05:30
page.should have_content "Personal snippet three"
page.should have_content "Content of snippet three"
end
2015-04-26 12:48:37 +05:30
step 'I submit new title "Personal snippet new title"' do
2014-09-02 18:07:02 +05:30
fill_in "personal_snippet_title", :with => "Personal snippet new title"
click_button "Save"
end
2015-04-26 12:48:37 +05:30
step 'I should see "Personal snippet new title"' do
2014-09-02 18:07:02 +05:30
page.should have_content "Personal snippet new title"
end
2015-04-26 12:48:37 +05:30
step 'I uncheck "Private" checkbox' do
choose "Internal"
2014-09-02 18:07:02 +05:30
click_button "Save"
end
2015-04-26 12:48:37 +05:30
step 'I should see "Personal snippet one" public' do
2014-09-02 18:07:02 +05:30
page.should have_no_xpath("//i[@class='public-snippet']")
end
2015-04-26 12:48:37 +05:30
step 'I visit snippet page "Personal snippet one"' do
2014-09-02 18:07:02 +05:30
visit snippet_path(snippet)
end
def snippet
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
end
end