diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-03 17:54:33 -0800 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-02-03 17:54:33 -0800 |
commit | 635ebac606d77eae03ce2e2a8f0a814ad4c79177 (patch) | |
tree | 8f3047074880166e53edb987df8ba4295d374c3d /spec | |
parent | ac7af45d8987422c2a529d3d87eae6d9bd608e12 (diff) | |
parent | 704922c855a9741b5495db56ac266788a9c25c33 (diff) | |
download | gitlab-ce-635ebac606d77eae03ce2e2a8f0a814ad4c79177.tar.gz |
Merge branch 'master' into mwessel/gitlab-ce-configure-protection
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/commit_controller_spec.rb | 9 | ||||
-rw-r--r-- | spec/factories/projects.rb | 1 | ||||
-rw-r--r-- | spec/features/issues_spec.rb | 5 | ||||
-rw-r--r-- | spec/helpers/nav_helper_spec.rb | 25 | ||||
-rw-r--r-- | spec/helpers/notifications_helper_spec.rb | 3 | ||||
-rw-r--r-- | spec/lib/repository_cache_spec.rb | 34 | ||||
-rw-r--r-- | spec/lib/votes_spec.rb | 8 | ||||
-rw-r--r-- | spec/models/hooks/project_hook_spec.rb (renamed from spec/models/project_hook_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/hooks/service_hook_spec.rb (renamed from spec/models/service_hook_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/hooks/system_hook_spec.rb (renamed from spec/models/system_hook_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/hooks/web_hook_spec.rb (renamed from spec/models/web_hook_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/members/group_member_spec.rb (renamed from spec/models/group_member_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/members/project_member_spec.rb (renamed from spec/models/project_member_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/members_spec.rb | 2 | ||||
-rw-r--r-- | spec/models/project_services/assembla_service_spec.rb (renamed from spec/models/assembla_service_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_services/buildbox_service_spec.rb (renamed from spec/models/buildbox_service_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_services/flowdock_service_spec.rb (renamed from spec/models/flowdock_service_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_services/gemnasium_service_spec.rb (renamed from spec/models/gemnasium_service_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_services/gitlab_ci_service_spec.rb (renamed from spec/models/gitlab_ci_service_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_services/jira_service_spec.rb (renamed from spec/models/jira_service_spec.rb) | 14 | ||||
-rw-r--r-- | spec/models/project_services/pushover_service_spec.rb (renamed from spec/models/pushover_service_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_services/slack_message_spec.rb (renamed from spec/models/slack_message_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_services/slack_service_spec.rb (renamed from spec/models/slack_service_spec.rb) | 0 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/api/groups_spec.rb | 18 |
25 files changed, 113 insertions, 8 deletions
diff --git a/spec/controllers/commit_controller_spec.rb b/spec/controllers/commit_controller_spec.rb index f5822157ea4..cd8b46d7672 100644 --- a/spec/controllers/commit_controller_spec.rb +++ b/spec/controllers/commit_controller_spec.rb @@ -70,4 +70,13 @@ describe Projects::CommitController do end end end + + describe "#branches" do + it "contains branch and tags information" do + get :branches, project_id: project.to_param, id: commit.id + + expect(assigns(:branches)).to include("master", "feature_conflict") + expect(assigns(:tags)).to include("v1.1.0") + end + end end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 5ae57718c1a..0899a7603fc 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -26,6 +26,7 @@ # star_count :integer default(0), not null # import_type :string(255) # import_source :string(255) +# avatar :string(255) # FactoryGirl.define do diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 26607b0090c..e6fa376f3eb 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -65,7 +65,7 @@ describe "Issues", feature: true do click_button "Save changes" - page.should have_content "Assignee: Select assignee" + page.should have_content 'Assignee: none' issue.reload.assignee.should be_nil end end @@ -249,6 +249,7 @@ describe "Issues", feature: true do click_button 'Update Issue' page.should have_content "Milestone changed to #{milestone.title}" + page.should have_content "Milestone: #{milestone.title}" has_select?('issue_assignee_id', :selected => milestone.title) end end @@ -287,7 +288,7 @@ describe "Issues", feature: true do sleep 2 # wait for ajax stuff to complete first('.user-result').click - page.should have_content "Assignee: Unassigned" + page.should have_content 'Assignee: none' sleep 2 # wait for ajax stuff to complete issue.reload.assignee.should be_nil end diff --git a/spec/helpers/nav_helper_spec.rb b/spec/helpers/nav_helper_spec.rb new file mode 100644 index 00000000000..e4d18d8bfc6 --- /dev/null +++ b/spec/helpers/nav_helper_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the NavHelper. For example: +# +# describe NavHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe NavHelper do + describe '#nav_menu_collapsed?' do + it 'returns true when the nav is collapsed in the cookie' do + helper.request.cookies[:collapsed_nav] = 'true' + expect(helper.nav_menu_collapsed?).to eq true + end + + it 'returns false when the nav is not collapsed in the cookie' do + helper.request.cookies[:collapsed_nav] = 'false' + expect(helper.nav_menu_collapsed?).to eq false + end + end +end diff --git a/spec/helpers/notifications_helper_spec.rb b/spec/helpers/notifications_helper_spec.rb index 31ecdacf28e..dcc3318e4f9 100644 --- a/spec/helpers/notifications_helper_spec.rb +++ b/spec/helpers/notifications_helper_spec.rb @@ -1,6 +1,9 @@ require 'spec_helper' describe NotificationsHelper do + include FontAwesome::Rails::IconHelper + include IconsHelper + describe 'notification_icon' do let(:notification) { double(disabled?: false, participating?: false, watch?: false) } diff --git a/spec/lib/repository_cache_spec.rb b/spec/lib/repository_cache_spec.rb new file mode 100644 index 00000000000..af399f3a731 --- /dev/null +++ b/spec/lib/repository_cache_spec.rb @@ -0,0 +1,34 @@ +require 'rspec' +require_relative '../../lib/repository_cache' + +describe RepositoryCache do + let(:backend) { double('backend').as_null_object } + let(:cache) { RepositoryCache.new('example', backend) } + + describe '#cache_key' do + it 'includes the namespace' do + expect(cache.cache_key(:foo)).to eq 'foo:example' + end + end + + describe '#expire' do + it 'expires the given key from the cache' do + cache.expire(:foo) + expect(backend).to have_received(:delete).with('foo:example') + end + end + + describe '#fetch' do + it 'fetches the given key from the cache' do + cache.fetch(:bar) + expect(backend).to have_received(:fetch).with('bar:example') + end + + it 'accepts a block' do + p = -> {} + + cache.fetch(:baz, &p) + expect(backend).to have_received(:fetch).with('baz:example', &p) + end + end +end diff --git a/spec/lib/votes_spec.rb b/spec/lib/votes_spec.rb index 2c01a34756d..a88a10d927f 100644 --- a/spec/lib/votes_spec.rb +++ b/spec/lib/votes_spec.rb @@ -161,8 +161,8 @@ describe Issue, 'Votes' do add_note '+1 I still like this' add_note '+1 I really like this' add_note '+1 Give me this now!!!!' - p issue.downvotes.should == 0 - p issue.upvotes.should == 1 + issue.downvotes.should == 0 + issue.upvotes.should == 1 end it 'should count a users vote only once without caring about comments' do @@ -171,8 +171,8 @@ describe Issue, 'Votes' do add_note 'Another comment' add_note '+1 vote' add_note 'final comment' - p issue.downvotes.should == 0 - p issue.upvotes.should == 1 + issue.downvotes.should == 0 + issue.upvotes.should == 1 end end diff --git a/spec/models/project_hook_spec.rb b/spec/models/hooks/project_hook_spec.rb index 4e0d50d7f3f..4e0d50d7f3f 100644 --- a/spec/models/project_hook_spec.rb +++ b/spec/models/hooks/project_hook_spec.rb diff --git a/spec/models/service_hook_spec.rb b/spec/models/hooks/service_hook_spec.rb index 6ec82438dfe..6ec82438dfe 100644 --- a/spec/models/service_hook_spec.rb +++ b/spec/models/hooks/service_hook_spec.rb diff --git a/spec/models/system_hook_spec.rb b/spec/models/hooks/system_hook_spec.rb index 8deb732de9c..8deb732de9c 100644 --- a/spec/models/system_hook_spec.rb +++ b/spec/models/hooks/system_hook_spec.rb diff --git a/spec/models/web_hook_spec.rb b/spec/models/hooks/web_hook_spec.rb index e9c04ee89cb..e9c04ee89cb 100644 --- a/spec/models/web_hook_spec.rb +++ b/spec/models/hooks/web_hook_spec.rb diff --git a/spec/models/group_member_spec.rb b/spec/models/members/group_member_spec.rb index 38657de6793..38657de6793 100644 --- a/spec/models/group_member_spec.rb +++ b/spec/models/members/group_member_spec.rb diff --git a/spec/models/project_member_spec.rb b/spec/models/members/project_member_spec.rb index 9b5f89b6d7d..9b5f89b6d7d 100644 --- a/spec/models/project_member_spec.rb +++ b/spec/models/members/project_member_spec.rb diff --git a/spec/models/members_spec.rb b/spec/models/members_spec.rb index 6866c4794c2..cea653ec285 100644 --- a/spec/models/members_spec.rb +++ b/spec/models/members_spec.rb @@ -10,7 +10,7 @@ describe Member do it { should validate_presence_of(:user) } it { should validate_presence_of(:source) } - it { should ensure_inclusion_of(:access_level).in_array(Gitlab::Access.values) } + it { should validate_inclusion_of(:access_level).in_array(Gitlab::Access.values) } end describe "Delegate methods" do diff --git a/spec/models/assembla_service_spec.rb b/spec/models/project_services/assembla_service_spec.rb index 005dd41fea9..005dd41fea9 100644 --- a/spec/models/assembla_service_spec.rb +++ b/spec/models/project_services/assembla_service_spec.rb diff --git a/spec/models/buildbox_service_spec.rb b/spec/models/project_services/buildbox_service_spec.rb index 1d9ca51be16..1d9ca51be16 100644 --- a/spec/models/buildbox_service_spec.rb +++ b/spec/models/project_services/buildbox_service_spec.rb diff --git a/spec/models/flowdock_service_spec.rb b/spec/models/project_services/flowdock_service_spec.rb index ac156719b43..ac156719b43 100644 --- a/spec/models/flowdock_service_spec.rb +++ b/spec/models/project_services/flowdock_service_spec.rb diff --git a/spec/models/gemnasium_service_spec.rb b/spec/models/project_services/gemnasium_service_spec.rb index 2c560c11dac..2c560c11dac 100644 --- a/spec/models/gemnasium_service_spec.rb +++ b/spec/models/project_services/gemnasium_service_spec.rb diff --git a/spec/models/gitlab_ci_service_spec.rb b/spec/models/project_services/gitlab_ci_service_spec.rb index 83277058fbb..83277058fbb 100644 --- a/spec/models/gitlab_ci_service_spec.rb +++ b/spec/models/project_services/gitlab_ci_service_spec.rb diff --git a/spec/models/jira_service_spec.rb b/spec/models/project_services/jira_service_spec.rb index 0c73a68c924..99ca04eff6e 100644 --- a/spec/models/jira_service_spec.rb +++ b/spec/models/project_services/jira_service_spec.rb @@ -1,3 +1,17 @@ +# == Schema Information +# +# Table name: services +# +# id :integer not null, primary key +# type :string(255) +# title :string(255) +# project_id :integer not null +# created_at :datetime +# updated_at :datetime +# active :boolean default(FALSE), not null +# properties :text +# + require 'spec_helper' describe JiraService do diff --git a/spec/models/pushover_service_spec.rb b/spec/models/project_services/pushover_service_spec.rb index f2813d66c7d..f2813d66c7d 100644 --- a/spec/models/pushover_service_spec.rb +++ b/spec/models/project_services/pushover_service_spec.rb diff --git a/spec/models/slack_message_spec.rb b/spec/models/project_services/slack_message_spec.rb index c530fad619b..c530fad619b 100644 --- a/spec/models/slack_message_spec.rb +++ b/spec/models/project_services/slack_message_spec.rb diff --git a/spec/models/slack_service_spec.rb b/spec/models/project_services/slack_service_spec.rb index 34594072409..34594072409 100644 --- a/spec/models/slack_service_spec.rb +++ b/spec/models/project_services/slack_service_spec.rb diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 092c02d552e..4669a9fd87d 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -14,7 +14,7 @@ # merge_requests_enabled :boolean default(TRUE), not null # wiki_enabled :boolean default(TRUE), not null # namespace_id :integer -# issues_tracker :string(255) default('gitlab'), not null +# issues_tracker :string(255) default("gitlab"), not null # issues_tracker_id :string(255) # snippets_enabled :boolean default(TRUE), not null # last_activity_at :datetime diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 95f82463367..8465d765294 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -73,6 +73,24 @@ describe API::API, api: true do response.status.should == 404 end end + + context 'when using group path in URL' do + it 'should return any existing group' do + get api("/groups/#{group1.path}", admin) + response.status.should == 200 + json_response['name'] == group2.name + end + + it 'should not return a non existing group' do + get api('/groups/unknown', admin) + response.status.should == 404 + end + + it 'should not return a group not attached to user1' do + get api("/groups/#{group2.path}", user1) + response.status.should == 403 + end + end end describe "POST /groups" do |