diff options
author | Nihad Abbasov <narkoz.2008@gmail.com> | 2011-10-26 17:46:25 +0400 |
---|---|---|
committer | Nihad Abbasov <narkoz.2008@gmail.com> | 2011-10-26 17:46:25 +0400 |
commit | d62200cad430565bd9f80befaf329297120330b5 (patch) | |
tree | 6217dd41e6f86e657513b509ed7a3f2bfdfa70ab /spec/requests | |
parent | f6a67fbad5119e3d95e33cfd4f4e4992707d5ba0 (diff) |
clean-up code
* Remove trailing whitespace
* Converts hard-tabs into two-space soft-tabs
* Remove consecutive blank lines
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/admin/admin_projects_spec.rb | 36 | ||||
-rw-r--r-- | spec/requests/admin/admin_users_spec.rb | 34 | ||||
-rw-r--r-- | spec/requests/admin/security_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/commits_notes_spec.rb | 6 | ||||
-rw-r--r-- | spec/requests/commits_spec.rb | 14 | ||||
-rw-r--r-- | spec/requests/issues_notes_spec.rb | 6 | ||||
-rw-r--r-- | spec/requests/issues_spec.rb | 44 | ||||
-rw-r--r-- | spec/requests/keys_spec.rb | 18 | ||||
-rw-r--r-- | spec/requests/profile_spec.rb | 27 | ||||
-rw-r--r-- | spec/requests/projects_security_spec.rb | 34 | ||||
-rw-r--r-- | spec/requests/projects_spec.rb | 40 | ||||
-rw-r--r-- | spec/requests/projects_tree_perfomance_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/projects_tree_spec.rb | 14 | ||||
-rw-r--r-- | spec/requests/projects_wall_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/snippets_spec.rb | 30 | ||||
-rw-r--r-- | spec/requests/team_members_spec.rb | 24 | ||||
-rw-r--r-- | spec/requests/top_panel_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/user_security_spec.rb | 10 |
18 files changed, 184 insertions, 185 deletions
diff --git a/spec/requests/admin/admin_projects_spec.rb b/spec/requests/admin/admin_projects_spec.rb index e36ee4411ff..fd8703ec06a 100644 --- a/spec/requests/admin/admin_projects_spec.rb +++ b/spec/requests/admin/admin_projects_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe "Admin::Projects" do - before do + before do @project = Factory :project, :name => "LeGiT", :code => "LGT" @@ -9,7 +9,7 @@ describe "Admin::Projects" do end describe "GET /admin/projects" do - before do + before do visit admin_projects_path end @@ -17,49 +17,49 @@ describe "Admin::Projects" do current_path.should == admin_projects_path end - it "should have projects list" do + it "should have projects list" do page.should have_content(@project.code) page.should have_content(@project.name) end end - describe "GET /admin/projects/:id" do - before do + describe "GET /admin/projects/:id" do + before do visit admin_projects_path click_link "Show" end - it "should have project info" do + it "should have project info" do page.should have_content(@project.code) page.should have_content(@project.name) end end - describe "GET /admin/projects/:id/edit" do - before do + describe "GET /admin/projects/:id/edit" do + before do visit admin_projects_path click_link "edit_project_#{@project.id}" end - it "should have project edit page" do + it "should have project edit page" do page.should have_content("Name") page.should have_content("Code") end describe "Update project" do - before do + before do fill_in "project_name", :with => "Big Bang" fill_in "project_code", :with => "BB1" click_button "Save" @project.reload end - it "should show page with new data" do + it "should show page with new data" do page.should have_content("BB1") page.should have_content("Big Bang") end - it "should change project entry" do + it "should change project entry" do @project.name.should == "Big Bang" @project.code.should == "BB1" end @@ -67,24 +67,24 @@ describe "Admin::Projects" do end describe "GET /admin/projects/new" do - before do + before do visit admin_projects_path click_link "New Project" end it "should be correct path" do - current_path.should == new_admin_project_path + current_path.should == new_admin_project_path end it "should have labels for new project" do - page.should have_content("Name") - page.should have_content("Path") - page.should have_content("Description") + page.should have_content("Name") + page.should have_content("Path") + page.should have_content("Description") end end describe "POST /admin/projects" do - before do + before do visit new_admin_project_path fill_in 'Name', :with => 'NewProject' fill_in 'Code', :with => 'NPR' diff --git a/spec/requests/admin/admin_users_spec.rb b/spec/requests/admin/admin_users_spec.rb index 8d9cbcae2ac..67cfde5faf4 100644 --- a/spec/requests/admin/admin_users_spec.rb +++ b/spec/requests/admin/admin_users_spec.rb @@ -4,7 +4,7 @@ describe "Admin::Users" do before { login_as :admin } describe "GET /admin/users" do - before do + before do visit admin_users_path end @@ -12,14 +12,14 @@ describe "Admin::Users" do current_path.should == admin_users_path end - it "should have users list" do + it "should have users list" do page.should have_content(@user.email) page.should have_content(@user.name) end end - describe "GET /admin/users/new" do - before do + describe "GET /admin/users/new" do + before do @password = "123ABC" visit new_admin_user_path fill_in "user_name", :with => "Big Bang" @@ -28,23 +28,23 @@ describe "Admin::Users" do fill_in "user_password_confirmation", :with => @password end - it "should create new user" do + it "should create new user" do expect { click_button "Save" }.to change {User.count}.by(1) end - it "should create user with valid data" do + it "should create user with valid data" do click_button "Save" user = User.last user.name.should == "Big Bang" user.email.should == "bigbang@mail.com" end - it "should call send mail" do + it "should call send mail" do Notify.should_receive(:new_user_email).and_return(stub(:deliver => true)) click_button "Save" end - it "should send valid email to user with email & password" do + it "should send valid email to user with email & password" do click_button "Save" user = User.last email = ActionMailer::Base.deliveries.last @@ -54,45 +54,45 @@ describe "Admin::Users" do end end - describe "GET /admin/users/:id" do - before do + describe "GET /admin/users/:id" do + before do visit admin_users_path click_link "Show" end - it "should have user info" do + it "should have user info" do page.should have_content(@user.email) page.should have_content(@user.name) page.should have_content(@user.is_admin?) end end - describe "GET /admin/users/:id/edit" do - before do + describe "GET /admin/users/:id/edit" do + before do @simple_user = Factory :user visit admin_users_path click_link "edit_user_#{@simple_user.id}" end - it "should have user edit page" do + it "should have user edit page" do page.should have_content("Name") page.should have_content("Password") end describe "Update user" do - before do + before do fill_in "user_name", :with => "Big Bang" fill_in "user_email", :with => "bigbang@mail.com" check "user_admin" click_button "Save" end - it "should show page with new data" do + it "should show page with new data" do page.should have_content("bigbang@mail.com") page.should have_content("Big Bang") end - it "should change user entry" do + it "should change user entry" do @simple_user.reload @simple_user.name.should == "Big Bang" @simple_user.is_admin?.should be_true diff --git a/spec/requests/admin/security_spec.rb b/spec/requests/admin/security_spec.rb index 743f9f08cef..27b60196769 100644 --- a/spec/requests/admin/security_spec.rb +++ b/spec/requests/admin/security_spec.rb @@ -1,25 +1,25 @@ require 'spec_helper' describe "Admin::Projects" do - describe "GET /admin/projects" do + describe "GET /admin/projects" do it { admin_projects_path.should be_allowed_for :admin } it { admin_projects_path.should be_denied_for :user } it { admin_projects_path.should be_denied_for :visitor } end - describe "GET /admin/users" do + describe "GET /admin/users" do it { admin_users_path.should be_allowed_for :admin } it { admin_users_path.should be_denied_for :user } it { admin_users_path.should be_denied_for :visitor } end - describe "GET /admin/team_members" do + describe "GET /admin/team_members" do it { admin_team_members_path.should be_allowed_for :admin } it { admin_team_members_path.should be_denied_for :user } it { admin_team_members_path.should be_denied_for :visitor } end - describe "GET /admin/emails" do + describe "GET /admin/emails" do it { admin_emails_path.should be_allowed_for :admin } it { admin_emails_path.should be_denied_for :user } it { admin_emails_path.should be_denied_for :visitor } diff --git a/spec/requests/commits_notes_spec.rb b/spec/requests/commits_notes_spec.rb index 522fe51824b..c424f4fc3ca 100644 --- a/spec/requests/commits_notes_spec.rb +++ b/spec/requests/commits_notes_spec.rb @@ -4,13 +4,13 @@ describe "Issues" do let(:project) { Factory :project } let!(:commit) { project.repo.commits.first } - before do + before do login_as :user project.add_access(@user, :read, :write) end - describe "add new note", :js => true do - before do + describe "add new note", :js => true do + before do visit project_commit_path(project, commit) click_link "Comments" # notes tab fill_in "note_note", :with => "I commented this commit" diff --git a/spec/requests/commits_spec.rb b/spec/requests/commits_spec.rb index cd7314f9812..79bb03f53b6 100644 --- a/spec/requests/commits_spec.rb +++ b/spec/requests/commits_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe "Commits" do let(:project) { Factory :project } let!(:commit) { project.repo.commits.first } - before do + before do login_as :user project.add_access(@user, :read) end describe "GET /commits" do - before do + before do visit project_commits_path(project) end @@ -17,22 +17,22 @@ describe "Commits" do current_path.should == project_commits_path(project) end - it "should have project name" do + it "should have project name" do page.should have_content(project.name) end - it "should list commits" do + it "should list commits" do page.should have_content(commit.author) page.should have_content(commit.message) end end - describe "GET /commits/:id" do - before do + describe "GET /commits/:id" do + before do visit project_commit_path(project, commit) end - it "should have valid path" do + it "should have valid path" do current_path.should == project_commit_path(project, commit) end end diff --git a/spec/requests/issues_notes_spec.rb b/spec/requests/issues_notes_spec.rb index 95eb2f35d79..9ebad39473a 100644 --- a/spec/requests/issues_notes_spec.rb +++ b/spec/requests/issues_notes_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe "Issues" do let(:project) { Factory :project } - before do + before do login_as :user project.add_access(@user, :read, :write) @@ -13,8 +13,8 @@ describe "Issues" do :project => project end - describe "add new note", :js => true do - before do + 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 note" diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index 79fdf5efbb5..8c090d7fb3f 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe "Issues" do let(:project) { Factory :project } - before do + before do login_as :user project.add_access(@user, :read, :write) end describe "GET /issues" do - before do + before do @issue = Factory :issue, :author => @user, :assignee => @user, @@ -24,23 +24,23 @@ describe "Issues" do it { should have_content(@issue.project.name) } it { should have_content(@issue.assignee.name) } - describe "Destroy" do - before do + describe "Destroy" do + before do # admin access to remove issue @user.users_projects.destroy_all project.add_access(@user, :read, :write, :admin) visit project_issues_path(project) end - it "should remove entry" do + it "should remove entry" do expect { click_link "destroy_issue_#{@issue.id}" }.to change { Issue.count }.by(-1) end end - describe "statuses", :js => true do - before do + describe "statuses", :js => true do + before do @closed_issue = Factory :issue, :author => @user, :assignee => @user, @@ -48,18 +48,18 @@ describe "Issues" do :closed => true end - it "should show only open" do + it "should show only open" do should have_content(@issue.title) should have_no_content(@closed_issue.title) end - it "should show only closed" do + it "should show only closed" do choose "closed_issues" should have_no_content(@issue.title) should have_content(@closed_issue.title) end - it "should show all" do + it "should show all" do choose "all_issues" should have_content(@issue.title) should have_content(@closed_issue.title) @@ -67,17 +67,17 @@ describe "Issues" do end end - describe "New issue", :js => true do - before do + describe "New issue", :js => true do + before do visit project_issues_path(project) click_link "New Issue" end - it "should open new issue popup" do + it "should open new issue popup" do page.should have_content("Add new issue") end - describe "fill in" do + describe "fill in" do before do fill_in "issue_title", :with => "bug 345" fill_in "issue_content", :with => "app bug 345" @@ -87,7 +87,7 @@ describe "Issues" do it { expect { click_button "Save" }.to change {Issue.count}.by(1) } - it "should add new issue to table" do + it "should add new issue to table" do click_button "Save" page.should_not have_content("Add new issue") @@ -96,12 +96,12 @@ describe "Issues" do page.should have_content project.name end - it "should call send mail" do + it "should call send mail" do Notify.should_receive(:new_issue_email).and_return(stub(:deliver => true)) click_button "Save" end - it "should send valid email to user with email & password" do + it "should send valid email to user with email & password" do click_button "Save" issue = Issue.last email = ActionMailer::Base.deliveries.last @@ -112,8 +112,8 @@ describe "Issues" do end end - describe "Edit issue", :js => true do - before do + describe "Edit issue", :js => true do + before do @issue = Factory :issue, :author => @user, :assignee => @user, @@ -122,11 +122,11 @@ describe "Issues" do click_link "Edit" end - it "should open new issue popup" do + it "should open new issue popup" do page.should have_content("Issue ##{@issue.id}") end - describe "fill in" do + describe "fill in" do before do fill_in "issue_title", :with => "bug 345" fill_in "issue_content", :with => "app bug 345" @@ -134,7 +134,7 @@ describe "Issues" do it { expect { click_button "Save" }.to_not change {Issue.count} } - it "should update issue fields" do + it "should update issue fields" do click_button "Save" page.should_not have_content("Issue ##{@issue.id}") diff --git a/spec/requests/keys_spec.rb b/spec/requests/keys_spec.rb index 316115f9234..6ce22b30883 100644 --- a/spec/requests/keys_spec.rb +++ b/spec/requests/keys_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' describe "Issues" do - before do + before do login_as :user end describe "GET /keys" do - before do + before do @key = Factory :key, :user => @user visit keys_path end @@ -15,8 +15,8 @@ describe "Issues" do it { should have_content(@key.title) } - describe "Destroy" do - it "should remove entry" do + describe "Destroy" do + it "should remove entry" do expect { click_link "destroy_key_#{@key.id}" }.to change { @user.keys.count }.by(-1) @@ -24,17 +24,17 @@ describe "Issues" do end end - describe "New key", :js => true do - before do + describe "New key", :js => true do + before do visit keys_path click_link "Add new" end - it "should open new key popup" do + it "should open new key popup" do page.should have_content("Add new public key") end - describe "fill in" do + describe "fill in" do before do fill_in "key_title", :with => "laptop" fill_in "key_key", :with => "publickey234=" @@ -42,7 +42,7 @@ describe "Issues" do it { expect { click_button "Save" }.to change {Key.count}.by(1) } - it "should add new key to table" do + it "should add new key to table" do click_button "Save" page.should_not have_content("Add new public key") diff --git a/spec/requests/profile_spec.rb b/spec/requests/profile_spec.rb index 5838f63b40b..eca1c12e800 100644 --- a/spec/requests/profile_spec.rb +++ b/spec/requests/profile_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' describe "Profile" do - before do + before do login_as :user end describe "Show profile" do - before do + before do visit profile_path end @@ -15,13 +15,13 @@ describe "Profile" do end describe "Profile update" do - before do + before do visit profile_path fill_in "user_skype", :with => "testskype" - fill_in "user_linkedin", :with => "testlinkedin" + fill_in "user_linkedin", :with => "testlinkedin" fill_in "user_twitter", :with => "testtwitter" click_button "Save" - @user.reload + @user.reload end it { @user.skype.should == 'testskype' } @@ -29,18 +29,17 @@ describe "Profile" do it { @user.twitter.should == 'testtwitter' } end - describe "Password update" do - before 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 + 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" @@ -51,18 +50,18 @@ describe "Profile" do current_path.should == new_user_session_path end - it "should change password" do + it "should change password" do @user.encrypted_password.should_not == @old_pwd end - describe "login with new password" do + 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 + + it "should login user" do current_path.should == root_path end end diff --git a/spec/requests/projects_security_spec.rb b/spec/requests/projects_security_spec.rb index 90f88d88085..1d42c5e7c53 100644 --- a/spec/requests/projects_security_spec.rb +++ b/spec/requests/projects_security_spec.rb @@ -1,33 +1,33 @@ require 'spec_helper' describe "Projects" do - describe "GET /projects" do + describe "GET /projects" do it { projects_path.should be_allowed_for :admin } it { projects_path.should be_allowed_for :user } it { projects_path.should be_denied_for :visitor } end - describe "GET /projects/new" do + describe "GET /projects/new" do it { projects_path.should be_allowed_for :admin } it { projects_path.should be_allowed_for :user } it { projects_path.should be_denied_for :visitor } end describe "Project" do - before do + before do @project = Factory :project @u1 = Factory :user @u2 = Factory :user @u3 = Factory :user # full access - @project.users_projects.create(:user => @u1, :read => true, :write => true, :admin => true) + @project.users_projects.create(:user => @u1, :read => true, :write => true, :admin => true) # no access - @project.users_projects.create(:user => @u2, :read => false, :write => false, :admin => false) + @project.users_projects.create(:user => @u2, :read => false, :write => false, :admin => false) # readonly - @project.users_projects.create(:user => @u3, :read => true, :write => false, :admin => false) + @project.users_projects.create(:user => @u3, :read => true, :write => false, :admin => false) end - describe "GET /project_code" do + describe "GET /project_code" do it { project_path(@project).should be_allowed_for @u1 } it { project_path(@project).should be_allowed_for @u3 } it { project_path(@project).should be_denied_for :admin } @@ -36,7 +36,7 @@ describe "Projects" do it { project_path(@project).should be_denied_for :visitor } end - describe "GET /project_code/tree" do + describe "GET /project_code/tree" do it { tree_project_path(@project).should be_allowed_for @u1 } it { tree_project_path(@project).should be_allowed_for @u3 } it { tree_project_path(@project).should be_denied_for :admin } @@ -45,7 +45,7 @@ describe "Projects" do it { tree_project_path(@project).should be_denied_for :visitor } end - describe "GET /project_code/commits" do + describe "GET /project_code/commits" do it { project_commits_path(@project).should be_allowed_for @u1 } it { project_commits_path(@project).should be_allowed_for @u3 } it { project_commits_path(@project).should be_denied_for :admin } @@ -54,7 +54,7 @@ describe "Projects" do it { project_commits_path(@project).should be_denied_for :visitor } end - describe "GET /project_code/commit" do + describe "GET /project_code/commit" do it { project_commit_path(@project, @project.commit).should be_allowed_for @u1 } it { project_commit_path(@project, @project.commit).should be_allowed_for @u3 } it { project_commit_path(@project, @project.commit).should be_denied_for :admin } @@ -63,7 +63,7 @@ describe "Projects" do it { project_commit_path(@project, @project.commit).should be_denied_for :visitor } end - describe "GET /project_code/team" do + describe "GET /project_code/team" do it { team_project_path(@project).should be_allowed_for @u1 } it { team_project_path(@project).should be_allowed_for @u3 } it { team_project_path(@project).should be_denied_for :admin } @@ -72,7 +72,7 @@ describe "Projects" do it { team_project_path(@project).should be_denied_for :visitor } end - describe "GET /project_code/wall" do + describe "GET /project_code/wall" do it { wall_project_path(@project).should be_allowed_for @u1 } it { wall_project_path(@project).should be_allowed_for @u3 } it { wall_project_path(@project).should be_denied_for :admin } @@ -81,8 +81,8 @@ describe "Projects" do it { wall_project_path(@project).should be_denied_for :visitor } end - describe "GET /project_code/blob" do - before do + describe "GET /project_code/blob" do + before do @commit = @project.commit @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name @blob_path = blob_project_path(@project, :commit_id => @commit.id, :path => @path) @@ -96,7 +96,7 @@ describe "Projects" do it { @blob_path.should be_denied_for :visitor } end - describe "GET /project_code/edit" do + describe "GET /project_code/edit" do it { edit_project_path(@project).should be_allowed_for @u1 } it { edit_project_path(@project).should be_denied_for @u3 } it { edit_project_path(@project).should be_denied_for :admin } @@ -105,7 +105,7 @@ describe "Projects" do it { edit_project_path(@project).should be_denied_for :visitor } end - describe "GET /project_code/issues" do + describe "GET /project_code/issues" do it { project_issues_path(@project).should be_allowed_for @u1 } it { project_issues_path(@project).should be_allowed_for @u3 } it { project_issues_path(@project).should be_denied_for :admin } @@ -114,7 +114,7 @@ describe "Projects" do it { project_issues_path(@project).should be_denied_for :visitor } end - describe "GET /project_code/snippets" do + describe "GET /project_code/snippets" do it { project_snippets_path(@project).should be_allowed_for @u1 } it { project_snippets_path(@project).should be_allowed_for @u3 } it { project_snippets_path(@project).should be_denied_for :admin } diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index 945c1ea26f5..e1e9773c850 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -4,38 +4,38 @@ describe "Projects" do before { login_as :user } describe "GET /projects" do - before do + before do visit projects_path end it "should be on projects page" do - current_path.should == projects_path + current_path.should == projects_path end it "should have link to new project" do - page.should have_content("New Project") + page.should have_content("New Project") end end describe "GET /projects/new" do - before do + before do visit projects_path click_link "New Project" end it "should be correct path" do - current_path.should == new_project_path + current_path.should == new_project_path end it "should have labels for new project" do - page.should have_content("Name") - page.should have_content("Path") - page.should have_content("Description") + page.should have_content("Name") + page.should have_content("Path") + page.should have_content("Description") end end describe "POST /projects" do - before do + before do visit new_project_path fill_in 'Name', :with => 'NewProject' fill_in 'Code', :with => 'NPR' @@ -61,7 +61,7 @@ describe "Projects" do end describe "GET /projects/show" do - before do + before do @project = Factory :project @project.add_access(@user, :read) @@ -72,14 +72,14 @@ describe "Projects" do current_path.should == project_path(@project) end - it "should beahave like dashboard" do + it "should beahave like dashboard" do page.should have_content("History") end end describe "GET /projects/team" do - before do + before do @project = Factory :project @project.add_access(@user, :read) @@ -92,13 +92,13 @@ describe "Projects" do current_path.should == team_project_path(@project) end - it "should have as as team member" do + it "should have as as team member" do page.should have_content(@user.name) end end describe "GET /projects/:id/edit" do - before do + before do @project = Factory :project @project.add_access(@user, :admin, :read) @@ -110,14 +110,14 @@ describe "Projects" do end it "should have labels for new project" do - page.should have_content("Name") - page.should have_content("Path") - page.should have_content("Description") + page.should have_content("Name") + page.should have_content("Path") + page.should have_content("Description") end end describe "PUT /projects/:id" do - before do + before do @project = Factory :project @project.add_access(@user, :admin, :read) @@ -140,14 +140,14 @@ describe "Projects" do end #describe "DELETE /projects/:id", :js => true do - #before do + #before do #@project = Factory :project #@project.add_access(@user, :read, :admin) #visit projects_path #end #it "should be correct path" do - #expect { click_link "Destroy" }.to change {Project.count}.by(1) + #expect { click_link "Destroy" }.to change {Project.count}.by(1) #end #end end diff --git a/spec/requests/projects_tree_perfomance_spec.rb b/spec/requests/projects_tree_perfomance_spec.rb index 5b4facb17d6..bf3ca167d31 100644 --- a/spec/requests/projects_tree_perfomance_spec.rb +++ b/spec/requests/projects_tree_perfomance_spec.rb @@ -6,13 +6,13 @@ describe "Projects" do describe "GET /projects/tree" do describe "head" do - before do + before do @project = Factory :project @project.add_access(@user, :read) end - it "should be fast" do + it "should be fast" do time = Benchmark.realtime do visit tree_project_path(@project) end @@ -21,12 +21,12 @@ describe "Projects" do end describe ValidCommit::ID do - before do + before do @project = Factory :project @project.add_access(@user, :read) end - it "should be fast" do + it "should be fast" do time = Benchmark.realtime do visit tree_project_path(@project, :commit_id => ValidCommit::ID) end diff --git a/spec/requests/projects_tree_spec.rb b/spec/requests/projects_tree_spec.rb index 4e3176bbdc3..fd49ffaab5c 100644 --- a/spec/requests/projects_tree_spec.rb +++ b/spec/requests/projects_tree_spec.rb @@ -5,7 +5,7 @@ describe "Projects" do describe "GET /projects/tree" do describe "head" do - before do + before do @project = Factory :project @project.add_access(@user, :read) @@ -20,7 +20,7 @@ describe "Projects" do end describe ValidCommit::ID do - before do + before do @project = Factory :project @project.add_access(@user, :read) @@ -36,7 +36,7 @@ describe "Projects" do end describe "branch passed" do - before do + before do @project = Factory :project @project.add_access(@user, :read) @@ -53,7 +53,7 @@ describe "Projects" do # TREE FILE PREVIEW describe "file preview" do - before do + before do @project = Factory :project @project.add_access(@user, :read) @@ -70,9 +70,9 @@ describe "Projects" do end end - # RAW FILE + # RAW FILE describe "GET /projects/blob" do - before do + before do @project = Factory :project @project.add_access(@user, :read) @@ -85,7 +85,7 @@ describe "Projects" do current_path.should == blob_project_path(@project) end - it "raw file response" do + it "raw file response" do page.source.should == ValidCommit::BLOB_FILE end end diff --git a/spec/requests/projects_wall_spec.rb b/spec/requests/projects_wall_spec.rb index a7387f9326d..bb734bdab23 100644 --- a/spec/requests/projects_wall_spec.rb +++ b/spec/requests/projects_wall_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe "Projects", "Wall" do let(:project) { Factory :project } - before do + before do login_as :user project.add_access(@user, :read, :write) end describe "View notes on wall" do - before do + before do Factory :note, :project => project, :note => "Project specs", :author => @user visit wall_project_path(project) end @@ -19,8 +19,8 @@ describe "Projects", "Wall" do it { page.should have_content("less than a minute ago") } end - describe "add new note", :js => true do - before do + 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 note" diff --git a/spec/requests/snippets_spec.rb b/spec/requests/snippets_spec.rb index 00ae58dad87..d4811958db3 100644 --- a/spec/requests/snippets_spec.rb +++ b/spec/requests/snippets_spec.rb @@ -3,13 +3,13 @@ require 'spec_helper' describe "Snippets" do let(:project) { Factory :project } - before do + before do login_as :user project.add_access(@user, :read, :write) end describe "GET /snippets" do - before do + before do @snippet = Factory :snippet, :author => @user, :project => project @@ -23,15 +23,15 @@ describe "Snippets" do it { should have_content(@snippet.project.name) } it { should have_content(@snippet.author.name) } - describe "Destroy" do - before do + describe "Destroy" do + before do # admin access to remove snippet @user.users_projects.destroy_all project.add_access(@user, :read, :write, :admin) visit project_snippets_path(project) end - it "should remove entry" do + it "should remove entry" do expect { click_link "destroy_snippet_#{@snippet.id}" }.to change { Snippet.count }.by(-1) @@ -39,17 +39,17 @@ describe "Snippets" do end end - describe "New snippet" do - before do + describe "New snippet" do + before do visit project_snippets_path(project) click_link "New Snippet" end - it "should open new snippet popup" do + it "should open new snippet popup" do page.current_path.should == new_project_snippet_path(project) end - describe "fill in" do + describe "fill in" do before do fill_in "snippet_title", :with => "login function" fill_in "snippet_file_name", :with => "test.rb" @@ -58,7 +58,7 @@ describe "Snippets" do it { expect { click_button "Save" }.to change {Snippet.count}.by(1) } - it "should add new snippet to table" do + it "should add new snippet to table" do click_button "Save" page.current_path.should == project_snippet_path(project, Snippet.last) page.should have_content "login function" @@ -67,8 +67,8 @@ describe "Snippets" do end end - describe "Edit snippet" do - before do + describe "Edit snippet" do + before do @snippet = Factory :snippet, :author => @user, :project => project @@ -76,11 +76,11 @@ describe "Snippets" do click_link "Edit" end - it "should open edit page" do + it "should open edit page" do page.current_path.should == edit_project_snippet_path(project, @snippet) end - describe "fill in" do + describe "fill in" do before do fill_in "snippet_title", :with => "login function" fill_in "snippet_file_name", :with => "test.rb" @@ -89,7 +89,7 @@ describe "Snippets" do it { expect { click_button "Save" }.to_not change {Snippet.count} } - it "should update snippet fields" do + it "should update snippet fields" do click_button "Save" page.current_path.should == project_snippet_path(project, @snippet) diff --git a/spec/requests/team_members_spec.rb b/spec/requests/team_members_spec.rb index 650ed4497f2..d6555518149 100644 --- a/spec/requests/team_members_spec.rb +++ b/spec/requests/team_members_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe "TeamMembers" do - before do + before do login_as :user @project = Factory :project @project.add_access(@user, :read, :admin) @@ -10,7 +10,7 @@ describe "TeamMembers" do describe "View profile" do it "should be available" do visit(team_project_path(@project)) - within "#team-table" do + within "#team-table" do click_link(@user.name) end page.should have_content @user.skype @@ -18,23 +18,23 @@ describe "TeamMembers" do end end - describe "New Team member", :js => true do - before do + describe "New Team member", :js => true do + before do @user_1 = Factory :user visit team_project_path(@project) click_link "Add new" end - it "should open new team member popup" do + it "should open new team member popup" do page.should have_content("Add new member to project") end - describe "fill in" do + describe "fill in" do before do click_link "Select user" click_link @user_1.name - within "#team_member_new" do + within "#team_member_new" do check "team_member_read" check "team_member_write" end @@ -42,7 +42,7 @@ describe "TeamMembers" do it { expect { click_button "Save";sleep(1) }.to change {UsersProject.count}.by(1) } - it "should add new member to table" do + it "should add new member to table" do click_button "Save" @member = UsersProject.last @@ -53,8 +53,8 @@ describe "TeamMembers" do @member.admin.should be_false end - it "should not allow creation without access selected" do - within "#team_member_new" do + it "should not allow creation without access selected" do + within "#team_member_new" do uncheck "team_member_read" uncheck "team_member_write" uncheck "team_member_admin" @@ -66,8 +66,8 @@ describe "TeamMembers" do end end - describe "Cancel membership" do - it "should cancel membership" do + describe "Cancel membership" do + it "should cancel membership" do visit team_project_path(@project) expect { click_link "Cancel" }.to change { UsersProject.count }.by(-1) end diff --git a/spec/requests/top_panel_spec.rb b/spec/requests/top_panel_spec.rb index bd4d2047796..d1cea6d86d2 100644 --- a/spec/requests/top_panel_spec.rb +++ b/spec/requests/top_panel_spec.rb @@ -4,7 +4,7 @@ describe "Top Panel", :js => true do before { login_as :user } describe "Search autocomplete" do - before do + before do visit projects_path fill_in "search", :with => "Ke" sleep(2) @@ -12,12 +12,12 @@ describe "Top Panel", :js => true do end it "should be on projects page" do - current_path.should == keys_path + current_path.should == keys_path end end describe "with project" do - before do + before do @project = Factory :project @project.add_access(@user, :read) visit project_path(@project) @@ -28,7 +28,7 @@ describe "Top Panel", :js => true do end it "should be on projects page" do - current_path.should == project_commits_path(@project) + current_path.should == project_commits_path(@project) end end end diff --git a/spec/requests/user_security_spec.rb b/spec/requests/user_security_spec.rb index a27eb1ca33b..b75a1779a8a 100644 --- a/spec/requests/user_security_spec.rb +++ b/spec/requests/user_security_spec.rb @@ -2,32 +2,32 @@ require 'spec_helper' describe "Users Security" do describe "Project" do - before do + before do @u1 = Factory :user 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 } end - describe "GET /keys" do + describe "GET /keys" do it { keys_path.should be_allowed_for @u1 } it { keys_path.should be_allowed_for :admin } it { keys_path.should be_allowed_for :user } it { keys_path.should be_denied_for :visitor } end - describe "GET /profile" do + describe "GET /profile" do it { profile_path.should be_allowed_for @u1 } it { profile_path.should be_allowed_for :admin } it { profile_path.should be_allowed_for :user } it { profile_path.should be_denied_for :visitor } end - describe "GET /profile/password" do + describe "GET /profile/password" do it { profile_password_path.should be_allowed_for @u1 } it { profile_password_path.should be_allowed_for :admin } it { profile_password_path.should be_allowed_for :user } |