diff options
author | Nihad Abbasov <narkoz.2008@gmail.com> | 2012-09-10 04:27:11 -0700 |
---|---|---|
committer | Nihad Abbasov <narkoz.2008@gmail.com> | 2012-09-10 04:27:11 -0700 |
commit | 080bd12e167dceb3274bb488b7be787379d126b4 (patch) | |
tree | a984d98fdfdd01a2ee73ebcb36f29202f1d069ff /features | |
parent | 7aeb92b8e4bb279346d9dcec7bbca1725cec8eb1 (diff) | |
download | gitlab-ce-080bd12e167dceb3274bb488b7be787379d126b4.tar.gz |
rewrite project commits features using spinach
Diffstat (limited to 'features')
-rw-r--r-- | features/project/commits/branches.feature (renamed from features/projects/commits/branches.feature) | 15 | ||||
-rw-r--r-- | features/project/commits/commit_comments.feature (renamed from features/projects/commits/commit_comments.feature) | 6 | ||||
-rw-r--r-- | features/project/commits/commits.feature (renamed from features/projects/commits/commits.feature) | 9 | ||||
-rw-r--r-- | features/project/commits/tags.feature (renamed from features/projects/commits/tags.feature) | 9 | ||||
-rw-r--r-- | features/project/create_project.feature (renamed from features/projects/create_project.feature) | 0 | ||||
-rw-r--r-- | features/project/deploy_keys.feature (renamed from features/projects/deploy_keys.feature) | 0 | ||||
-rw-r--r-- | features/project/issues/issues.feature (renamed from features/projects/issues/issues.feature) | 0 | ||||
-rw-r--r-- | features/project/issues/labels.feature (renamed from features/projects/issues/labels.feature) | 0 | ||||
-rw-r--r-- | features/project/issues/milestones.feature (renamed from features/projects/issues/milestones.feature) | 0 | ||||
-rw-r--r-- | features/project/merge_requests.feature (renamed from features/projects/merge_requests.feature) | 0 | ||||
-rw-r--r-- | features/project/network.feature (renamed from features/projects/network.feature) | 0 | ||||
-rw-r--r-- | features/project/project.feature (renamed from features/projects/project.feature) | 0 | ||||
-rw-r--r-- | features/project/snippets.feature (renamed from features/projects/snippets.feature) | 0 | ||||
-rw-r--r-- | features/project/source/browse_files.feature (renamed from features/projects/source/browse_files.feature) | 0 | ||||
-rw-r--r-- | features/project/source/git_blame.feature (renamed from features/projects/source/git_blame.feature) | 0 | ||||
-rw-r--r-- | features/project/team_management.feature (renamed from features/projects/team_management.feature) | 0 | ||||
-rw-r--r-- | features/project/wall.feature (renamed from features/projects/wall.feature) | 0 | ||||
-rw-r--r-- | features/project/web_hooks.feature (renamed from features/projects/web_hooks.feature) | 0 | ||||
-rw-r--r-- | features/project/wiki.feature (renamed from features/projects/wiki.feature) | 0 | ||||
-rw-r--r-- | features/steps/project_browse_branches.rb | 44 | ||||
-rw-r--r-- | features/steps/project_browse_commits.rb | 60 | ||||
-rw-r--r-- | features/steps/project_browse_tags.rb | 19 | ||||
-rw-r--r-- | features/steps/project_comment_commit.rb | 23 | ||||
-rw-r--r-- | features/support/env.rb | 13 |
24 files changed, 178 insertions, 20 deletions
diff --git a/features/projects/commits/branches.feature b/features/project/commits/branches.feature index 74575c51c5a..4fa4dc26a1b 100644 --- a/features/projects/commits/branches.feature +++ b/features/project/commits/branches.feature @@ -1,6 +1,6 @@ -Feature: Browse branches - Background: - Given I signin as a user +Feature: Project Browse branches + Background: + Given I sign in as a user And I own project "Shop" And project "Shop" has protected branches Given I visit project branches page @@ -16,8 +16,11 @@ Feature: Browse branches Given I click link "Protected" Then I should see "Shop" protected branches list - Scenario: I can download project by branch + # @wip + # Scenario: I can download project by branch - Scenario: I can view protected branches + # @wip + # Scenario: I can view protected branches - Scenario: I can manage protected branches + # @wip + # Scenario: I can manage protected branches diff --git a/features/projects/commits/commit_comments.feature b/features/project/commits/commit_comments.feature index 9bd56d29f1e..5acf541ab96 100644 --- a/features/projects/commits/commit_comments.feature +++ b/features/project/commits/commit_comments.feature @@ -1,6 +1,6 @@ -Feature: Comment commit - Background: - Given I signin as a user +Feature: Project Comment commit + Background: + Given I sign in as a user And I own project "Shop" Given I visit project commit page diff --git a/features/projects/commits/commits.feature b/features/project/commits/commits.feature index 69d39d78f89..53de6e6a264 100644 --- a/features/projects/commits/commits.feature +++ b/features/project/commits/commits.feature @@ -1,6 +1,6 @@ -Feature: Browse commits - Background: - Given I signin as a user +Feature: Project Browse commits + Background: + Given I sign in as a user And I own project "Shop" Given I visit project commits page @@ -18,5 +18,4 @@ Feature: Browse commits Scenario: I compare refs Given I visit compare refs page And I fill compare fields with refs - And I see compared refs - + And I see compared refs diff --git a/features/projects/commits/tags.feature b/features/project/commits/tags.feature index f7899fc3ce0..1ac0f8bfa45 100644 --- a/features/projects/commits/tags.feature +++ b/features/project/commits/tags.feature @@ -1,10 +1,11 @@ -Feature: Browse tags - Background: - Given I signin as a user +Feature: Project Browse tags + Background: + Given I sign in as a user And I own project "Shop" Given I visit project tags page Scenario: I can see all git tags Then I should see "Shop" all tags list - Scenario: I can download project by tag + # @wip + # Scenario: I can download project by tag diff --git a/features/projects/create_project.feature b/features/project/create_project.feature index 42d25b3f331..42d25b3f331 100644 --- a/features/projects/create_project.feature +++ b/features/project/create_project.feature diff --git a/features/projects/deploy_keys.feature b/features/project/deploy_keys.feature index e69de29bb2d..e69de29bb2d 100644 --- a/features/projects/deploy_keys.feature +++ b/features/project/deploy_keys.feature diff --git a/features/projects/issues/issues.feature b/features/project/issues/issues.feature index b2301b3f1ff..b2301b3f1ff 100644 --- a/features/projects/issues/issues.feature +++ b/features/project/issues/issues.feature diff --git a/features/projects/issues/labels.feature b/features/project/issues/labels.feature index 5a20bfd6d14..5a20bfd6d14 100644 --- a/features/projects/issues/labels.feature +++ b/features/project/issues/labels.feature diff --git a/features/projects/issues/milestones.feature b/features/project/issues/milestones.feature index d78096a4f16..d78096a4f16 100644 --- a/features/projects/issues/milestones.feature +++ b/features/project/issues/milestones.feature diff --git a/features/projects/merge_requests.feature b/features/project/merge_requests.feature index 54b6ccde7f9..54b6ccde7f9 100644 --- a/features/projects/merge_requests.feature +++ b/features/project/merge_requests.feature diff --git a/features/projects/network.feature b/features/project/network.feature index 61c05eb367e..61c05eb367e 100644 --- a/features/projects/network.feature +++ b/features/project/network.feature diff --git a/features/projects/project.feature b/features/project/project.feature index 895a928ff81..895a928ff81 100644 --- a/features/projects/project.feature +++ b/features/project/project.feature diff --git a/features/projects/snippets.feature b/features/project/snippets.feature index e69de29bb2d..e69de29bb2d 100644 --- a/features/projects/snippets.feature +++ b/features/project/snippets.feature diff --git a/features/projects/source/browse_files.feature b/features/project/source/browse_files.feature index 04aebc19732..04aebc19732 100644 --- a/features/projects/source/browse_files.feature +++ b/features/project/source/browse_files.feature diff --git a/features/projects/source/git_blame.feature b/features/project/source/git_blame.feature index 6aa6be47deb..6aa6be47deb 100644 --- a/features/projects/source/git_blame.feature +++ b/features/project/source/git_blame.feature diff --git a/features/projects/team_management.feature b/features/project/team_management.feature index b5b485e2dc0..b5b485e2dc0 100644 --- a/features/projects/team_management.feature +++ b/features/project/team_management.feature diff --git a/features/projects/wall.feature b/features/project/wall.feature index ed675e2c477..ed675e2c477 100644 --- a/features/projects/wall.feature +++ b/features/project/wall.feature diff --git a/features/projects/web_hooks.feature b/features/project/web_hooks.feature index e69de29bb2d..e69de29bb2d 100644 --- a/features/projects/web_hooks.feature +++ b/features/project/web_hooks.feature diff --git a/features/projects/wiki.feature b/features/project/wiki.feature index 4441ada2847..4441ada2847 100644 --- a/features/projects/wiki.feature +++ b/features/project/wiki.feature diff --git a/features/steps/project_browse_branches.rb b/features/steps/project_browse_branches.rb new file mode 100644 index 00000000000..9fb2e59ddff --- /dev/null +++ b/features/steps/project_browse_branches.rb @@ -0,0 +1,44 @@ +class ProjectBrowseBranches < Spinach::FeatureSteps + Then 'I should see "Shop" recent branches list' do + page.should have_content "Branches" + page.should have_content "master" + end + + Given 'I click link "All"' do + click_link "All" + end + + Then 'I should see "Shop" all branches list' do + page.should have_content "Branches" + page.should have_content "master" + end + + Given 'I click link "Protected"' do + click_link "Protected" + end + + Then 'I should see "Shop" protected branches list' do + within "table" do + page.should have_content "stable" + page.should_not have_content "master" + end + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + And 'project "Shop" has protected branches' do + project = Project.find_by_name("Shop") + project.protected_branches.create(:name => "stable") + end + + Given 'I visit project branches page' do + visit branches_project_repository_path(@project) + end +end diff --git a/features/steps/project_browse_commits.rb b/features/steps/project_browse_commits.rb new file mode 100644 index 00000000000..71c592a7b57 --- /dev/null +++ b/features/steps/project_browse_commits.rb @@ -0,0 +1,60 @@ +class ProjectBrowseCommits < Spinach::FeatureSteps + Then 'I see project commits' do + current_path.should == project_commits_path(@project) + + commit = @project.commit + page.should have_content(@project.name) + page.should have_content(commit.message) + page.should have_content(commit.id.to_s[0..5]) + end + + Given 'I click atom feed link' do + click_link "Feed" + end + + Then 'I see commits atom feed' do + commit = CommitDecorator.decorate(@project.commit) + page.response_headers['Content-Type'].should have_content("application/atom+xml") + page.body.should have_selector("title", :text => "Recent commits to #{@project.name}") + page.body.should have_selector("author email", :text => commit.author_email) + page.body.should have_selector("entry summary", :text => commit.description) + end + + Given 'I click on commit link' do + visit project_commit_path(@project, ValidCommit::ID) + end + + Then 'I see commit info' do + page.should have_content ValidCommit::MESSAGE + page.should have_content "Showing 1 changed file" + end + + Given 'I visit compare refs page' do + visit compare_project_commits_path(@project) + end + + And 'I fill compare fields with refs' do + fill_in "from", :with => "master" + fill_in "to", :with => "stable" + click_button "Compare" + end + + And 'I see compared refs' do + page.should have_content "Commits (27)" + page.should have_content "Compare View" + page.should have_content "Showing 73 changed files" + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + Given 'I visit project commits page' do + visit project_commits_path(@project) + end +end diff --git a/features/steps/project_browse_tags.rb b/features/steps/project_browse_tags.rb new file mode 100644 index 00000000000..c6bea691f04 --- /dev/null +++ b/features/steps/project_browse_tags.rb @@ -0,0 +1,19 @@ +class ProjectBrowseTags < Spinach::FeatureSteps + Then 'I should see "Shop" all tags list' do + page.should have_content "Tags" + page.should have_content "v1.2.1" + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + Given 'I visit project tags page' do + visit tags_project_repository_path(@project) + end +end diff --git a/features/steps/project_comment_commit.rb b/features/steps/project_comment_commit.rb new file mode 100644 index 00000000000..04e94c7def0 --- /dev/null +++ b/features/steps/project_comment_commit.rb @@ -0,0 +1,23 @@ +class ProjectCommentCommit < Spinach::FeatureSteps + Given 'I leave a comment like "XML attached"' do + fill_in "note_note", :with => "XML attached" + click_button "Add Comment" + end + + Then 'I should see comment "XML attached"' do + page.should have_content "XML attached" + end + + Given 'I sign in as a user' do + login_as :user + end + + And 'I own project "Shop"' do + @project = Factory :project, :name => "Shop" + @project.add_access(@user, :admin) + end + + Given 'I visit project commit page' do + visit project_commit_path(@project, ValidCommit::ID) + end +end diff --git a/features/support/env.rb b/features/support/env.rb index 2900e1cb288..38d828a2a51 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -4,12 +4,21 @@ require './config/environment' require 'rspec' require 'database_cleaner' -%w(login_helpers stubbed_repository).each do |f| +%w(gitolite_stub login_helpers stubbed_repository valid_commit).each do |f| require Rails.root.join('spec', 'support', f) end include LoginHelpers +include GitoliteStub -DatabaseCleaner.strategy = :transaction +WebMock.allow_net_connect! + +DatabaseCleaner.strategy = :truncation Spinach.hooks.before_scenario { DatabaseCleaner.start } Spinach.hooks.after_scenario { DatabaseCleaner.clean } + +Spinach.hooks.before_run do + RSpec::Mocks::setup self + + stub_gitolite! +end |