diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2013-10-10 15:09:12 +0200 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2013-10-10 15:09:12 +0200 |
commit | 465499928835d3319e6838f43f04d5079a197850 (patch) | |
tree | 24a72b637bc7f103fa4cd01955534895799560f5 /spec | |
parent | 5b23a7bbb9cc47cda3111a5213b3433303c3e143 (diff) | |
parent | e8d1e827d8fe68d61a7be180bcc411c0d4e7982c (diff) | |
download | gitlab-ce-465499928835d3319e6838f43f04d5079a197850.tar.gz |
Merge branch 'master' into relative_links_in_documentation
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/notes_on_merge_requests_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/profile_spec.rb | 6 | ||||
-rw-r--r-- | spec/features/security/profile_access_spec.rb | 2 | ||||
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 18 | ||||
-rw-r--r-- | spec/helpers/projects_helper_spec.rb | 11 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 38 | ||||
-rw-r--r-- | spec/routing/routing_spec.rb | 2 |
7 files changed, 72 insertions, 11 deletions
diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index ba580d9484d..d29bed4dea7 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -216,12 +216,6 @@ describe "On a merge request diff", js: true, focus: true do end end - it do - within("tr[id='342e16cbbd482ac2047dc679b2749d248cc1428f_18_17'] + .js-temp-notes-holder") do - should have_no_css(".js-temp-notes-holder") - end - end - it 'should be added as discussion' do should have_content("Another comment on line 17") should have_css(".notes_holder") diff --git a/spec/features/profile_spec.rb b/spec/features/profile_spec.rb index 80c9f5d7f14..b67ce3c67f1 100644 --- a/spec/features/profile_spec.rb +++ b/spec/features/profile_spec.rb @@ -12,7 +12,7 @@ describe "Profile account page" do describe "when signup is enabled" do before do Gitlab.config.gitlab.stub(:signup_enabled).and_return(true) - visit account_profile_path + visit profile_account_path end it { page.should have_content("Remove account") } @@ -26,12 +26,12 @@ describe "Profile account page" do describe "when signup is disabled" do before do Gitlab.config.gitlab.stub(:signup_enabled).and_return(false) - visit account_profile_path + visit profile_account_path end it "should not have option to remove account" do page.should_not have_content("Remove account") - current_path.should == account_profile_path + current_path.should == profile_account_path end end end diff --git a/spec/features/security/profile_access_spec.rb b/spec/features/security/profile_access_spec.rb index 7754b28347a..078c257538f 100644 --- a/spec/features/security/profile_access_spec.rb +++ b/spec/features/security/profile_access_spec.rb @@ -29,7 +29,7 @@ describe "Users Security" do end describe "GET /profile/account" do - subject { account_profile_path } + subject { profile_account_path } it { should be_allowed_for @u1 } it { should be_allowed_for :admin } diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 229f49659cf..0d066be5b45 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -38,6 +38,24 @@ describe ApplicationHelper do current_action?(:baz, :bar, :foo).should be_true end end + + describe "avatar_icon" do + avatar_file_path = File.join(Rails.root, 'public', 'gitlab_logo.png') + + it "should return an url for the avatar" do + user = create(:user) + user.avatar = File.open(avatar_file_path) + user.save! + avatar_icon(user.email).to_s.should == "/uploads/user/avatar/#{ user.id }/gitlab_logo.png" + end + + it "should call gravatar_icon when no avatar is present" do + user = create(:user) + user.save! + stub!(:gravatar_icon).and_return('gravatar_method_called') + avatar_icon(user.email).to_s.should == "gravatar_method_called" + end + end describe "gravatar_icon" do let(:user_email) { 'user@email.com' } diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb new file mode 100644 index 00000000000..62f88dd522b --- /dev/null +++ b/spec/helpers/projects_helper_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe ProjectsHelper do + describe '#project_issues_trackers' do + it "returns the correct issues trackers available" do + project_issues_trackers.should == + "<option value=\"redmine\">Redmine</option>\n" \ + "<option value=\"gitlab\">GitLab</option>" + end + end +end diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index b8c0b6f33ed..bf4a1749418 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -730,4 +730,42 @@ describe API::API do end end end + + describe "DELETE /projects/:id" do + context "when authenticated as user" do + it "should remove project" do + delete api("/projects/#{project.id}", user) + response.status.should == 200 + end + + it "should not remove a project if not an owner" do + user3 = create(:user) + project.team << [user3, :developer] + delete api("/projects/#{project.id}", user3) + response.status.should == 403 + end + + it "should not remove a non existing project" do + delete api("/projects/1328", user) + response.status.should == 404 + end + + it "should not remove a project not attached to user" do + delete api("/projects/#{project.id}", user2) + response.status.should == 404 + end + end + + context "when authenticated as admin" do + it "should remove any existing project" do + delete api("/projects/#{project.id}", admin) + response.status.should == 200 + end + + it "should not remove a non existing project" do + delete api("/projects/1328", admin) + response.status.should == 404 + end + end + end end diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 946ef7c28cb..1b1d19d26b1 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -128,7 +128,7 @@ end # profile_update PUT /profile/update(.:format) profile#update describe ProfilesController, "routing" do it "to #account" do - get("/profile/account").should route_to('profiles#account') + get("/profile/account").should route_to('profiles/accounts#show') end it "to #history" do |