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
path: root/spec
diff options
context:
space:
mode:
authorIzaak Alpert <ialpert@blackberry.com>2013-07-17 01:14:03 +0400
committerIzaak Alpert <ialpert@blackberry.com>2013-07-18 06:48:03 +0400
commitd99594273d57b2d5ed7c748b3185712960b89478 (patch)
tree5f5d6da6011465e3521c7c3ab09ec7a38dbef37a /spec
parent128f2845770b7a6d553ee764cdbbe63da5ba9e84 (diff)
Style changes from review with @randx
-Some changes around calling origional methods for !for_fork? merge requests. Other changes to follow Change-Id: I009c716ce2475b9efa3fd07aee9215fca7a1c150
Diffstat (limited to 'spec')
-rw-r--r--spec/factories.rb6
-rw-r--r--spec/factories_spec.rb5
-rw-r--r--spec/features/security/project_access_spec.rb1
-rw-r--r--spec/lib/gitlab/satellite/action_spec.rb6
-rw-r--r--spec/lib/gitlab/satellite/merge_action_spec.rb6
-rw-r--r--spec/observers/merge_request_observer_spec.rb1
-rw-r--r--spec/requests/api/projects_spec.rb74
-rw-r--r--spec/support/test_env.rb14
8 files changed, 47 insertions, 66 deletions
diff --git a/spec/factories.rb b/spec/factories.rb
index b5f786dcd4c..e657321c294 100644
--- a/spec/factories.rb
+++ b/spec/factories.rb
@@ -117,9 +117,9 @@ FactoryGirl.define do
source_branch "stable" # pretend bcf03b5d
st_commits do
[
- source_project.repository.commit('bcf03b5d').to_hash,
- source_project.repository.commit('bcf03b5d~1').to_hash,
- source_project.repository.commit('bcf03b5d~2').to_hash
+ source_project.repository.commit('bcf03b5d').to_hash,
+ source_project.repository.commit('bcf03b5d~1').to_hash,
+ source_project.repository.commit('bcf03b5d~2').to_hash
]
end
st_diffs do
diff --git a/spec/factories_spec.rb b/spec/factories_spec.rb
index d38ce3d1c7e..66bef0761c7 100644
--- a/spec/factories_spec.rb
+++ b/spec/factories_spec.rb
@@ -1,13 +1,12 @@
require 'spec_helper'
INVALID_FACTORIES = [
- :key_with_a_space_in_the_middle,
- :invalid_key,
+ :key_with_a_space_in_the_middle,
+ :invalid_key,
]
FactoryGirl.factories.map(&:name).each do |factory_name|
next if INVALID_FACTORIES.include?(factory_name)
-
describe "#{factory_name} factory" do
it 'should be valid' do
build(factory_name).should be_valid
diff --git a/spec/features/security/project_access_spec.rb b/spec/features/security/project_access_spec.rb
index e426e40bb5d..2071a014be6 100644
--- a/spec/features/security/project_access_spec.rb
+++ b/spec/features/security/project_access_spec.rb
@@ -21,7 +21,6 @@ describe "Application access" do
let(:reporter) { create(:user) }
before do
-
# full access
project.team << [master, :master]
diff --git a/spec/lib/gitlab/satellite/action_spec.rb b/spec/lib/gitlab/satellite/action_spec.rb
index e37edb9614b..5e0a825c3c3 100644
--- a/spec/lib/gitlab/satellite/action_spec.rb
+++ b/spec/lib/gitlab/satellite/action_spec.rb
@@ -1,12 +1,9 @@
require 'spec_helper'
describe 'Gitlab::Satellite::Action' do
-
-
let(:project) { create(:project_with_code) }
let(:user) { create(:user) }
-
describe '#prepare_satellite!' do
it 'create a repository with a parking branch and one remote: origin' do
@@ -50,11 +47,8 @@ describe 'Gitlab::Satellite::Action' do
repo.config['user.name'].should ==user.name
repo.config['user.email'].should ==user.email
end
-
-
end
-
describe '#in_locked_and_timed_satellite' do
it 'should make use of a lockfile' do
diff --git a/spec/lib/gitlab/satellite/merge_action_spec.rb b/spec/lib/gitlab/satellite/merge_action_spec.rb
index 3f6e5c35245..2478efe8493 100644
--- a/spec/lib/gitlab/satellite/merge_action_spec.rb
+++ b/spec/lib/gitlab/satellite/merge_action_spec.rb
@@ -11,7 +11,6 @@ describe 'Gitlab::Satellite::MergeAction' do
#these commits are quite close together, itended to make string diffs/format patches small
@close_commit1 = ['2_3_notes_fix', '8470d70da67355c9c009e4401746b1d5410af2e3']
@close_commit2 = ['scss_refactoring', 'f0f14c8eaba69ebddd766498a9d0b0e79becd633']
-
end
let(:project) { create(:project_with_code) }
@@ -53,7 +52,6 @@ describe 'Gitlab::Satellite::MergeAction' do
end
end
-
describe '#format_patch' do
context 'on fork' do
it 'should build a format patch' do
@@ -76,7 +74,6 @@ describe 'Gitlab::Satellite::MergeAction' do
end
end
-
describe '#diffs_between_satellite tested against diff_in_satellite' do
def is_a_matching_diff(diff, diffs)
@@ -109,7 +106,6 @@ describe 'Gitlab::Satellite::MergeAction' do
merge_request.source_branch = @master[0]
diffs = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite
-
merge_request.target_branch = @close_commit1[0]
merge_request.source_branch = @master[0]
diff = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diff_in_satellite
@@ -119,7 +115,6 @@ describe 'Gitlab::Satellite::MergeAction' do
end
end
-
describe '#can_be_merged?' do
context 'on fork' do
it 'return true or false depending on if something is mergable' do
@@ -145,5 +140,4 @@ describe 'Gitlab::Satellite::MergeAction' do
end
end
end
-
end \ No newline at end of file
diff --git a/spec/observers/merge_request_observer_spec.rb b/spec/observers/merge_request_observer_spec.rb
index a6efd96e450..3d6fff9c24e 100644
--- a/spec/observers/merge_request_observer_spec.rb
+++ b/spec/observers/merge_request_observer_spec.rb
@@ -90,7 +90,6 @@ describe MergeRequestObserver do
end
end
-
describe "Merge Request created" do
def self.it_should_be_valid_event
it { @event.should_not be_nil }
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index b728cfc9678..2de3dc55e40 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -15,8 +15,7 @@ describe API::API do
let!(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) }
let!(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) }
- before {
- project.team << [user, :reporter] }
+ before { project.team << [user, :reporter] }
describe "GET /projects" do
context "when unauthenticated" do
@@ -48,16 +47,16 @@ describe API::API do
it "should not create new project" do
expect {
post api("/projects", user2), name: 'foo'
- }.to change { Project.count }.by(0)
+ }.to change {Project.count}.by(0)
end
end
it "should create new project without path" do
- expect { post api("/projects", user), name: 'foo' }.to change { Project.count }.by(1)
+ expect { post api("/projects", user), name: 'foo' }.to change {Project.count}.by(1)
end
it "should not create new project without name" do
- expect { post api("/projects", user) }.to_not change { Project.count }
+ expect { post api("/projects", user) }.to_not change {Project.count}
end
it "should return a 400 error if name not given" do
@@ -91,17 +90,17 @@ describe API::API do
it "should assign attributes to project" do
project = attributes_for(:project, {
- description: Faker::Lorem.sentence,
- default_branch: 'stable',
- issues_enabled: false,
- wall_enabled: false,
- merge_requests_enabled: false,
- wiki_enabled: false
+ description: Faker::Lorem.sentence,
+ default_branch: 'stable',
+ issues_enabled: false,
+ wall_enabled: false,
+ merge_requests_enabled: false,
+ wiki_enabled: false
})
post api("/projects", user), project
- project.each_pair do |k, v|
+ project.each_pair do |k,v|
next if k == :path
json_response[k.to_s].should == v
end
@@ -127,11 +126,11 @@ describe API::API do
before { admin }
it "should create new project without path" do
- expect { post api("/projects/user/#{user.id}", admin), name: 'foo' }.to change { Project.count }.by(1)
+ expect { post api("/projects/user/#{user.id}", admin), name: 'foo' }.to change {Project.count}.by(1)
end
it "should not create new project without name" do
- expect { post api("/projects/user/#{user.id}", admin) }.to_not change { Project.count }
+ expect { post api("/projects/user/#{user.id}", admin) }.to_not change {Project.count}
end
it "should respond with 201 on success" do
@@ -146,17 +145,17 @@ describe API::API do
it "should assign attributes to project" do
project = attributes_for(:project, {
- description: Faker::Lorem.sentence,
- default_branch: 'stable',
- issues_enabled: false,
- wall_enabled: false,
- merge_requests_enabled: false,
- wiki_enabled: false
+ description: Faker::Lorem.sentence,
+ default_branch: 'stable',
+ issues_enabled: false,
+ wall_enabled: false,
+ merge_requests_enabled: false,
+ wiki_enabled: false
})
post api("/projects/user/#{user.id}", admin), project
- project.each_pair do |k, v|
+ project.each_pair do |k,v|
next if k == :path
json_response[k.to_s].should == v
end
@@ -269,7 +268,7 @@ describe API::API do
it "should add user to project team" do
expect {
post api("/projects/#{project.id}/members", user), user_id: user2.id,
- access_level: UsersProject::DEVELOPER
+ access_level: UsersProject::DEVELOPER
}.to change { UsersProject.count }.by(1)
response.status.should == 201
@@ -279,10 +278,10 @@ describe API::API do
it "should return a 201 status if user is already project member" do
post api("/projects/#{project.id}/members", user), user_id: user2.id,
- access_level: UsersProject::DEVELOPER
+ access_level: UsersProject::DEVELOPER
expect {
post api("/projects/#{project.id}/members", user), user_id: user2.id,
- access_level: UsersProject::DEVELOPER
+ access_level: UsersProject::DEVELOPER
}.not_to change { UsersProject.count }.by(1)
response.status.should == 201
@@ -413,8 +412,8 @@ describe API::API do
it "should add hook to project" do
expect {
post api("/projects/#{project.id}/hooks", user),
- url: "http://example.com"
- }.to change { project.hooks.count }.by(1)
+ url: "http://example.com"
+ }.to change {project.hooks.count}.by(1)
response.status.should == 201
end
@@ -432,7 +431,7 @@ describe API::API do
describe "PUT /projects/:id/hooks/:hook_id" do
it "should update an existing project hook" do
put api("/projects/#{project.id}/hooks/#{hook.id}", user),
- url: 'http://example.org'
+ url: 'http://example.org'
response.status.should == 200
json_response['url'].should == 'http://example.org'
end
@@ -457,7 +456,7 @@ describe API::API do
it "should delete hook from project" do
expect {
delete api("/projects/#{project.id}/hooks/#{hook.id}", user)
- }.to change { project.hooks.count }.by(-1)
+ }.to change {project.hooks.count}.by(-1)
response.status.should == 200
end
@@ -477,7 +476,6 @@ describe API::API do
end
end
-
describe "GET /projects/:id/snippets" do
it "should return an array of project snippets" do
get api("/projects/#{project.id}/snippets", user)
@@ -503,26 +501,26 @@ describe API::API do
describe "POST /projects/:id/snippets" do
it "should create a new project snippet" do
post api("/projects/#{project.id}/snippets", user),
- title: 'api test', file_name: 'sample.rb', code: 'test'
+ title: 'api test', file_name: 'sample.rb', code: 'test'
response.status.should == 201
json_response['title'].should == 'api test'
end
it "should return a 400 error if title is not given" do
post api("/projects/#{project.id}/snippets", user),
- file_name: 'sample.rb', code: 'test'
+ file_name: 'sample.rb', code: 'test'
response.status.should == 400
end
it "should return a 400 error if file_name not given" do
post api("/projects/#{project.id}/snippets", user),
- title: 'api test', code: 'test'
+ title: 'api test', code: 'test'
response.status.should == 400
end
it "should return a 400 error if code not given" do
post api("/projects/#{project.id}/snippets", user),
- title: 'api test', file_name: 'sample.rb'
+ title: 'api test', file_name: 'sample.rb'
response.status.should == 400
end
end
@@ -530,7 +528,7 @@ describe API::API do
describe "PUT /projects/:id/snippets/:shippet_id" do
it "should update an existing project snippet" do
put api("/projects/#{project.id}/snippets/#{snippet.id}", user),
- code: 'updated code'
+ code: 'updated code'
response.status.should == 200
json_response['title'].should == 'example'
snippet.reload.content.should == 'updated code'
@@ -538,7 +536,7 @@ describe API::API do
it "should update an existing project snippet with new title" do
put api("/projects/#{project.id}/snippets/#{snippet.id}", user),
- title: 'other api test'
+ title: 'other api test'
response.status.should == 200
json_response['title'].should == 'other api test'
end
@@ -600,7 +598,7 @@ describe API::API do
describe "POST /projects/:id/keys" do
it "should not create an invalid ssh key" do
- post api("/projects/#{project.id}/keys", user), {title: "invalid key"}
+ post api("/projects/#{project.id}/keys", user), { title: "invalid key" }
response.status.should == 404
end
@@ -608,7 +606,7 @@ describe API::API do
key_attrs = attributes_for :key
expect {
post api("/projects/#{project.id}/keys", user), key_attrs
- }.to change { project.deploy_keys.count }.by(1)
+ }.to change{ project.deploy_keys.count }.by(1)
end
end
@@ -618,7 +616,7 @@ describe API::API do
it "should delete existing key" do
expect {
delete api("/projects/#{project.id}/keys/#{deploy_key.id}", user)
- }.to change { project.deploy_keys.count }.by(-1)
+ }.to change{ project.deploy_keys.count }.by(-1)
end
it "should return 404 Not Found with invalid ID" do
diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb
index a0528d98d57..cae7ff88513 100644
--- a/spec/support/test_env.rb
+++ b/spec/support/test_env.rb
@@ -72,17 +72,17 @@ module TestEnv
)
Gitlab::Satellite::Satellite.any_instance.stub(
- exists?: true,
- destroy: true,
- create: true,
- lock_files_dir: repos_path
+ exists?: true,
+ destroy: true,
+ create: true,
+ lock_files_dir: repos_path
)
MergeRequest.any_instance.stub(
- check_if_can_be_merged: true
+ check_if_can_be_merged: true
)
Repository.any_instance.stub(
- size: 12.45
+ size: 12.45
)
end
@@ -170,6 +170,4 @@ module TestEnv
command = "git init --quiet --bare #{path};"
system(command)
end
-
-
end