Remove duplicate coverage in spec requests. All features should be covered in cucumber
This commit is contained in:
parent
3079687b93
commit
6de4882597
18 changed files with 39 additions and 589 deletions
|
@ -10,7 +10,7 @@ Feature: Dashboard
|
|||
Then I should see "Shop" project link
|
||||
Then I should see project "Shop" activity feed
|
||||
|
||||
Scenario: I should see last pish widget
|
||||
Scenario: I should see last push widget
|
||||
Then I should see last push widget
|
||||
And I click "Create Merge Request" link
|
||||
Then I see prefilled new Merge Request page
|
||||
|
|
|
@ -6,6 +6,11 @@ Feature: Profile
|
|||
Given I visit profile page
|
||||
Then I should see my profile info
|
||||
|
||||
Scenario: I edit profile
|
||||
Given I visit profile page
|
||||
Then I change my contact info
|
||||
And I should see new contact info
|
||||
|
||||
Scenario: I change my password
|
||||
Given I visit profile password page
|
||||
Then I change my password
|
||||
|
@ -15,4 +20,3 @@ Feature: Profile
|
|||
Given I visit profile token page
|
||||
Then I reset my token
|
||||
And I should see new token
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
Feature: Browse git repo
|
||||
Background:
|
||||
Given I signin as a user
|
||||
And I own project "Shop"
|
||||
Given I visit project source page
|
||||
|
||||
Scenario: I blame file
|
||||
Given I click on file from repo
|
||||
And I click blame button
|
||||
Then I should see git file blame
|
|
@ -38,3 +38,13 @@ end
|
|||
Then /^I should see raw file content$/ do
|
||||
page.source.should == ValidCommit::BLOB_FILE
|
||||
end
|
||||
|
||||
Given /^I click blame button$/ do
|
||||
click_link "blame"
|
||||
end
|
||||
|
||||
Then /^I should see git file blame$/ do
|
||||
page.should have_content("rubygems.org")
|
||||
page.should have_content("Dmitriy Zaporozhets")
|
||||
page.should have_content("bc3735004cb Moving to rails 3.2")
|
||||
end
|
||||
|
|
|
@ -36,3 +36,16 @@ Then /^I should see new token$/ do
|
|||
find("#token").value.should == @user.reload.private_token
|
||||
end
|
||||
|
||||
Then /^I change my contact info$/ do
|
||||
fill_in "user_skype", :with => "testskype"
|
||||
fill_in "user_linkedin", :with => "testlinkedin"
|
||||
fill_in "user_twitter", :with => "testtwitter"
|
||||
click_button "Save"
|
||||
@user.reload
|
||||
end
|
||||
|
||||
Then /^I should see new contact info$/ do
|
||||
@user.skype.should == 'testskype'
|
||||
@user.linkedin.should == 'testlinkedin'
|
||||
@user.twitter.should == 'testtwitter'
|
||||
end
|
||||
|
|
|
@ -30,14 +30,6 @@ describe "User Issues Dashboard" do
|
|||
visit dashboard_issues_path
|
||||
end
|
||||
|
||||
subject { page }
|
||||
|
||||
it { should have_content(@issue1.title[0..10]) }
|
||||
it { should have_content(@issue1.project.name) }
|
||||
|
||||
it { should have_content(@issue2.title[0..10]) }
|
||||
it { should have_content(@issue2.project.name) }
|
||||
|
||||
describe "atom feed", :js => false do
|
||||
it "should render atom feed via private token" do
|
||||
logout
|
|
@ -10,18 +10,6 @@ describe "User Dashboard" do
|
|||
visit dashboard_path
|
||||
end
|
||||
|
||||
it "should be on projects page" do
|
||||
current_path.should == dashboard_path
|
||||
end
|
||||
|
||||
it "should have link to new project" do
|
||||
page.should have_content("New Project")
|
||||
end
|
||||
|
||||
it "should have project" do
|
||||
page.should have_content(@project.name)
|
||||
end
|
||||
|
||||
it "should render projects atom feed via private token" do
|
||||
logout
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Commits" do
|
||||
let(:project) { Factory :project }
|
||||
let!(:commit) { CommitDecorator.decorate(project.commit) }
|
||||
before do
|
||||
login_as :user
|
||||
project.add_access(@user, :read)
|
||||
end
|
||||
|
||||
describe "GET /commits" do
|
||||
before do
|
||||
visit project_commits_path(project)
|
||||
end
|
||||
|
||||
it "should have valid path" do
|
||||
current_path.should == project_commits_path(project)
|
||||
end
|
||||
|
||||
it "should have project name" do
|
||||
page.should have_content(project.name)
|
||||
end
|
||||
|
||||
it "should list commits" do
|
||||
page.should have_content(commit.description)
|
||||
page.should have_content(commit.short_id(8))
|
||||
end
|
||||
|
||||
it "should render atom feed" do
|
||||
visit project_commits_path(project, :atom)
|
||||
|
||||
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
|
||||
|
||||
it "should render atom feed via private token" do
|
||||
logout
|
||||
visit project_commits_path(project, :atom, :private_token => @user.private_token)
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
describe "GET /commits/:id" do
|
||||
before do
|
||||
visit project_commit_path(project, commit.id)
|
||||
end
|
||||
|
||||
it "should have valid path" do
|
||||
current_path.should == project_commit_path(project, commit.id)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /commits/compare" do
|
||||
before do
|
||||
visit compare_project_commits_path(project)
|
||||
end
|
||||
|
||||
it "should have valid path" do
|
||||
current_path.should == compare_project_commits_path(project)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,40 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "User MergeRequests" do
|
||||
describe "GET /issues" do
|
||||
before do
|
||||
|
||||
login_as :user
|
||||
|
||||
@project1 = Factory :project,
|
||||
:path => "project1",
|
||||
:code => "TEST1"
|
||||
|
||||
@project2 = Factory :project,
|
||||
:path => "project2",
|
||||
:code => "TEST2"
|
||||
|
||||
@project1.add_access(@user, :read, :write)
|
||||
@project2.add_access(@user, :read, :write)
|
||||
|
||||
@merge_request1 = Factory :merge_request,
|
||||
:author => @user,
|
||||
:assignee => @user,
|
||||
:project => @project1
|
||||
|
||||
@merge_request2 = Factory :merge_request,
|
||||
:author => @user,
|
||||
:assignee => @user,
|
||||
:project => @project2
|
||||
|
||||
visit dashboard_merge_requests_path
|
||||
end
|
||||
|
||||
subject { page }
|
||||
|
||||
it { should have_content(@merge_request1.title[0..10]) }
|
||||
it { should have_content(@merge_request1.project.name) }
|
||||
it { should have_content(@merge_request2.title[0..10]) }
|
||||
it { should have_content(@merge_request2.project.name) }
|
||||
end
|
||||
end
|
|
@ -1,25 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Blame file" do
|
||||
before { login_as :user }
|
||||
|
||||
describe "GET /:projectname/:commit/blob/Gemfile" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile")
|
||||
click_link "blame"
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == blame_file_project_ref_path(@project, @project.root_ref, :path => "Gemfile")
|
||||
end
|
||||
|
||||
it "should contain file view" do
|
||||
page.should have_content("rubygems.org")
|
||||
page.should have_content("Dmitriy Zaporozhets")
|
||||
page.should have_content("bc3735004cb Moving to rails 3.2")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,65 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Issues" do
|
||||
before do
|
||||
login_as :user
|
||||
end
|
||||
|
||||
describe "GET /keys" do
|
||||
before do
|
||||
@key = Factory :key, :user => @user
|
||||
visit keys_path
|
||||
end
|
||||
|
||||
subject { page }
|
||||
|
||||
it { should have_content(@key.title) }
|
||||
|
||||
describe "Destroy" do
|
||||
before { visit key_path(@key) }
|
||||
|
||||
it "should remove entry" do
|
||||
expect {
|
||||
click_link "Remove"
|
||||
}.to change { @user.keys.count }.by(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "New key" do
|
||||
before do
|
||||
visit keys_path
|
||||
click_link "Add new"
|
||||
end
|
||||
|
||||
it "should open new key popup" do
|
||||
page.should have_content("New key")
|
||||
end
|
||||
|
||||
describe "fill in" do
|
||||
before do
|
||||
fill_in "key_title", :with => "laptop"
|
||||
fill_in "key_key", :with => "publickey234="
|
||||
end
|
||||
|
||||
it { expect { click_button "Save" }.to change {Key.count}.by(1) }
|
||||
|
||||
it "should add new key to table" do
|
||||
click_button "Save"
|
||||
|
||||
page.should_not have_content("New key")
|
||||
page.should have_content "laptop"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "Show page" do
|
||||
before do
|
||||
@key = Factory :key, :user => @user
|
||||
visit key_path(@key)
|
||||
end
|
||||
|
||||
it { page.should have_content @key.title }
|
||||
it { page.should have_content @key.key[0..10] }
|
||||
end
|
||||
end
|
|
@ -1,52 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Last Push widget" do
|
||||
before { login_as :user }
|
||||
|
||||
before do
|
||||
@project = Factory :project, :owner => @user
|
||||
@project.add_access(@user, :read)
|
||||
create_push_event
|
||||
visit dashboard_path
|
||||
end
|
||||
|
||||
it "should display last push widget with link to merge request page" do
|
||||
page.should have_content "Your pushed to branch new_design"
|
||||
page.should have_link "Create Merge Request"
|
||||
end
|
||||
|
||||
describe "click create MR" do
|
||||
before { click_link "Create Merge Request" }
|
||||
|
||||
it { current_path.should == new_project_merge_request_path(@project) }
|
||||
it { find("#merge_request_source_branch").value.should == "new_design" }
|
||||
it { find("#merge_request_target_branch").value.should == "master" }
|
||||
it { find("#merge_request_title").value.should == "New Design" }
|
||||
end
|
||||
|
||||
|
||||
def create_push_event
|
||||
data = {
|
||||
:before => "0000000000000000000000000000000000000000",
|
||||
:after => "0220c11b9a3e6c69dc8fd35321254ca9a7b98f7e",
|
||||
:ref => "refs/heads/new_design",
|
||||
:user_id => @user.id,
|
||||
:user_name => @user.name,
|
||||
:repository => {
|
||||
:name => @project.name,
|
||||
:url => "localhost/rubinius",
|
||||
:description => "",
|
||||
:homepage => "localhost/rubinius",
|
||||
:private => true
|
||||
}
|
||||
}
|
||||
|
||||
@event = Event.create(
|
||||
:project => @project,
|
||||
:action => Event::Pushed,
|
||||
:data => data,
|
||||
:author_id => @user.id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Profile" do
|
||||
before do
|
||||
login_as :user
|
||||
end
|
||||
|
||||
describe "Show profile" do
|
||||
before do
|
||||
visit profile_path
|
||||
end
|
||||
|
||||
it { page.should have_content(@user.name) }
|
||||
end
|
||||
|
||||
describe "Profile update" do
|
||||
before do
|
||||
visit profile_path
|
||||
fill_in "user_skype", :with => "testskype"
|
||||
fill_in "user_linkedin", :with => "testlinkedin"
|
||||
fill_in "user_twitter", :with => "testtwitter"
|
||||
click_button "Save"
|
||||
@user.reload
|
||||
end
|
||||
|
||||
it { @user.skype.should == 'testskype' }
|
||||
it { @user.linkedin.should == 'testlinkedin' }
|
||||
it { @user.twitter.should == 'testtwitter' }
|
||||
end
|
||||
|
||||
describe "Reset private token" do
|
||||
before do
|
||||
visit profile_token_path
|
||||
end
|
||||
|
||||
it "should reset private token" do
|
||||
user_first_token = @user.private_token
|
||||
click_button "Reset"
|
||||
@user.reload
|
||||
@user.private_token.should_not == user_first_token
|
||||
end
|
||||
end
|
||||
|
||||
describe "Password update" do
|
||||
before do
|
||||
visit profile_password_path
|
||||
end
|
||||
|
||||
it { page.should have_content("Password") }
|
||||
it { page.should have_content("Password confirmation") }
|
||||
|
||||
describe "change password" do
|
||||
before do
|
||||
@old_pwd = @user.encrypted_password
|
||||
fill_in "user_password", :with => "777777"
|
||||
fill_in "user_password_confirmation", :with => "777777"
|
||||
click_button "Save"
|
||||
@user.reload
|
||||
end
|
||||
|
||||
it "should redirect to signin page" do
|
||||
current_path.should == new_user_session_path
|
||||
end
|
||||
|
||||
it "should change password" do
|
||||
@user.encrypted_password.should_not == @old_pwd
|
||||
end
|
||||
|
||||
describe "login with new password" do
|
||||
before do
|
||||
fill_in "user_email", :with => @user.email
|
||||
fill_in "user_password", :with => "777777"
|
||||
click_button "Sign in"
|
||||
end
|
||||
|
||||
it "should login user" do
|
||||
current_path.should == root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -3,47 +3,6 @@ require 'spec_helper'
|
|||
describe "Projects" do
|
||||
before { login_as :user }
|
||||
|
||||
describe "GET /projects/new" do
|
||||
before do
|
||||
visit root_path
|
||||
click_link "New Project"
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == new_project_path
|
||||
end
|
||||
|
||||
it "should have labels for new project" do
|
||||
page.should have_content("Project name is")
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /projects" do
|
||||
before do
|
||||
visit new_project_path
|
||||
fill_in 'project_name', :with => 'NewProject'
|
||||
fill_in 'project_code', :with => 'NPR'
|
||||
fill_in 'project_path', :with => 'newproject'
|
||||
expect { click_button "Create project" }.to change { Project.count }.by(1)
|
||||
@project = Project.last
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == project_path(@project)
|
||||
end
|
||||
|
||||
it "should show project" do
|
||||
page.should have_content(@project.name)
|
||||
page.should have_content(@project.path)
|
||||
page.should have_content(@project.description)
|
||||
end
|
||||
|
||||
it "should init repo instructions" do
|
||||
page.should have_content("git remote")
|
||||
page.should have_content(@project.url_to_repo)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /projects/show" do
|
||||
before do
|
||||
@project = Factory :project, :owner => @user
|
||||
|
@ -57,42 +16,6 @@ describe "Projects" do
|
|||
end
|
||||
end
|
||||
|
||||
describe "GET /projects/graph" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit graph_project_path(@project)
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == graph_project_path(@project)
|
||||
end
|
||||
|
||||
it "should have as as team member" do
|
||||
page.should have_content("master")
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /projects/team" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit team_project_path(@project,
|
||||
:path => ValidCommit::BLOB_FILE_PATH,
|
||||
:commit_id => ValidCommit::ID)
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == team_project_path(@project)
|
||||
end
|
||||
|
||||
it "should have as as team member" do
|
||||
page.should have_content(@user.name)
|
||||
end
|
||||
end
|
||||
|
||||
describe "GET /projects/:id/edit" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Projects" do
|
||||
before { login_as :user }
|
||||
|
||||
describe "GET /projects/tree" do
|
||||
describe "head" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit tree_project_ref_path(@project, @project.root_ref)
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == tree_project_ref_path(@project, @project.root_ref)
|
||||
end
|
||||
|
||||
it_behaves_like :tree_view
|
||||
end
|
||||
|
||||
describe ValidCommit::ID do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit tree_project_ref_path(@project, ValidCommit::ID)
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == tree_project_ref_path(@project, ValidCommit::ID)
|
||||
end
|
||||
|
||||
it_behaves_like :tree_view
|
||||
it_behaves_like :project_side_pane
|
||||
end
|
||||
|
||||
describe "branch passed" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit tree_project_ref_path(@project, @project.root_ref)
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == tree_project_ref_path(@project, @project.root_ref)
|
||||
end
|
||||
|
||||
it_behaves_like :tree_view
|
||||
it_behaves_like :project_side_pane
|
||||
end
|
||||
|
||||
# TREE FILE PREVIEW
|
||||
describe "file preview" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit tree_project_ref_path(@project, @project.root_ref, :path => "Gemfile")
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == tree_project_ref_path(@project, @project.root_ref)
|
||||
end
|
||||
|
||||
it "should contain file view" do
|
||||
page.should have_content("rubygems.org")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# RAW FILE
|
||||
describe "GET /projects/blob" do
|
||||
before do
|
||||
@project = Factory :project
|
||||
@project.add_access(@user, :read)
|
||||
|
||||
visit blob_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
|
||||
end
|
||||
|
||||
it "should be correct path" do
|
||||
current_path.should == blob_project_ref_path(@project, ValidCommit::ID)
|
||||
end
|
||||
|
||||
it "raw file response" do
|
||||
page.source.should == ValidCommit::BLOB_FILE
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,33 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Projects", "Wall" do
|
||||
let(:project) { Factory :project }
|
||||
|
||||
before do
|
||||
login_as :user
|
||||
project.add_access(@user, :read, :write)
|
||||
end
|
||||
|
||||
describe "View notes on wall", :js => true do
|
||||
before do
|
||||
Factory :note, :project => project, :note => "Project specs", :author => @user
|
||||
visit wall_project_path(project)
|
||||
end
|
||||
|
||||
it { page.should have_content("Project specs") }
|
||||
it { page.should have_content(@user.name) }
|
||||
it { page.should have_content("less than a minute ago") }
|
||||
end
|
||||
|
||||
describe "add new note", :js => true do
|
||||
before do
|
||||
visit wall_project_path(project)
|
||||
fill_in "note_note", :with => "my post on wall"
|
||||
click_button "Add Comment"
|
||||
end
|
||||
|
||||
it "should conatin new note" do
|
||||
page.should have_content("my post on wall")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe "Wiki" do
|
||||
let(:project) { Factory :project }
|
||||
|
||||
before do
|
||||
login_as :user
|
||||
project.add_access(@user, :read, :write)
|
||||
end
|
||||
|
||||
describe "Add pages" do
|
||||
before do
|
||||
visit project_wiki_path(project, :index)
|
||||
end
|
||||
|
||||
it "should see form" do
|
||||
page.should have_content("Editing page")
|
||||
end
|
||||
|
||||
it "should see added page" do
|
||||
fill_in "Title", :with => 'Test title'
|
||||
fill_in "Content", :with => '[link test](test)'
|
||||
click_on "Save"
|
||||
|
||||
page.should have_content("Test title")
|
||||
page.should have_content("link test")
|
||||
|
||||
click_link "link test"
|
||||
|
||||
page.should have_content("Editing page")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue