diff options
author | Andrew8xx8 <avk@8xx8.ru> | 2013-03-25 02:17:38 +0400 |
---|---|---|
committer | Andrew8xx8 <avk@8xx8.ru> | 2013-03-25 02:19:40 +0400 |
commit | 8f08fbfd9f768b885c631bdc8bc8ad202c6827a0 (patch) | |
tree | dfbdebbc19d0de48b42b47e5f1b6435db800d0a5 /features/steps/snippets | |
parent | 4be12be62a9dc30faecff139684f7537f0726d45 (diff) | |
download | gitlab-ce-8f08fbfd9f768b885c631bdc8bc8ad202c6827a0.tar.gz |
Tests for personal snippets added
Diffstat (limited to 'features/steps/snippets')
-rw-r--r-- | features/steps/snippets/discover_snippets.rb | 17 | ||||
-rw-r--r-- | features/steps/snippets/snippets.rb | 64 | ||||
-rw-r--r-- | features/steps/snippets/user_snippets.rb | 41 |
3 files changed, 122 insertions, 0 deletions
diff --git a/features/steps/snippets/discover_snippets.rb b/features/steps/snippets/discover_snippets.rb new file mode 100644 index 00000000000..ff2e4952c36 --- /dev/null +++ b/features/steps/snippets/discover_snippets.rb @@ -0,0 +1,17 @@ +class DiscoverSnippets < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Then 'I should see "Personal snippet one" in snippets' do + page.should have_content "Personal snippet one" + end + + And 'I should not see "Personal snippet private" in snippets' do + page.should_not have_content "Personal snippet private" + end + + def snippet + @snippet ||= PersonalSnippet.find_by_title!("Personal snippet one") + end +end diff --git a/features/steps/snippets/snippets.rb b/features/steps/snippets/snippets.rb new file mode 100644 index 00000000000..87a499821dd --- /dev/null +++ b/features/steps/snippets/snippets.rb @@ -0,0 +1,64 @@ +class Snippets < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Given 'I click link "Personal snippet one"' do + click_link "Personal snippet one" + end + + And 'I should not see "Personal snippet one" in snippets' do + page.should_not have_content "Personal snippet one" + end + + And 'I click link "Edit"' do + within ".page_title" do + click_link "Edit" + end + end + + And 'I click link "Destroy"' do + click_link "Destroy" + end + + And 'I submit new snippet "Personal snippet three"' do + fill_in "personal_snippet_title", :with => "Personal snippet three" + select "forever", :from => "personal_snippet_expires_at" + 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 "Save" + end + + Then 'I should see snippet "Personal snippet three"' do + page.should have_content "Personal snippet three" + page.should have_content "Content of snippet three" + end + + And 'I submit new title "Personal snippet new title"' do + fill_in "personal_snippet_title", :with => "Personal snippet new title" + click_button "Save" + end + + Then 'I should see "Personal snippet new title"' do + page.should have_content "Personal snippet new title" + end + + And 'I uncheck "Private" checkbox' do + find(:xpath, "//input[@id='personal_snippet_private']").set true + click_button "Save" + end + + Then 'I should see "Personal snippet one" public' do + page.should have_selector(:xpath, "//i[@class='public-snippet']") + end + + And 'I visit snippet page "Personal snippet one"' do + visit snippet_path(snippet) + end + + def snippet + @snippet ||= PersonalSnippet.find_by_title!("Personal snippet one") + end +end diff --git a/features/steps/snippets/user_snippets.rb b/features/steps/snippets/user_snippets.rb new file mode 100644 index 00000000000..0920b56e38d --- /dev/null +++ b/features/steps/snippets/user_snippets.rb @@ -0,0 +1,41 @@ +class UserSnippets < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + Given 'I visit my snippets page' do + visit user_snippets_path(current_user) + end + + Then 'I should see "Personal snippet one" in snippets' do + page.should have_content "Personal snippet one" + end + + And 'I should see "Personal snippet private" in snippets' do + page.should have_content "Personal snippet private" + end + + Then 'I should not see "Personal snippet one" in snippets' do + page.should_not have_content "Personal snippet one" + end + + And 'I should not see "Personal snippet private" in snippets' do + page.should_not have_content "Personal snippet private" + end + + Given 'I click "Public" filter' do + within('.nav-stacked') do + click_link "Public" + end + end + + Given 'I click "Private" filter' do + within('.nav-stacked') do + click_link "Private" + end + end + + def snippet + @snippet ||= PersonalSnippet.find_by_title!("Personal snippet one") + end +end |