Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-23 13:36:36 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-23 13:36:36 +0300
commit883438970df30ac7101d8f32b30007c4248c75d5 (patch)
tree3acd5df3b5275b373c16bc871dc1e553e00e8942 /spec/models
parenta8e4e6aaba762c61d0203e023148d999f8565d34 (diff)
parent779646ef38741dd30a51f57eed8818ab946fcae6 (diff)
Merge branch 'rubocop-for-tests' into 'master'
Enable rubocop for tests too cc @DouweM @rspeicher Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> See merge request !862
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/commit_range_spec.rb4
-rw-r--r--spec/models/deploy_keys_project_spec.rb4
-rw-r--r--spec/models/hooks/service_hook_spec.rb10
-rw-r--r--spec/models/hooks/system_hook_spec.rb20
-rw-r--r--spec/models/hooks/web_hook_spec.rb10
-rw-r--r--spec/models/project_security_spec.rb14
-rw-r--r--spec/models/project_services/hipchat_service_spec.rb6
-rw-r--r--spec/models/project_services/slack_service/issue_message_spec.rb4
-rw-r--r--spec/models/project_services/slack_service/merge_message_spec.rb4
-rw-r--r--spec/models/project_services/slack_service/push_message_spec.rb20
-rw-r--r--spec/models/project_team_spec.rb1
-rw-r--r--spec/models/project_wiki_spec.rb2
-rw-r--r--spec/models/service_spec.rb17
-rw-r--r--spec/models/wiki_page_spec.rb8
14 files changed, 55 insertions, 69 deletions
diff --git a/spec/models/commit_range_spec.rb b/spec/models/commit_range_spec.rb
index e3ab4812464..1031af097bd 100644
--- a/spec/models/commit_range_spec.rb
+++ b/spec/models/commit_range_spec.rb
@@ -60,11 +60,11 @@ describe CommitRange do
end
it 'includes the correct values for a three-dot range' do
- expect(range.to_param).to eq({from: sha_from, to: sha_to})
+ expect(range.to_param).to eq({ from: sha_from, to: sha_to })
end
it 'includes the correct values for a two-dot range' do
- expect(range2.to_param).to eq({from: sha_from + '^', to: sha_to})
+ expect(range2.to_param).to eq({ from: sha_from + '^', to: sha_to })
end
end
diff --git a/spec/models/deploy_keys_project_spec.rb b/spec/models/deploy_keys_project_spec.rb
index 705ef257d86..0eb22599d18 100644
--- a/spec/models/deploy_keys_project_spec.rb
+++ b/spec/models/deploy_keys_project_spec.rb
@@ -44,9 +44,7 @@ describe DeployKeysProject do
it "destroys the deploy key" do
subject.destroy
- expect {
- deploy_key.reload
- }.to raise_error(ActiveRecord::RecordNotFound)
+ expect { deploy_key.reload }.to raise_error(ActiveRecord::RecordNotFound)
end
end
end
diff --git a/spec/models/hooks/service_hook_spec.rb b/spec/models/hooks/service_hook_spec.rb
index a218b327d76..4c8b8910ae7 100644
--- a/spec/models/hooks/service_hook_spec.rb
+++ b/spec/models/hooks/service_hook_spec.rb
@@ -26,7 +26,7 @@ describe ServiceHook do
describe "execute" do
before(:each) do
@service_hook = create(:service_hook)
- @data = { project_id: 1, data: {}}
+ @data = { project_id: 1, data: {} }
WebMock.stub_request(:post, @service_hook.url)
end
@@ -34,7 +34,7 @@ describe ServiceHook do
it "POSTs to the web hook URL" do
@service_hook.execute(@data)
expect(WebMock).to have_requested(:post, @service_hook.url).with(
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Service Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Service Hook' }
).once
end
@@ -43,16 +43,14 @@ describe ServiceHook do
@service_hook.execute(@data)
expect(WebMock).to have_requested(:post, @service_hook.url).with(
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Service Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Service Hook' }
).once
end
it "catches exceptions" do
expect(WebHook).to receive(:post).and_raise("Some HTTP Post error")
- expect {
- @service_hook.execute(@data)
- }.to raise_error(RuntimeError)
+ expect { @service_hook.execute(@data) }.to raise_error(RuntimeError)
end
end
end
diff --git a/spec/models/hooks/system_hook_spec.rb b/spec/models/hooks/system_hook_spec.rb
index edb21fc2e47..4175f9dd88f 100644
--- a/spec/models/hooks/system_hook_spec.rb
+++ b/spec/models/hooks/system_hook_spec.rb
@@ -29,7 +29,7 @@ describe SystemHook do
Projects::CreateService.new(create(:user), name: 'empty').execute
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /project_create/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -39,7 +39,7 @@ describe SystemHook do
Projects::DestroyService.new(project, user, {}).execute
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /project_destroy/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -47,7 +47,7 @@ describe SystemHook do
create(:user)
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /user_create/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -56,7 +56,7 @@ describe SystemHook do
user.destroy
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /user_destroy/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -66,7 +66,7 @@ describe SystemHook do
project.team << [user, :master]
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /user_add_to_team/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -77,7 +77,7 @@ describe SystemHook do
project.project_members.destroy_all
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /user_remove_from_team/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -85,7 +85,7 @@ describe SystemHook do
create(:group)
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /group_create/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -94,7 +94,7 @@ describe SystemHook do
group.destroy
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /group_destroy/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -104,7 +104,7 @@ describe SystemHook do
group.add_user(user, Gitlab::Access::MASTER)
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /user_add_to_group/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
@@ -115,7 +115,7 @@ describe SystemHook do
group.group_members.destroy_all
expect(WebMock).to have_requested(:post, @system_hook.url).with(
body: /user_remove_from_group/,
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'System Hook' }
).once
end
diff --git a/spec/models/hooks/web_hook_spec.rb b/spec/models/hooks/web_hook_spec.rb
index b51e6b4e619..23f30881d99 100644
--- a/spec/models/hooks/web_hook_spec.rb
+++ b/spec/models/hooks/web_hook_spec.rb
@@ -47,7 +47,7 @@ describe ProjectHook do
@project_hook = create(:project_hook)
@project = create(:project)
@project.hooks << [@project_hook]
- @data = { before: 'oldrev', after: 'newrev', ref: 'ref'}
+ @data = { before: 'oldrev', after: 'newrev', ref: 'ref' }
WebMock.stub_request(:post, @project_hook.url)
end
@@ -55,7 +55,7 @@ describe ProjectHook do
it "POSTs to the web hook URL" do
@project_hook.execute(@data, 'push_hooks')
expect(WebMock).to have_requested(:post, @project_hook.url).with(
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Push Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Push Hook' }
).once
end
@@ -64,16 +64,14 @@ describe ProjectHook do
@project_hook.execute(@data, 'push_hooks')
expect(WebMock).to have_requested(:post, @project_hook.url).with(
- headers: {'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Push Hook'}
+ headers: { 'Content-Type'=>'application/json', 'X-Gitlab-Event'=>'Push Hook' }
).once
end
it "catches exceptions" do
expect(WebHook).to receive(:post).and_raise("Some HTTP Post error")
- expect {
- @project_hook.execute(@data, 'push_hooks')
- }.to raise_error(RuntimeError)
+ expect { @project_hook.execute(@data, 'push_hooks') }.to raise_error(RuntimeError)
end
end
end
diff --git a/spec/models/project_security_spec.rb b/spec/models/project_security_spec.rb
index 1ee19003543..f600a240c46 100644
--- a/spec/models/project_security_spec.rb
+++ b/spec/models/project_security_spec.rb
@@ -110,17 +110,3 @@ describe Project do
end
end
end
-# == Schema Information
-#
-# Table name: projects
-#
-# id :integer not null, primary key
-# name :string(255)
-# path :string(255)
-# description :text
-# created_at :datetime
-# updated_at :datetime
-# private_flag :boolean default(TRUE), not null
-# code :string(255)
-#
-
diff --git a/spec/models/project_services/hipchat_service_spec.rb b/spec/models/project_services/hipchat_service_spec.rb
index 8ed03dd1da8..4707673269a 100644
--- a/spec/models/project_services/hipchat_service_spec.rb
+++ b/spec/models/project_services/hipchat_service_spec.rb
@@ -241,17 +241,17 @@ describe HipchatService do
context "#message_options" do
it "should be set to the defaults" do
- expect(hipchat.send(:message_options)).to eq({notify: false, color: 'yellow'})
+ expect(hipchat.send(:message_options)).to eq({ notify: false, color: 'yellow' })
end
it "should set notfiy to true" do
allow(hipchat).to receive(:notify).and_return('1')
- expect(hipchat.send(:message_options)).to eq({notify: true, color: 'yellow'})
+ expect(hipchat.send(:message_options)).to eq({ notify: true, color: 'yellow' })
end
it "should set the color" do
allow(hipchat).to receive(:color).and_return('red')
- expect(hipchat.send(:message_options)).to eq({notify: false, color: 'red'})
+ expect(hipchat.send(:message_options)).to eq({ notify: false, color: 'red' })
end
end
end
diff --git a/spec/models/project_services/slack_service/issue_message_spec.rb b/spec/models/project_services/slack_service/issue_message_spec.rb
index 8bca1fef44c..b78d92f23a1 100644
--- a/spec/models/project_services/slack_service/issue_message_spec.rb
+++ b/spec/models/project_services/slack_service/issue_message_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe SlackService::IssueMessage do
subject { SlackService::IssueMessage.new(args) }
- let(:args) {
+ let(:args) do
{
user: {
name: 'Test User',
@@ -23,7 +23,7 @@ describe SlackService::IssueMessage do
description: 'issue description'
}
}
- }
+ end
let(:color) { '#345' }
diff --git a/spec/models/project_services/slack_service/merge_message_spec.rb b/spec/models/project_services/slack_service/merge_message_spec.rb
index aeb408aa766..581c50d6c88 100644
--- a/spec/models/project_services/slack_service/merge_message_spec.rb
+++ b/spec/models/project_services/slack_service/merge_message_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe SlackService::MergeMessage do
subject { SlackService::MergeMessage.new(args) }
- let(:args) {
+ let(:args) do
{
user: {
name: 'Test User',
@@ -24,7 +24,7 @@ describe SlackService::MergeMessage do
target_branch: 'target_branch',
}
}
- }
+ end
let(:color) { '#345' }
diff --git a/spec/models/project_services/slack_service/push_message_spec.rb b/spec/models/project_services/slack_service/push_message_spec.rb
index 10963481a12..ddc290820d1 100644
--- a/spec/models/project_services/slack_service/push_message_spec.rb
+++ b/spec/models/project_services/slack_service/push_message_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe SlackService::PushMessage do
subject { SlackService::PushMessage.new(args) }
- let(:args) {
+ let(:args) do
{
after: 'after',
before: 'before',
@@ -12,7 +12,7 @@ describe SlackService::PushMessage do
user_name: 'user_name',
project_url: 'url'
}
- }
+ end
let(:color) { '#345' }
@@ -40,16 +40,16 @@ describe SlackService::PushMessage do
end
context 'tag push' do
- let(:args) {
+ let(:args) do
{
- after: 'after',
- before: Gitlab::Git::BLANK_SHA,
- project_name: 'project_name',
- ref: 'refs/tags/new_tag',
- user_name: 'user_name',
- project_url: 'url'
+ after: 'after',
+ before: Gitlab::Git::BLANK_SHA,
+ project_name: 'project_name',
+ ref: 'refs/tags/new_tag',
+ user_name: 'user_name',
+ project_url: 'url'
}
- }
+ end
it 'returns a message regarding pushes' do
expect(subject.pretext).to eq('user_name pushed new tag ' \
diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb
index 19201cc15a7..d125166e336 100644
--- a/spec/models/project_team_spec.rb
+++ b/spec/models/project_team_spec.rb
@@ -67,4 +67,3 @@ describe ProjectTeam do
end
end
end
-
diff --git a/spec/models/project_wiki_spec.rb b/spec/models/project_wiki_spec.rb
index 2acdb7dfddc..f785203af7d 100644
--- a/spec/models/project_wiki_spec.rb
+++ b/spec/models/project_wiki_spec.rb
@@ -231,7 +231,7 @@ describe ProjectWiki do
end
def commit_details
- commit = {name: user.name, email: user.email, message: "test commit"}
+ commit = { name: user.name, email: user.email, message: "test commit" }
end
def create_page(name, content)
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index cb633216d3b..ca11758ee06 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -36,7 +36,7 @@ describe Service do
end
describe "Testable" do
- let (:project) { create :project }
+ let(:project) { create :project }
before do
allow(@service).to receive(:project).and_return(project)
@@ -49,7 +49,7 @@ describe Service do
end
describe "With commits" do
- let (:project) { create :project }
+ let(:project) { create :project }
before do
allow(@service).to receive(:project).and_return(project)
@@ -64,9 +64,16 @@ describe Service do
describe "Template" do
describe "for pushover service" do
- let(:service_template) {
- PushoverService.create(template: true, properties: {device: 'MyDevice', sound: 'mic', priority: 4, api_key: '123456789'})
- }
+ let(:service_template) do
+ PushoverService.create(
+ template: true,
+ properties: {
+ device: 'MyDevice',
+ sound: 'mic',
+ priority: 4,
+ api_key: '123456789'
+ })
+ end
let(:project) { create(:project) }
describe 'should be prefilled for projects pushover service' do
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index fceb7668cac..dc84a14bb40 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -43,7 +43,7 @@ describe WikiPage do
describe "validations" do
before do
- subject.attributes = {title: 'title', content: 'content'}
+ subject.attributes = { title: 'title', content: 'content' }
end
it "validates presence of title" do
@@ -58,7 +58,7 @@ describe WikiPage do
end
before do
- @wiki_attr = {title: "Index", content: "Home Page", format: "markdown"}
+ @wiki_attr = { title: "Index", content: "Home Page", format: "markdown" }
end
describe "#create" do
@@ -82,7 +82,7 @@ describe WikiPage do
let(:title) { 'Index v1.2.3' }
before do
- @wiki_attr = {title: title, content: "Home Page", format: "markdown"}
+ @wiki_attr = { title: title, content: "Home Page", format: "markdown" }
end
describe "#create" do
@@ -196,7 +196,7 @@ describe WikiPage do
end
def commit_details
- commit = {name: user.name, email: user.email, message: "test commit"}
+ commit = { name: user.name, email: user.email, message: "test commit" }
end
def create_page(name, content)