Commit 50831b1d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'tests_cleanup' of dev.gitlabhq.com:gitlabhq

parents 9b5441bc 9844ddd4
...@@ -10,7 +10,7 @@ Feature: Dashboard ...@@ -10,7 +10,7 @@ Feature: Dashboard
Then I should see "Shop" project link Then I should see "Shop" project link
Then I should see project "Shop" activity feed 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 Then I should see last push widget
And I click "Create Merge Request" link And I click "Create Merge Request" link
Then I see prefilled new Merge Request page Then I see prefilled new Merge Request page
......
...@@ -6,6 +6,11 @@ Feature: Profile ...@@ -6,6 +6,11 @@ Feature: Profile
Given I visit profile page Given I visit profile page
Then I should see my profile info 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 Scenario: I change my password
Given I visit profile password page Given I visit profile password page
Then I change my password Then I change my password
...@@ -15,4 +20,3 @@ Feature: Profile ...@@ -15,4 +20,3 @@ Feature: Profile
Given I visit profile token page Given I visit profile token page
Then I reset my token Then I reset my token
And I should see new token And I should see new token
...@@ -2,9 +2,19 @@ Feature: Browse branches ...@@ -2,9 +2,19 @@ Feature: Browse branches
Background: Background:
Given I signin as a user Given I signin as a user
And I own project "Shop" And I own project "Shop"
And project "Shop" has protected branches
Given I visit project branches page Given I visit project branches page
Scenario: I can see all git branches Scenario: I can see project recent git branches
Then I should see "Shop" recent branches list
Scenario: I can see project all git branches
Given I click link "All"
Then I should see "Shop" all branches list
Scenario: I can see project protected git branches
Given I click link "Protected"
Then I should see "Shop" protected branches list
Scenario: I can download project by branch Scenario: I can download project by branch
......
...@@ -4,4 +4,7 @@ Feature: Comment commit ...@@ -4,4 +4,7 @@ Feature: Comment commit
And I own project "Shop" And I own project "Shop"
Given I visit project commit page Given I visit project commit page
Scenario: I leave a comment for commit @javascript
Scenario: I comment commit
Given I leave a comment like "XML attached"
Then I should see comment "XML attached"
...@@ -5,7 +5,6 @@ Feature: Browse tags ...@@ -5,7 +5,6 @@ Feature: Browse tags
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
Scenario: I can download project by tag Scenario: I can download project by tag
...@@ -7,6 +7,32 @@ Feature: Issues ...@@ -7,6 +7,32 @@ Feature: Issues
And I visit project "Shop" issues page And I visit project "Shop" issues page
Scenario: I should see open issues Scenario: I should see open issues
Given I should see "Release 0.4" open issue Given I should see "Release 0.4" in issues
And I should not see "Release 0.3" closed issue And I should not see "Release 0.3" in issues
Scenario: I should see closed issues
Given I click link "Closed"
Then I should see "Release 0.3" in issues
And I should not see "Release 0.4" in issues
Scenario: I should see all issues
Given I click link "All"
Then I should see "Release 0.3" in issues
And I should see "Release 0.4" in issues
Scenario: I visit issue page
Given I click link "Release 0.4"
Then I should see issue "Release 0.4"
@javascript
Scenario: I submit new unassigned issue
Given I click link "New Issue"
And I submit new issue "500 error on profile"
Given I click link "500 error on profile"
Then I should see issue "500 error on profile"
@javascript
Scenario: I comment issue
Given I visit issue page "Release 0.4"
And I leave a comment like "XML attached"
Then I should see comment "XML attached"
Feature: Milestones
Background:
Given I signin as a user
And I own project "Shop"
And project "Shop" has milestone "v2.2"
Given I visit project "Shop" milestones page
Scenario: I should see active milestones
Then I should see milestone "v2.2"
Scenario: I should see milestone
Given I click link "v2.2"
Then I should see milestone "v2.2"
Scenario: I create new milestone
Given I click link "New Milestone"
And I submit new milestone "v2.3"
Then I should see milestone "v2.3"
Feature: Project
Background:
Given I signin as a user
And I own project "Shop"
And I visit project "Shop" page
Scenario: I should see project activity
Scenario: I edit project
Scenario: I visit attachments
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
...@@ -7,3 +7,9 @@ Feature: Wiki ...@@ -7,3 +7,9 @@ Feature: Wiki
Scenario: Add new page Scenario: Add new page
Given I create Wiki page Given I create Wiki page
Then I should see newly created wiki page Then I should see newly created wiki page
@javascript
Scenario: I comment wiki page
Given I create Wiki page
And I leave a comment like "XML attached"
Then I should see comment "XML attached"
...@@ -36,3 +36,16 @@ Then /^I should see new token$/ do ...@@ -36,3 +36,16 @@ Then /^I should see new token$/ do
find("#token").value.should == @user.reload.private_token find("#token").value.should == @user.reload.private_token
end 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
...@@ -38,3 +38,13 @@ end ...@@ -38,3 +38,13 @@ end
Then /^I should see raw file content$/ do Then /^I should see raw file content$/ do
page.source.should == ValidCommit::BLOB_FILE page.source.should == ValidCommit::BLOB_FILE
end 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
...@@ -59,3 +59,30 @@ end ...@@ -59,3 +59,30 @@ end
Given /^I visit project tags page$/ do Given /^I visit project tags page$/ do
visit tags_project_repository_path(@project) visit tags_project_repository_path(@project)
end end
Then /^I should see "(.*?)" recent branches list$/ do |arg1|
page.should have_content("Branches")
page.should have_content("master")
end
Then /^I should see "(.*?)" all branches list$/ do |arg1|
page.should have_content("Branches")
page.should have_content("master")
end
Then /^I should see "(.*?)" all tags list$/ do |arg1|
page.should have_content("Tags")
page.should have_content("v1.2.1")
end
Then /^I should see "(.*?)" protected branches list$/ do |arg1|
within "table" do
page.should have_content "stable"
page.should_not have_content "master"
end
end
Given /^project "(.*?)" has protected branches$/ do |arg1|
project = Project.find_by_name(arg1)
project.protected_branches.create(:name => "stable")
end
...@@ -12,11 +12,27 @@ Given /^I visit project "(.*?)" issues page$/ do |arg1| ...@@ -12,11 +12,27 @@ Given /^I visit project "(.*?)" issues page$/ do |arg1|
visit project_issues_path(Project.find_by_name(arg1)) visit project_issues_path(Project.find_by_name(arg1))
end end
Given /^I should see "(.*?)" open issue$/ do |arg1| Given /^I should see "(.*?)" in issues$/ do |arg1|
page.should have_content arg1 page.should have_content arg1
end end
Given /^I should not see "(.*?)" closed issue$/ do |arg1| Given /^I should not see "(.*?)" in issues$/ do |arg1|
page.should_not have_content arg1 page.should_not have_content arg1
end end
Then /^I should see issue "(.*?)"$/ do |arg1|
issue = Issue.find_by_title(arg1)
page.should have_content issue.title
page.should have_content issue.author_name
page.should have_content issue.project.name
end
Given /^I visit issue page "(.*?)"$/ do |arg1|
issue = Issue.find_by_title(arg1)
visit project_issue_path(issue.project, issue)
end
Given /^I submit new issue "(.*?)"$/ do |arg1|
fill_in "issue_title", :with => arg1
click_button "Submit new issue"
end
Given /^project "(.*?)" has milestone "(.*?)"$/ do |arg1, arg2|
project = Project.find_by_name(arg1)
milestone = Factory :milestone,
:title => arg2,
:project => project
3.times do |i|
issue = Factory :issue,
:project => project,
:milestone => milestone
end
end
Given /^I visit project "(.*?)" milestones page$/ do |arg1|
@project = Project.find_by_name(arg1)
visit project_milestones_path(@project)
end
Then /^I should see active milestones$/ do
milestone = @project.milestones.first
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues")
end
Then /^I should see milestone "(.*?)"$/ do |arg1|
milestone = @project.milestones.find_by_title(arg1)
page.should have_content(milestone.title[0..10])
page.should have_content(milestone.expires_at)
page.should have_content("Browse Issues")
end
Given /^I submit new milestone "(.*?)"$/ do |arg1|
fill_in "milestone_title", :with => arg1
click_button "Create milestone"
end
...@@ -50,6 +50,11 @@ Given /^I write new comment "(.*?)"$/ do |arg1| ...@@ -50,6 +50,11 @@ Given /^I write new comment "(.*?)"$/ do |arg1|
click_button "Add Comment" click_button "Add Comment"
end end
Given /^I visit project "(.*?)" page$/ do |arg1|
project = Project.find_by_name(arg1)
visit project_path(project)
end
Given /^I visit project "(.*?)" network page$/ do |arg1| Given /^I visit project "(.*?)" network page$/ do |arg1|
project = Project.find_by_name(arg1) project = Project.find_by_name(arg1)
visit graph_project_path(project) visit graph_project_path(project)
...@@ -66,3 +71,12 @@ Given /^page should have network graph$/ do ...@@ -66,3 +71,12 @@ Given /^page should have network graph$/ do
page.should have_content "notes_refacto..." page.should have_content "notes_refacto..."
end end
end end
Given /^I leave a comment like "(.*?)"$/ do |arg1|
fill_in "note_note", :with => arg1
click_button "Add Comment"
end
Then /^I should see comment "(.*?)"$/ do |arg1|
page.should have_content(arg1)
end
...@@ -44,4 +44,8 @@ class FakeSatellite ...@@ -44,4 +44,8 @@ class FakeSatellite
end end
end end
class ProtectedBranch
def update_repository
true
end
end
...@@ -30,14 +30,6 @@ describe "User Issues Dashboard" do ...@@ -30,14 +30,6 @@ describe "User Issues Dashboard" do
visit dashboard_issues_path visit dashboard_issues_path
end 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 describe "atom feed", :js => false do
it "should render atom feed via private token" do it "should render atom feed via private token" do
logout logout
......
...@@ -10,18 +10,6 @@ describe "User Dashboard" do ...@@ -10,18 +10,6 @@ describe "User Dashboard" do
visit dashboard_path visit dashboard_path
end 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 it "should render projects atom feed via private token" do
logout logout
......
require 'spec_helper'
describe "Issues" do
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :read, :write)
end
describe "GET /issues" do
before do
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
visit project_issues_path(project)
end
it "should render atom feed" do
visit project_issues_path(project, :atom)
page.response_headers['Content-Type'].should have_content("application/atom+xml")
page.body.should have_selector("title", :text => "#{project.name} issues")
page.body.should have_selector("author email", :text => @issue.author_email)
page.body.should have_selector("entry summary", :text => @issue.title)
end
it "should render atom feed via private token" do
logout
visit project_issues_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 => "#{project.name} issues")
page.body.should have_selector("author email", :text => @issue.author_email)
page.body.should have_selector("entry summary", :text => @issue.title)
end
end
end
require 'spec_helper'
describe "Issues" do
let(:project) { Factory :project }
let!(:commit) { project.repo.commits.first }
before do
login_as :user
project.add_access(@user, :read, :write)
end
describe "add new note", :js => true do
before do
visit project_commit_path(project, commit)
fill_in "note_note", :with => "I commented this commit"
click_button "Add Comment"
end
it "should conatin new note" do
page.should have_content("I commented this commit")
end
it "should be displayed when i visit this commit again" do
visit project_commit_path(project, commit)
page.should have_content("I commented this commit")
end
end
end
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
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
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
require 'spec_helper'
describe "Issues" do
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :read, :write)
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
end
describe "add new note", :js => true do
before do
visit project_issue_path(project, @issue)
fill_in "note_note", :with => "I commented this issue"
click_button "Add Comment"
end
it "should conatin new note" do
page.should have_content("I commented this issue")
end
end
end
...@@ -11,161 +11,6 @@ describe "Issues" do ...@@ -11,161 +11,6 @@ describe "Issues" do
project.add_access(@user2, :read, :write) project.add_access(@user2, :read, :write)
end end
describe "GET /issues" do
before do
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
visit project_issues_path(project)
end
subject { page }
it { should have_content(@issue.title[0..20]) }
it { should have_content(@issue.project.name) }
it { should have_content(@issue.assignee.name) }
it "should render atom feed" do
visit project_issues_path(project, :atom)
page.response_headers['Content-Type'].should have_content("application/atom+xml")
page.body.should have_selector("title", :text => "#{project.name} issues")
page.body.should have_selector("author email", :text => @issue.author_email)
page.body.should have_selector("entry summary", :text => @issue.title)
end
it "should render atom feed via private token" do
logout
visit project_issues_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 => "#{project.name} issues")
page.body.should have_selector("author email", :text => @issue.author_email)
page.body.should have_selector("entry summary", :text => @issue.title)
end
describe "statuses" do
before do
@closed_issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project,
:closed => true
end
it "should show only open" do
should have_content(@issue.title[0..25])
should have_no_content(@closed_issue.title)
end
it "should show only closed" do
click_link "Closed"
should have_no_content(@issue.title)
should have_content(@closed_issue.title[0..25])
end
it "should show all" do
click_link "All"
should have_content(@issue.title[0..25])
should have_content(@closed_issue.title[0..25])
end
end
end
describe "New issue", :js => true do
before do
visit project_issues_path(project)
click_link "New Issue"
end
it "should open new issue form" do
page.should have_content("New Issue")
end
describe "fill in" do
describe 'assign to me' do
before do
fill_in "issue_title", :with => "bug 345"
page.execute_script("$('#issue_assignee_id').show();")
select @user.name, :from => "issue_assignee_id"
end
it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) }
it "should add new issue to table" do
click_button "Submit new issue"
page.should_not have_content("Add new issue")
page.should have_content @user.name
page.should have_content "bug 345"
page.should have_content project.name
end
it "should call send mail" do
Notify.should_not_receive(:new_issue_email)
click_button "Submit new issue"
end
end
describe 'assign to other' do
before do
fill_in "issue_title", :with => "bug 345"
page.execute_script("$('#issue_assignee_id').show();")
select @user2.name, :from => "issue_assignee_id"
end
it { expect { click_button "Submit new issue" }.to change {Issue.count}.by(1) }
it "should add new issue to table" do
click_button "Submit new issue"
page.should_not have_content("Add new issue")
page.should have_content @user2.name
page.should have_content "bug 345"
page.should have_content project.name
end
it "should call send mail" do
Issue.observers.enable :issue_observer do
Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true))
click_button "Submit new issue"
end
end
it "should send valid email to user" do
Issue.observers.enable :issue_observer do
with_resque do
click_button "Submit new issue"
end
issue = Issue.last
email = ActionMailer::Base.deliveries.last
email.subject.should have_content("New Issue was created")
email.body.should have_content(issue.title)
end
end
end
end
end
describe "Show issue" do
before do
@issue = Factory :issue,
:author => @user,
:assignee => @user,
:project => project
visit project_issue_path(project, @issue)
end
it "should have valid show page for issue" do
page.should have_content @issue.title
page.should have_content @user.name
end
end
describe "Edit issue", :js => true do describe "Edit issue", :js => true do
before do before do
@issue = Factory :issue, @issue = Factory :issue,
......
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
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
require 'spec_helper'
describe "Milestones" do
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :admin)
@milestone = Factory :milestone, :project => project
@issue = Factory :issue, :project => project
@milestone.issues << @issue
end
describe "GET /milestones" do
before do
visit project_milestones_path(project)
end
subject { page }
it { should have_content(@milestone.title[0..10]) }
it { should have_content(@milestone.expires_at) }
it { should have_content("Browse Issues") }
end
describe "GET /milestone/:id" do
before do
visit project_milestone_path(project, @milestone)
end
subject { page }
it { should have_content(@milestone.title[0..10]) }
it { should have_content(@milestone.expires_at) }
it { should have_content("Browse Issues") }
end
describe "GET /milestones/new" do
before do
visit new_project_milestone_path(project)
fill_in "milestone_title", :with => "v2.3"
click_button "Create milestone"
end
it { current_path.should == project_milestone_path(project, project.milestones.last) }
it { page.should have_content(project.milestones.last.title[0..10]) }
it { page.should have_content(project.milestones.last.expires_at) }
end
end
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' ...@@ -3,47 +3,6 @@ require 'spec_helper'
describe "Projects" do describe "Projects" do
before { login_as :user } 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 describe "GET /projects/show" do
before do before do
@project = Factory :project, :owner => @user @project = Factory :project, :owner => @user
...@@ -57,42 +16,6 @@ describe "Projects" do ...@@ -57,42 +16,6 @@ describe "Projects" do
end end
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 describe "GET /projects/:id/edit" do
before do before do
@project = Factory :project @project = Factory :project
......
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
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
require 'spec_helper'
describe "Repository" do
before do
@user = Factory :user
@project = Factory :project
@project.add_access(@user, :read, :write)
login_with @user
end
describe "GET /:project_name/repository" do
before do
visit project_repository_path(@project)
end
it "should be on projects page" do
current_path.should == project_repository_path(@project)
end
it "should have link to last commit for activities tab" do
page.should have_content(@project.commit.safe_message[0..20])
end
end
describe "GET /:project_name/repository/branches" do
before do
visit branches_project_repository_path(@project)
end
it "should have link to repo activities" do
page.should have_content("Branches")
page.should have_content("master")
end
end
# TODO: Add new repo to seeds with tags list
describe "GET /:project_name/repository/tags" do
before do
visit tags_project_repository_path(@project)
end
it "should have link to repo activities" do
page.should have_content("Tags")
page.should have_content("v1.2.1")
end
end
end
...@@ -7,9 +7,6 @@ describe "Users Security" do ...@@ -7,9 +7,6 @@ describe "Users Security" do
end end
describe "GET /login" do describe "GET /login" do
#it { new_user_session_path.should be_denied_for @u1 }
#it { new_user_session_path.should be_denied_for :admin }
#it { new_user_session_path.should be_denied_for :user }
it { new_user_session_path.should_not be_404_for :visitor } it { new_user_session_path.should_not be_404_for :visitor }
end end
......
require 'spec_helper' require 'spec_helper'
describe "Projects Security" do describe "Application access" do
describe "GET /" do describe "GET /" do
it { root_path.should be_allowed_for :admin } it { root_path.should be_allowed_for :admin }
it { root_path.should be_allowed_for :user } it { root_path.should be_allowed_for :user }
......
require 'spec_helper'
describe "TeamMembers" do
before do
login_as :user
@project = Factory :project
@project.add_access(@user, :read, :admin)
end
describe "Update profile", :js => true do
it "should update user role" do
@project.master_access_for?(@user).should be_true
visit team_project_path(@project)
select "Developer", :from => "team_member_project_access"
@project.master_access_for?(@user).should be_false
@project.dev_access_for?(@user).should be_true
end
end
describe "View profile" do
it "should be available" do
visit(team_project_path(@project))
click_link(@user.name)
page.should have_content @user.skype
page.should_not have_content 'Twitter'
end
end
describe "New Team member" do
before do
@user_1 = Factory :user
visit team_project_path(@project)
click_link "New Team Member"
end
it "should open new team member popup" do
page.should have_content("New Team member")
end
describe "fill in" do
before do
within "#new_team_member" do
select @user_1.name, :from => "team_member_user_id"
select "Reporter", :from => "team_member_project_access"
end
end
it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) }
it "should add new member to table" do
click_button "Save"
@member = UsersProject.last
page.should have_content @user_1.name
@member.reload
@member.project_access.should == UsersProject::REPORTER
end
end
end
describe "Cancel membership" do
it "should cancel membership" do
visit project_team_member_path(@project, @project.users_projects.last)
expect { click_link "Remove from team" }.to change { UsersProject.count }.by(-1)
end
end
end
require 'spec_helper'
describe "Wikis" do
let(:project) { Factory :project }
before do
login_as :user
project.add_access(@user, :read, :write)
end
describe "add new note", :js => true do
before do
visit project_wiki_path(project, :index)
fill_in "Title", :with => 'Test title'
fill_in "Content", :with => '[link test](test)'
click_on "Save"
page.should have_content("Test title")
fill_in "note_note", :with => "Comment on wiki!"
click_button "Add Comment"
end
it "should contain the new note" do
page.should have_content("Comment on wiki!")
end
end
end
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
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