summaryrefslogtreecommitdiff
path: root/spec/models
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-08-06 12:16:36 +0200
committerDouwe Maan <douwe@gitlab.com>2015-08-06 12:16:36 +0200
commit4f24eb2aa670877faeef0f486af00d74e007ad01 (patch)
tree3b8c9ccbe779050db829565910e8652392af4dcf /spec/models
parentc6799b0e1ecd1b7373f0ea23195e18c7ad5c199d (diff)
parentfff36a8b8965e4bddd8020caf5072e79bf131a74 (diff)
downloadgitlab-ce-merge-notifs.tar.gz
Merge branch 'master' into merge-notifsmerge-notifs
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/application_setting_spec.rb5
-rw-r--r--spec/models/key_spec.rb7
-rw-r--r--spec/models/merge_request_spec.rb2
-rw-r--r--spec/models/note_spec.rb2
-rw-r--r--spec/models/project_services/slack_service_spec.rb2
-rw-r--r--spec/models/project_spec.rb22
-rw-r--r--spec/models/repository_spec.rb4
-rw-r--r--spec/models/user_spec.rb14
8 files changed, 44 insertions, 14 deletions
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index d648f4078be..bc14ff98fd8 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -14,11 +14,14 @@
# default_branch_protection :integer default(2)
# twitter_sharing_enabled :boolean default(TRUE)
# restricted_visibility_levels :text
+# version_check_enabled :boolean default(TRUE)
# max_attachment_size :integer default(10), not null
-# session_expire_delay :integer default(10080), not null
# default_project_visibility :integer
# default_snippet_visibility :integer
# restricted_signup_domains :text
+# user_oauth_applications :boolean default(TRUE)
+# after_sign_out_path :string(255)
+# session_expire_delay :integer default(10080), not null
#
require 'spec_helper'
diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb
index 456bf221d62..2f819f60cbb 100644
--- a/spec/models/key_spec.rb
+++ b/spec/models/key_spec.rb
@@ -32,6 +32,13 @@ describe Key do
describe "Methods" do
it { is_expected.to respond_to :projects }
+ it { is_expected.to respond_to :publishable_key }
+
+ describe "#publishable_keys" do
+ it 'strips all personal information' do
+ expect(build(:key).publishable_key).not_to match(/dummy@gitlab/)
+ end
+ end
end
context "validation of uniqueness" do
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 76f6d8c54c4..b91687bc09f 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -165,7 +165,7 @@ describe MergeRequest do
end
it_behaves_like 'an editable mentionable' do
- subject { create(:merge_request, source_project: project) }
+ subject { create(:merge_request) }
let(:backref_text) { "merge request #{subject.to_reference}" }
let(:set_mentionable_text) { ->(txt){ subject.description = txt } }
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index eba33dd510f..250d1e2da80 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -22,7 +22,7 @@ require 'spec_helper'
describe Note do
describe 'associations' do
it { is_expected.to belong_to(:project) }
- it { is_expected.to belong_to(:noteable).touch(true) }
+ it { is_expected.to belong_to(:noteable) }
it { is_expected.to belong_to(:author).class_name('User') }
end
diff --git a/spec/models/project_services/slack_service_spec.rb b/spec/models/project_services/slack_service_spec.rb
index 69466b11f09..97b60e19e40 100644
--- a/spec/models/project_services/slack_service_spec.rb
+++ b/spec/models/project_services/slack_service_spec.rb
@@ -67,7 +67,7 @@ describe SlackService do
opts = {
title: 'Awesome merge_request',
description: 'please fix',
- source_branch: 'stable',
+ source_branch: 'feature',
target_branch: 'master'
}
merge_service = MergeRequests::CreateService.new(project,
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 63091e913ff..2fcbd5ae108 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -21,12 +21,13 @@
# import_url :string(255)
# visibility_level :integer default(0), not null
# archived :boolean default(FALSE), not null
+# avatar :string(255)
# import_status :string(255)
# repository_size :float default(0.0)
# star_count :integer default(0), not null
# import_type :string(255)
# import_source :string(255)
-# avatar :string(255)
+# commit_count :integer default(0)
#
require 'spec_helper'
@@ -90,7 +91,6 @@ describe Project do
describe 'Respond to' do
it { is_expected.to respond_to(:url_to_repo) }
it { is_expected.to respond_to(:repo_exists?) }
- it { is_expected.to respond_to(:satellite) }
it { is_expected.to respond_to(:update_merge_requests) }
it { is_expected.to respond_to(:execute_hooks) }
it { is_expected.to respond_to(:name_with_namespace) }
@@ -111,14 +111,20 @@ describe Project do
expect(project.url_to_repo).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + 'somewhere.git')
end
- it 'returns the full web URL for this repo' do
- project = Project.new(path: 'somewhere')
- expect(project.web_url).to eq("#{Gitlab.config.gitlab.url}/somewhere")
+ describe "#web_url" do
+ let(:project) { create(:empty_project, path: "somewhere") }
+
+ it 'returns the full web URL for this repo' do
+ expect(project.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.namespace.path}/somewhere")
+ end
end
- it 'returns the web URL without the protocol for this repo' do
- project = Project.new(path: 'somewhere')
- expect(project.web_url_without_protocol).to eq("#{Gitlab.config.gitlab.url.split('://')[1]}/somewhere")
+ describe "#web_url_without_protocol" do
+ let(:project) { create(:empty_project, path: "somewhere") }
+
+ it 'returns the web URL without the protocol for this repo' do
+ expect(project.web_url_without_protocol).to eq("#{Gitlab.config.gitlab.url.split('://')[1]}/#{project.namespace.path}/somewhere")
+ end
end
describe 'last_activity methods' do
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index d25351b0f0e..d96244f23e0 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -36,13 +36,13 @@ describe Repository do
describe :can_be_merged? do
context 'mergeable branches' do
- subject { repository.can_be_merged?('feature', 'master') }
+ subject { repository.can_be_merged?('0b4bc9a49b562e85de7cc9e834518ea6828729b9', 'master') }
it { is_expected.to be_truthy }
end
context 'non-mergeable branches' do
- subject { repository.can_be_merged?('feature_conflict', 'feature') }
+ subject { repository.can_be_merged?('bb5206fee213d983da88c47f9cf4cc6caf9c66dc', 'feature') }
it { is_expected.to be_falsey }
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 76f16323e2f..876cfb1204a 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -57,6 +57,7 @@
# otp_backup_codes :text
# public_email :string(255) default(""), not null
# dashboard :integer default(0)
+# project_view :integer default(0)
#
require 'spec_helper'
@@ -183,6 +184,19 @@ describe User do
it { is_expected.to respond_to(:private_token) }
end
+ describe '#confirm' do
+ let(:user) { create(:user, confirmed_at: nil, unconfirmed_email: 'test@gitlab.com') }
+
+ it 'returns unconfirmed' do
+ expect(user.confirmed?).to be_falsey
+ end
+
+ it 'confirms a user' do
+ user.confirm!
+ expect(user.confirmed?).to be_truthy
+ end
+ end
+
describe '#to_reference' do
let(:user) { create(:user) }