Commit 080bd12e authored by Nihad Abbasov's avatar Nihad Abbasov

rewrite project commits features using spinach

parent 7aeb92b8
Feature: Browse branches Feature: Project Browse branches
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
And project "Shop" has protected branches And project "Shop" has protected branches
Given I visit project branches page Given I visit project branches page
...@@ -16,8 +16,11 @@ Feature: Browse branches ...@@ -16,8 +16,11 @@ Feature: Browse branches
Given I click link "Protected" Given I click link "Protected"
Then I should see "Shop" protected branches list 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
Feature: Comment commit Feature: Project Comment commit
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
Given I visit project commit page Given I visit project commit page
......
Feature: Browse commits Feature: Project Browse commits
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
Given I visit project commits page Given I visit project commits page
...@@ -19,4 +19,3 @@ Feature: Browse commits ...@@ -19,4 +19,3 @@ Feature: Browse commits
Given I visit compare refs page Given I visit compare refs page
And I fill compare fields with refs And I fill compare fields with refs
And I see compared refs And I see compared refs
Feature: Browse tags Feature: Project Browse tags
Background: Background:
Given I signin as a user Given I sign in as a user
And I own project "Shop" And I own project "Shop"
Given I visit project tags page Given I visit project tags page
Scenario: I can see all git tags Scenario: I can see all git tags
Then I should see "Shop" all tags list Then I should see "Shop" all tags list
Scenario: I can download project by tag # @wip
# Scenario: I can download project by tag
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
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
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
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
...@@ -4,12 +4,21 @@ require './config/environment' ...@@ -4,12 +4,21 @@ require './config/environment'
require 'rspec' require 'rspec'
require 'database_cleaner' 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) require Rails.root.join('spec', 'support', f)
end end
include LoginHelpers include LoginHelpers
include GitoliteStub
DatabaseCleaner.strategy = :transaction WebMock.allow_net_connect!
DatabaseCleaner.strategy = :truncation
Spinach.hooks.before_scenario { DatabaseCleaner.start } Spinach.hooks.before_scenario { DatabaseCleaner.start }
Spinach.hooks.after_scenario { DatabaseCleaner.clean } Spinach.hooks.after_scenario { DatabaseCleaner.clean }
Spinach.hooks.before_run do
RSpec::Mocks::setup self
stub_gitolite!
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment