Commit f31d8ef2 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Merge commit '4c53cc0e' into...

Merge commit '4c53cc0e' into ci-and-ce-sitting-in-a-tree-k-i-s-s-i-n-g

* commit '4c53cc0e':
  rubocop satisfy

Conflicts:
	app/controllers/ci/builds_controller.rb
	app/controllers/ci/commits_controller.rb
parents 1ce85dc4 4c53cc0e
module Ci module Ci
class Admin::RunnersController < Ci::Admin::ApplicationController class Admin::RunnersController < Ci::Admin::ApplicationController
before_filter :runner, except: :index before_action :runner, except: :index
def index def index
@runners = Ci::Runner.order('id DESC') @runners = Ci::Runner.order('id DESC')
......
module Ci module Ci
class BuildsController < Ci::ApplicationController class BuildsController < Ci::ApplicationController
before_filter :authenticate_user!, except: [:status, :show] before_action :authenticate_user!, except: [:status, :show]
before_filter :authenticate_public_page!, only: :show before_action :authenticate_public_page!, only: :show
before_filter :project before_action :project
before_filter :authorize_access_project!, except: [:status, :show] before_action :authorize_access_project!, except: [:status, :show]
before_filter :authorize_manage_project!, except: [:status, :show, :retry, :cancel] before_action :authorize_manage_project!, except: [:status, :show, :retry, :cancel]
before_filter :authorize_manage_builds!, only: [:retry, :cancel] before_action :authorize_manage_builds!, only: [:retry, :cancel]
before_filter :build, except: [:show] before_action :build, except: [:show]
layout 'ci/build' layout 'ci/build'
def show def show
......
module Ci module Ci
class ChartsController < Ci::ApplicationController class ChartsController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :authorize_access_project! before_action :authorize_access_project!
before_filter :authorize_manage_project! before_action :authorize_manage_project!
layout 'ci/project' layout 'ci/project'
......
module Ci module Ci
class CommitsController < Ci::ApplicationController class CommitsController < Ci::ApplicationController
before_filter :authenticate_user!, except: [:status, :show] before_action :authenticate_user!, except: [:status, :show]
before_filter :authenticate_public_page!, only: :show before_action :authenticate_public_page!, only: :show
before_filter :project before_action :project
before_filter :authorize_access_project!, except: [:status, :show, :cancel] before_action :authorize_access_project!, except: [:status, :show, :cancel]
before_filter :authorize_manage_builds!, only: [:cancel] before_action :authorize_manage_builds!, only: [:cancel]
before_filter :commit, only: :show before_action :commit, only: :show
layout 'ci/commit' layout 'ci/commit'
def show def show
......
...@@ -2,9 +2,9 @@ module Ci ...@@ -2,9 +2,9 @@ module Ci
class EventsController < Ci::ApplicationController class EventsController < Ci::ApplicationController
EVENTS_PER_PAGE = 50 EVENTS_PER_PAGE = 50
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :authorize_manage_project! before_action :authorize_manage_project!
layout 'ci/project' layout 'ci/project'
......
module Ci module Ci
class LintsController < Ci::ApplicationController class LintsController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
def show def show
end end
......
...@@ -2,13 +2,13 @@ module Ci ...@@ -2,13 +2,13 @@ module Ci
class ProjectsController < Ci::ApplicationController class ProjectsController < Ci::ApplicationController
PROJECTS_BATCH = 100 PROJECTS_BATCH = 100
before_filter :authenticate_user!, except: [:build, :badge, :index, :show] before_action :authenticate_user!, except: [:build, :badge, :index, :show]
before_filter :authenticate_public_page!, only: :show before_action :authenticate_public_page!, only: :show
before_filter :project, only: [:build, :integration, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml] before_action :project, only: [:build, :integration, :show, :badge, :edit, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
before_filter :authorize_access_project!, except: [:build, :gitlab, :badge, :index, :show, :new, :create] before_action :authorize_access_project!, except: [:build, :gitlab, :badge, :index, :show, :new, :create]
before_filter :authorize_manage_project!, only: [:edit, :integration, :update, :destroy, :toggle_shared_runners, :dumped_yaml] before_action :authorize_manage_project!, only: [:edit, :integration, :update, :destroy, :toggle_shared_runners, :dumped_yaml]
before_filter :authenticate_token!, only: [:build] before_action :authenticate_token!, only: [:build]
before_filter :no_cache, only: [:badge] before_action :no_cache, only: [:badge]
protect_from_forgery except: :build protect_from_forgery except: :build
layout 'ci/project', except: [:index, :gitlab] layout 'ci/project', except: [:index, :gitlab]
......
module Ci module Ci
class RunnerProjectsController < Ci::ApplicationController class RunnerProjectsController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :authorize_manage_project! before_action :authorize_manage_project!
layout 'ci/project' layout 'ci/project'
......
module Ci module Ci
class RunnersController < Ci::ApplicationController class RunnersController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :set_runner, only: [:edit, :update, :destroy, :pause, :resume, :show] before_action :set_runner, only: [:edit, :update, :destroy, :pause, :resume, :show]
before_filter :authorize_access_project! before_action :authorize_access_project!
before_filter :authorize_manage_project! before_action :authorize_manage_project!
layout 'ci/project' layout 'ci/project'
......
module Ci module Ci
class ServicesController < Ci::ApplicationController class ServicesController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :authorize_access_project! before_action :authorize_access_project!
before_filter :authorize_manage_project! before_action :authorize_manage_project!
before_filter :service, only: [:edit, :update, :test] before_action :service, only: [:edit, :update, :test]
respond_to :html respond_to :html
......
module Ci module Ci
class TriggersController < Ci::ApplicationController class TriggersController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :authorize_access_project! before_action :authorize_access_project!
before_filter :authorize_manage_project! before_action :authorize_manage_project!
layout 'ci/project' layout 'ci/project'
......
module Ci module Ci
class VariablesController < Ci::ApplicationController class VariablesController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :authorize_access_project! before_action :authorize_access_project!
before_filter :authorize_manage_project! before_action :authorize_manage_project!
layout 'ci/project' layout 'ci/project'
......
module Ci module Ci
class WebHooksController < Ci::ApplicationController class WebHooksController < Ci::ApplicationController
before_filter :authenticate_user! before_action :authenticate_user!
before_filter :project before_action :project
before_filter :authorize_access_project! before_action :authorize_access_project!
before_filter :authorize_manage_project! before_action :authorize_manage_project!
layout 'ci/project' layout 'ci/project'
......
...@@ -13,13 +13,13 @@ module Ci ...@@ -13,13 +13,13 @@ module Ci
def dump def dump
success = case config["adapter"] success = case config["adapter"]
when /^mysql/ then when /^mysql/ then
$progress.print "Dumping MySQL database #{config['database']} ... " $progress.print "Dumping MySQL database #{config['database']} ... "
system('mysqldump', *mysql_args, config['database'], out: db_file_name) system('mysqldump', *mysql_args, config['database'], out: db_file_name)
when "postgresql" then when "postgresql" then
$progress.print "Dumping PostgreSQL database #{config['database']} ... " $progress.print "Dumping PostgreSQL database #{config['database']} ... "
pg_env pg_env
system('pg_dump', config['database'], out: db_file_name) system('pg_dump', config['database'], out: db_file_name)
end end
report_success(success) report_success(success)
abort 'Backup failed' unless success abort 'Backup failed' unless success
...@@ -27,17 +27,17 @@ module Ci ...@@ -27,17 +27,17 @@ module Ci
def restore def restore
success = case config["adapter"] success = case config["adapter"]
when /^mysql/ then when /^mysql/ then
$progress.print "Restoring MySQL database #{config['database']} ... " $progress.print "Restoring MySQL database #{config['database']} ... "
system('mysql', *mysql_args, config['database'], in: db_file_name) system('mysql', *mysql_args, config['database'], in: db_file_name)
when "postgresql" then when "postgresql" then
$progress.print "Restoring PostgreSQL database #{config['database']} ... " $progress.print "Restoring PostgreSQL database #{config['database']} ... "
# Drop all tables because PostgreSQL DB dumps do not contain DROP TABLE # Drop all tables because PostgreSQL DB dumps do not contain DROP TABLE
# statements like MySQL. # statements like MySQL.
drop_all_tables drop_all_tables
drop_all_postgres_sequences drop_all_postgres_sequences
pg_env pg_env
system('psql', config['database'], '-f', db_file_name) system('psql', config['database'], '-f', db_file_name)
end end
report_success(success) report_success(success)
abort 'Restore failed' unless success abort 'Restore failed' unless success
......
...@@ -8,12 +8,12 @@ describe Ci::ProjectsController do ...@@ -8,12 +8,12 @@ describe Ci::ProjectsController do
describe "POST #build" do describe "POST #build" do
it 'should respond 200 if params is ok' do it 'should respond 200 if params is ok' do
post :build, id: @project.id, post :build, id: @project.id,
ref: 'master', ref: 'master',
before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d', before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d',
after: '1c8a9df454ef68c22c2a33cca8232bb50849e5c5', after: '1c8a9df454ef68c22c2a33cca8232bb50849e5c5',
token: @project.token, token: @project.token,
ci_yaml_file: gitlab_ci_yaml, ci_yaml_file: gitlab_ci_yaml,
commits: [ { message: "Message" } ] commits: [ { message: "Message" } ]
expect(response).to be_success expect(response).to be_success
...@@ -22,10 +22,10 @@ describe Ci::ProjectsController do ...@@ -22,10 +22,10 @@ describe Ci::ProjectsController do
it 'should respond 400 if push about removed branch' do it 'should respond 400 if push about removed branch' do
post :build, id: @project.id, post :build, id: @project.id,
ref: 'master', ref: 'master',
before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d', before: '2aa371379db71ac89ae20843fcff3b3477cf1a1d',
after: '0000000000000000000000000000000000000000', after: '0000000000000000000000000000000000000000',
token: @project.token, token: @project.token,
ci_yaml_file: gitlab_ci_yaml ci_yaml_file: gitlab_ci_yaml
expect(response).not_to be_success expect(response).not_to be_success
......
...@@ -60,14 +60,14 @@ FactoryGirl.define do ...@@ -60,14 +60,14 @@ FactoryGirl.define do
factory :ci_commit_with_one_job do factory :ci_commit_with_one_job do
after(:create) do |commit, evaluator| after(:create) do |commit, evaluator|
commit.push_data[:ci_yaml_file] = YAML.dump({rspec: { script: "ls" }}) commit.push_data[:ci_yaml_file] = YAML.dump({ rspec: { script: "ls" } })
commit.save commit.save
end end
end end
factory :ci_commit_with_two_jobs do factory :ci_commit_with_two_jobs do
after(:create) do |commit, evaluator| after(:create) do |commit, evaluator|
commit.push_data[:ci_yaml_file] = YAML.dump({rspec: { script: "ls" }, spinach: { script: "ls" }}) commit.push_data[:ci_yaml_file] = YAML.dump({ rspec: { script: "ls" }, spinach: { script: "ls" } })
commit.save commit.save
end end
end end
......
...@@ -131,7 +131,7 @@ describe Ci::GitlabCiYamlProcessor do ...@@ -131,7 +131,7 @@ describe Ci::GitlabCiYamlProcessor do
image: "ruby:2.1", image: "ruby:2.1",
services: ["mysql"], services: ["mysql"],
before_script: ["pwd"], before_script: ["pwd"],
rspec: {image: "ruby:2.5", services: ["postgresql"], script: "rspec"} rspec: { image: "ruby:2.5", services: ["postgresql"], script: "rspec" }
}) })
config_processor = GitlabCiYamlProcessor.new(config) config_processor = GitlabCiYamlProcessor.new(config)
...@@ -176,133 +176,133 @@ describe Ci::GitlabCiYamlProcessor do ...@@ -176,133 +176,133 @@ describe Ci::GitlabCiYamlProcessor do
end end
it "returns errors if tags parameter is invalid" do it "returns errors if tags parameter is invalid" do
config = YAML.dump({rspec: {script: "test", tags: "mysql"}}) config = YAML.dump({ rspec: { script: "test", tags: "mysql" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: tags parameter should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: tags parameter should be an array of strings")
end end
it "returns errors if before_script parameter is invalid" do it "returns errors if before_script parameter is invalid" do
config = YAML.dump({before_script: "bundle update", rspec: {script: "test"}}) config = YAML.dump({ before_script: "bundle update", rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "before_script should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "before_script should be an array of strings")
end end
it "returns errors if image parameter is invalid" do it "returns errors if image parameter is invalid" do
config = YAML.dump({image: ["test"], rspec: {script: "test"}}) config = YAML.dump({ image: ["test"], rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "image should be a string") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "image should be a string")
end end
it "returns errors if job image parameter is invalid" do it "returns errors if job image parameter is invalid" do
config = YAML.dump({rspec: {script: "test", image: ["test"]}}) config = YAML.dump({rspec: { script: "test", image: ["test"] } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: image should be a string") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: image should be a string")
end end
it "returns errors if services parameter is not an array" do it "returns errors if services parameter is not an array" do
config = YAML.dump({services: "test", rspec: {script: "test"}}) config = YAML.dump({ services: "test", rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "services should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "services should be an array of strings")
end end
it "returns errors if services parameter is not an array of strings" do it "returns errors if services parameter is not an array of strings" do
config = YAML.dump({services: [10, "test"], rspec: {script: "test"}}) config = YAML.dump({ services: [10, "test"], rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "services should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "services should be an array of strings")
end end
it "returns errors if job services parameter is not an array" do it "returns errors if job services parameter is not an array" do
config = YAML.dump({rspec: {script: "test", services: "test"}}) config = YAML.dump({ rspec: { script: "test", services: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: services should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: services should be an array of strings")
end end
it "returns errors if job services parameter is not an array of strings" do it "returns errors if job services parameter is not an array of strings" do
config = YAML.dump({rspec: {script: "test", services: [10, "test"]}}) config = YAML.dump({ rspec: { script: "test", services: [10, "test"] } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: services should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: services should be an array of strings")
end end
it "returns errors if there are unknown parameters" do it "returns errors if there are unknown parameters" do
config = YAML.dump({extra: "bundle update"}) config = YAML.dump({ extra: "bundle update" })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Unknown parameter: extra") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Unknown parameter: extra")
end end
it "returns errors if there are unknown parameters that are hashes, but doesn't have a script" do it "returns errors if there are unknown parameters that are hashes, but doesn't have a script" do
config = YAML.dump({extra: {services: "test"}}) config = YAML.dump({ extra: {services: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Unknown parameter: extra") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Unknown parameter: extra")
end end
it "returns errors if there is no any jobs defined" do it "returns errors if there is no any jobs defined" do
config = YAML.dump({before_script: ["bundle update"]}) config = YAML.dump({ before_script: ["bundle update"] })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Please define at least one job") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "Please define at least one job")
end end
it "returns errors if job allow_failure parameter is not an boolean" do it "returns errors if job allow_failure parameter is not an boolean" do
config = YAML.dump({rspec: {script: "test", allow_failure: "string"}}) config = YAML.dump({ rspec: { script: "test", allow_failure: "string" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: allow_failure parameter should be an boolean") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: allow_failure parameter should be an boolean")
end end
it "returns errors if job stage is not a string" do it "returns errors if job stage is not a string" do
config = YAML.dump({rspec: {script: "test", type: 1, allow_failure: "string"}}) config = YAML.dump({ rspec: { script: "test", type: 1, allow_failure: "string" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
end end
it "returns errors if job stage is not a pre-defined stage" do it "returns errors if job stage is not a pre-defined stage" do
config = YAML.dump({rspec: {script: "test", type: "acceptance", allow_failure: "string"}}) config = YAML.dump({rspec: { script: "test", type: "acceptance", allow_failure: "string" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test, deploy")
end end
it "returns errors if job stage is not a defined stage" do it "returns errors if job stage is not a defined stage" do
config = YAML.dump({types: ["build", "test"], rspec: {script: "test", type: "acceptance", allow_failure: "string"}}) config = YAML.dump({ types: ["build", "test"], rspec: { script: "test", type: "acceptance", allow_failure: "string" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "rspec job: stage parameter should be build, test")
end end
it "returns errors if stages is not an array" do it "returns errors if stages is not an array" do
config = YAML.dump({types: "test", rspec: {script: "test"}}) config = YAML.dump({ types: "test", rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings")
end end
it "returns errors if stages is not an array of strings" do it "returns errors if stages is not an array of strings" do
config = YAML.dump({types: [true, "test"], rspec: {script: "test"}}) config = YAML.dump({ types: [true, "test"], rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "stages should be an array of strings")
end end
it "returns errors if variables is not a map" do it "returns errors if variables is not a map" do
config = YAML.dump({variables: "test", rspec: {script: "test"}}) config = YAML.dump({ variables: "test", rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables should be a map of key-valued strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables should be a map of key-valued strings")
end end
it "returns errors if variables is not a map of key-valued strings" do it "returns errors if variables is not a map of key-valued strings" do
config = YAML.dump({variables: {test: false}, rspec: {script: "test"}}) config = YAML.dump({ variables: { test: false }, rspec: { script: "test" } })
expect do expect do
GitlabCiYamlProcessor.new(config) GitlabCiYamlProcessor.new(config)
end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables should be a map of key-valued strings") end.to raise_error(GitlabCiYamlProcessor::ValidationError, "variables should be a map of key-valued strings")
......
...@@ -211,14 +211,14 @@ describe Ci::Build do ...@@ -211,14 +211,14 @@ describe Ci::Build do
end end
describe :options do describe :options do
let(:options) { let(:options) do
{ {
:image => "ruby:2.1", image: "ruby:2.1",
:services => [ services: [
"postgres" "postgres"
] ]
} }
} end
subject { build.options } subject { build.options }
it { is_expected.to eq(options) } it { is_expected.to eq(options) }
...@@ -308,20 +308,20 @@ describe Ci::Build do ...@@ -308,20 +308,20 @@ describe Ci::Build do
context 'returns variables' do context 'returns variables' do
subject { build.variables } subject { build.variables }
let(:variables) { let(:variables) do
[ [
{key: :DB_NAME, value: 'postgres', public: true} { key: :DB_NAME, value: 'postgres', public: true }
] ]
} end
it { is_expected.to eq(variables) } it { is_expected.to eq(variables) }
context 'and secure variables' do context 'and secure variables' do
let(:secure_variables) { let(:secure_variables) do
[ [
{key: 'SECRET_KEY', value: 'secret_value', public: false} { key: 'SECRET_KEY', value: 'secret_value', public: false }
] ]
} end
before do before do
build.project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value') build.project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value')
...@@ -332,11 +332,11 @@ describe Ci::Build do ...@@ -332,11 +332,11 @@ describe Ci::Build do
context 'and trigger variables' do context 'and trigger variables' do
let(:trigger) { FactoryGirl.create :ci_trigger, project: project } let(:trigger) { FactoryGirl.create :ci_trigger, project: project }
let(:trigger_request) { FactoryGirl.create :ci_trigger_request_with_variables, commit: commit, trigger: trigger } let(:trigger_request) { FactoryGirl.create :ci_trigger_request_with_variables, commit: commit, trigger: trigger }
let(:trigger_variables) { let(:trigger_variables) do
[ [
{key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false} { key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false }
] ]
} end
before do before do
build.trigger_request = trigger_request build.trigger_request = trigger_request
......
...@@ -75,12 +75,12 @@ describe Ci::MailService do ...@@ -75,12 +75,12 @@ describe Ci::MailService do
end end
describe 'successfull build and project has email_recipients' do describe 'successfull build and project has email_recipients' do
let(:project) { let(:project) do
FactoryGirl.create(:ci_project, FactoryGirl.create(:ci_project,
email_add_pusher: true, email_add_pusher: true,
email_only_broken_builds: false, email_only_broken_builds: false,
email_recipients: "jeroen@example.com") email_recipients: "jeroen@example.com")
} end
let(:commit) { FactoryGirl.create(:ci_commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) }
...@@ -103,12 +103,12 @@ describe Ci::MailService do ...@@ -103,12 +103,12 @@ describe Ci::MailService do
end end
describe 'successful build and notify only broken builds' do describe 'successful build and notify only broken builds' do
let(:project) { let(:project) do
FactoryGirl.create(:ci_project, FactoryGirl.create(:ci_project,
email_add_pusher: true, email_add_pusher: true,
email_only_broken_builds: true, email_only_broken_builds: true,
email_recipients: "jeroen@example.com") email_recipients: "jeroen@example.com")
} end
let(:commit) { FactoryGirl.create(:ci_commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) }
...@@ -131,12 +131,12 @@ describe Ci::MailService do ...@@ -131,12 +131,12 @@ describe Ci::MailService do
end end
describe 'successful build and can test service' do describe 'successful build and can test service' do
let(:project) { let(:project) do
FactoryGirl.create(:ci_project, FactoryGirl.create(:ci_project,
email_add_pusher: true, email_add_pusher: true,
email_only_broken_builds: false, email_only_broken_builds: false,
email_recipients: "jeroen@example.com") email_recipients: "jeroen@example.com")
} end
let(:commit) { FactoryGirl.create(:ci_commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) }
...@@ -153,12 +153,12 @@ describe Ci::MailService do ...@@ -153,12 +153,12 @@ describe Ci::MailService do
end end
describe 'retried build should not receive email' do describe 'retried build should not receive email' do
let(:project) { let(:project) do
FactoryGirl.create(:ci_project, FactoryGirl.create(:ci_project,
email_add_pusher: true, email_add_pusher: true,
email_only_broken_builds: true, email_only_broken_builds: true,
email_recipients: "jeroen@example.com") email_recipients: "jeroen@example.com")
} end
let(:commit) { FactoryGirl.create(:ci_commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:ci_build, status: :failed, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :failed, commit: commit) }
......
...@@ -94,33 +94,33 @@ describe Ci::Project do ...@@ -94,33 +94,33 @@ describe Ci::Project do
end end
describe '#broken_or_success?' do describe '#broken_or_success?' do
it { it do
project = FactoryGirl.create :ci_project, email_add_pusher: true project = FactoryGirl.create :ci_project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(true) allow(project).to receive(:broken?).and_return(true)
allow(project).to receive(:success?).and_return(true) allow(project).to receive(:success?).and_return(true)
expect(project.broken_or_success?).to eq(true) expect(project.broken_or_success?).to eq(true)
} end
it { it do
project = FactoryGirl.create :ci_project, email_add_pusher: true project = FactoryGirl.create :ci_project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(true) allow(project).to receive(:broken?).and_return(true)
allow(project).to receive(:success?).and_return(false) allow(project).to receive(:success?).and_return(false)
expect(project.broken_or_success?).to eq(true) expect(project.broken_or_success?).to eq(true)
} end
it { it do
project = FactoryGirl.create :ci_project, email_add_pusher: true project = FactoryGirl.create :ci_project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(false) allow(project).to receive(:broken?).and_return(false)
allow(project).to receive(:success?).and_return(true) allow(project).to receive(:success?).and_return(true)
expect(project.broken_or_success?).to eq(true) expect(project.broken_or_success?).to eq(true)
} end
it { it do
project = FactoryGirl.create :ci_project, email_add_pusher: true project = FactoryGirl.create :ci_project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(false) allow(project).to receive(:broken?).and_return(false)
allow(project).to receive(:success?).and_return(false) allow(project).to receive(:success?).and_return(false)
expect(project.broken_or_success?).to eq(false) expect(project.broken_or_success?).to eq(false)
} end
end end
describe 'Project.parse' do describe 'Project.parse' do
......
...@@ -20,7 +20,7 @@ describe Ci::API::API do ...@@ -20,7 +20,7 @@ describe Ci::API::API do
commit.create_builds commit.create_builds
build = commit.builds.first build = commit.builds.first
post api("/builds/register"), token: runner.token, info: {platform: :darwin} post api("/builds/register"), token: runner.token, info: { platform: :darwin }
expect(response.status).to eq(201) expect(response.status).to eq(201)
expect(json_response['sha']).to eq(build.sha) expect(json_response['sha']).to eq(build.sha)
...@@ -55,10 +55,10 @@ describe Ci::API::API do ...@@ -55,10 +55,10 @@ describe Ci::API::API do
commit = FactoryGirl.create(:ci_commit, project: project) commit = FactoryGirl.create(:ci_commit, project: project)
commit.create_builds commit.create_builds
post api("/builds/register"), token: runner.token, info: {platform: :darwin} post api("/builds/register"), token: runner.token, info: { platform: :darwin }
expect(response.status).to eq(201) expect(response.status).to eq(201)
expect(json_response["options"]).to eq({"image" => "ruby:2.1", "services" => ["postgres"]}) expect(json_response["options"]).to eq({ "image" => "ruby:2.1", "services" => ["postgres"] })
end end
it "returns variables" do it "returns variables" do
...@@ -66,12 +66,12 @@ describe Ci::API::API do ...@@ -66,12 +66,12 @@ describe Ci::API::API do
commit.create_builds commit.create_builds
project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value") project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value")
post api("/builds/register"), token: runner.token, info: {platform: :darwin} post api("/builds/register"), token: runner.token, info: { platform: :darwin }
expect(response.status).to eq(201) expect(response.status).to eq(201)
expect(json_response["variables"]).to eq([ expect(json_response["variables"]).to eq([
{"key" => "DB_NAME", "value" => "postgres", "public" => true}, { "key" => "DB_NAME", "value" => "postgres", "public" => true },
{"key" => "SECRET_KEY", "value" => "secret_value", "public" => false}, { "key" => "SECRET_KEY", "value" => "secret_value", "public" => false },
]) ])
end end
...@@ -83,13 +83,13 @@ describe Ci::API::API do ...@@ -83,13 +83,13 @@ describe Ci::API::API do
commit.create_builds(trigger_request) commit.create_builds(trigger_request)
project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value") project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value")
post api("/builds/register"), token: runner.token, info: {platform: :darwin} post api("/builds/register"), token: runner.token, info: { platform: :darwin }
expect(response.status).to eq(201) expect(response.status).to eq(201)
expect(json_response["variables"]).to eq([ expect(json_response["variables"]).to eq([
{"key" => "DB_NAME", "value" => "postgres", "public" => true}, { "key" => "DB_NAME", "value" => "postgres", "public" => true },
{"key" => "SECRET_KEY", "value" => "secret_value", "public" => false}, { "key" => "SECRET_KEY", "value" => "secret_value", "public" => false },
{"key" => "TRIGGER_KEY", "value" => "TRIGGER_VALUE", "public" => false}, { "key" => "TRIGGER_KEY", "value" => "TRIGGER_VALUE", "public" => false },
]) ])
end end
end end
......
...@@ -6,12 +6,12 @@ describe Ci::API::API, 'Commits' do ...@@ -6,12 +6,12 @@ describe Ci::API::API, 'Commits' do
let(:project) { FactoryGirl.create(:ci_project) } let(:project) { FactoryGirl.create(:ci_project) }
let(:commit) { FactoryGirl.create(:ci_commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:options) { let(:options) do
{ {
project_token: project.token, project_token: project.token,
project_id: project.id project_id: project.id
} }
} end
describe "GET /commits" do describe "GET /commits" do
before { commit } before { commit }
...@@ -27,7 +27,7 @@ describe Ci::API::API, 'Commits' do ...@@ -27,7 +27,7 @@ describe Ci::API::API, 'Commits' do
end end
describe "POST /commits" do describe "POST /commits" do
let(:data) { let(:data) do
{ {
"before" => "95790bf891e76fee5e1747ab589903a6a1f80f22", "before" => "95790bf891e76fee5e1747ab589903a6a1f80f22",
"after" => "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "after" => "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
...@@ -46,7 +46,7 @@ describe Ci::API::API, 'Commits' do ...@@ -46,7 +46,7 @@ describe Ci::API::API, 'Commits' do
], ],
ci_yaml_file: gitlab_ci_yaml ci_yaml_file: gitlab_ci_yaml
} }
} end
it "should create a build" do it "should create a build" do
post api("/commits"), options.merge(data: data) post api("/commits"), options.merge(data: data)
......
...@@ -7,20 +7,20 @@ describe Ci::API::API do ...@@ -7,20 +7,20 @@ describe Ci::API::API do
let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:gitlab_url) { GitlabCi.config.gitlab_server.url }
let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] } let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] }
let(:options) { let(:options) do
{ {
private_token: private_token, private_token: private_token,
url: gitlab_url url: gitlab_url
} }
} end
before { before do
stub_gitlab_calls stub_gitlab_calls
} end
describe "POST /forks" do describe "POST /forks" do
let(:project_info) { let(:project_info) do
{ {
project_id: project.gitlab_id, project_id: project.gitlab_id,
project_token: project.token, project_token: project.token,
...@@ -32,7 +32,7 @@ describe Ci::API::API do ...@@ -32,7 +32,7 @@ describe Ci::API::API do
ssh_url_to_repo: "git@example.com:gitlab-org/underscore" ssh_url_to_repo: "git@example.com:gitlab-org/underscore"
} }
} }
} end
context "with valid info" do context "with valid info" do
before do before do
......
...@@ -6,16 +6,16 @@ describe Ci::API::API do ...@@ -6,16 +6,16 @@ describe Ci::API::API do
let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:gitlab_url) { GitlabCi.config.gitlab_server.url }
let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] } let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] }
let(:options) { let(:options) do
{ {
private_token: private_token, private_token: private_token,
url: gitlab_url url: gitlab_url
} }
} end
before { before do
stub_gitlab_calls stub_gitlab_calls
} end
context "requests for scoped projects" do context "requests for scoped projects" do
# NOTE: These ids are tied to the actual projects on demo.gitlab.com # NOTE: These ids are tied to the actual projects on demo.gitlab.com
...@@ -75,7 +75,7 @@ describe Ci::API::API do ...@@ -75,7 +75,7 @@ describe Ci::API::API do
end end
context "Invalid Webhook URL" do context "Invalid Webhook URL" do
let!(:webhook) { {web_hook: "ala_ma_kota" } } let!(:webhook) { { web_hook: "ala_ma_kota" } }
before do before do
options.merge!(webhook) options.merge!(webhook)
...@@ -116,7 +116,7 @@ describe Ci::API::API do ...@@ -116,7 +116,7 @@ describe Ci::API::API do
describe "PUT /projects/:id" do describe "PUT /projects/:id" do
let!(:project) { FactoryGirl.create(:ci_project) } let!(:project) { FactoryGirl.create(:ci_project) }
let!(:project_info) { {name: "An updated name!" } } let!(:project_info) { { name: "An updated name!" } }
before do before do
options.merge!(project_info) options.merge!(project_info)
...@@ -163,14 +163,14 @@ describe Ci::API::API do ...@@ -163,14 +163,14 @@ describe Ci::API::API do
end end
describe "POST /projects" do describe "POST /projects" do
let(:project_info) { let(:project_info) do
{ {
name: "My project", name: "My project",
gitlab_id: 1, gitlab_id: 1,
path: "testing/testing", path: "testing/testing",
ssh_url_to_repo: "ssh://example.com/testing/testing.git" ssh_url_to_repo: "ssh://example.com/testing/testing.git"
} }
} end
let(:invalid_project_info) { {} } let(:invalid_project_info) { {} }
......
...@@ -4,19 +4,19 @@ describe Ci::API::API do ...@@ -4,19 +4,19 @@ describe Ci::API::API do
include ApiHelpers include ApiHelpers
include StubGitlabCalls include StubGitlabCalls
before { before do
stub_gitlab_calls stub_gitlab_calls
} end
describe "GET /runners" do describe "GET /runners" do
let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:gitlab_url) { GitlabCi.config.gitlab_server.url }
let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] } let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] }
let(:options) { let(:options) do
{ {
:private_token => private_token, private_token: private_token,
:url => gitlab_url url: gitlab_url
} }
} end
before do before do
5.times { FactoryGirl.create(:ci_runner) } 5.times { FactoryGirl.create(:ci_runner) }
......
...@@ -50,9 +50,9 @@ describe Ci::API::API do ...@@ -50,9 +50,9 @@ describe Ci::API::API do
end end
context 'Validates variables' do context 'Validates variables' do
let(:variables) { let(:variables) do
{'TRIGGER_KEY' => 'TRIGGER_VALUE'} { 'TRIGGER_KEY' => 'TRIGGER_VALUE' }
} end
it 'should validate variables to be a hash' do it 'should validate variables to be a hash' do
post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: 'value') post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: 'value')
...@@ -61,7 +61,7 @@ describe Ci::API::API do ...@@ -61,7 +61,7 @@ describe Ci::API::API do
end end
it 'should validate variables needs to be a map of key-valued strings' do it 'should validate variables needs to be a map of key-valued strings' do
post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: {key: %w(1 2)}) post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: { key: %w(1 2) })
expect(response.status).to eq(400) expect(response.status).to eq(400)
expect(json_response['message']).to eq('variables needs to be a map of key-valued strings') expect(json_response['message']).to eq('variables needs to be a map of key-valued strings')
end end
......
...@@ -36,7 +36,7 @@ describe Ci::CreateCommitService do ...@@ -36,7 +36,7 @@ describe Ci::CreateCommitService do
end end
it "creates commit if there is no appropriate job but deploy job has right ref setting" do it "creates commit if there is no appropriate job but deploy job has right ref setting" do
config = YAML.dump({deploy: {deploy: "ls", only: ["0_1"]}}) config = YAML.dump({ deploy: { deploy: "ls", only: ["0_1"] } })
result = service.execute(project, result = service.execute(project,
ref: 'refs/heads/0_1', ref: 'refs/heads/0_1',
...@@ -51,7 +51,7 @@ describe Ci::CreateCommitService do ...@@ -51,7 +51,7 @@ describe Ci::CreateCommitService do
describe :ci_skip? do describe :ci_skip? do
it "skips builds creation if there is [ci skip] tag in commit message" do it "skips builds creation if there is [ci skip] tag in commit message" do
commits = [{message: "some message[ci skip]"}] commits = [{ message: "some message[ci skip]" }]
commit = service.execute(project, commit = service.execute(project,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
before: '00000000', before: '00000000',
...@@ -64,7 +64,7 @@ describe Ci::CreateCommitService do ...@@ -64,7 +64,7 @@ describe Ci::CreateCommitService do
end end
it "does not skips builds creation if there is no [ci skip] tag in commit message" do it "does not skips builds creation if there is no [ci skip] tag in commit message" do
commits = [{message: "some message"}] commits = [{ message: "some message" }]
commit = service.execute(project, commit = service.execute(project,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
...@@ -78,7 +78,7 @@ describe Ci::CreateCommitService do ...@@ -78,7 +78,7 @@ describe Ci::CreateCommitService do
end end
it "skips builds creation if there is [ci skip] tag in commit message and yaml is invalid" do it "skips builds creation if there is [ci skip] tag in commit message and yaml is invalid" do
commits = [{message: "some message[ci skip]"}] commits = [{ message: "some message[ci skip]" }]
commit = service.execute(project, commit = service.execute(project,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
before: '00000000', before: '00000000',
...@@ -92,7 +92,7 @@ describe Ci::CreateCommitService do ...@@ -92,7 +92,7 @@ describe Ci::CreateCommitService do
end end
it "skips build creation if there are already builds" do it "skips build creation if there are already builds" do
commits = [{message: "message"}] commits = [{ message: "message" }]
commit = service.execute(project, commit = service.execute(project,
ref: 'refs/heads/master', ref: 'refs/heads/master',
before: '00000000', before: '00000000',
...@@ -113,7 +113,7 @@ describe Ci::CreateCommitService do ...@@ -113,7 +113,7 @@ describe Ci::CreateCommitService do
end end
it "creates commit with failed status if yaml is invalid" do it "creates commit with failed status if yaml is invalid" do
commits = [{message: "some message"}] commits = [{ message: "some message" }]
commit = service.execute(project, commit = service.execute(project,
ref: 'refs/tags/0_1', ref: 'refs/tags/0_1',
......
...@@ -23,21 +23,21 @@ module StubGitlabCalls ...@@ -23,21 +23,21 @@ module StubGitlabCalls
f = File.read(Rails.root.join('spec/support/gitlab_stubs/session.json')) f = File.read(Rails.root.join('spec/support/gitlab_stubs/session.json'))
stub_request(:post, "#{gitlab_url}api/v3/session.json"). stub_request(:post, "#{gitlab_url}api/v3/session.json").
with(:body => "{\"email\":\"test@test.com\",\"password\":\"123456\"}", with(body: "{\"email\":\"test@test.com\",\"password\":\"123456\"}",
:headers => {'Content-Type'=>'application/json'}). headers: {'Content-Type'=>'application/json'}).
to_return(:status => 201, :body => f, :headers => {'Content-Type'=>'application/json'}) to_return(status: 201, body: f, headers: {'Content-Type'=>'application/json'})
end end
def stub_user def stub_user
f = File.read(Rails.root.join('spec/support/gitlab_stubs/user.json')) f = File.read(Rails.root.join('spec/support/gitlab_stubs/user.json'))
stub_request(:get, "#{gitlab_url}api/v3/user?private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:get, "#{gitlab_url}api/v3/user?private_token=Wvjy2Krpb7y8xi93owUz").
with(:headers => {'Content-Type'=>'application/json'}). with(headers: {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => f, :headers => {'Content-Type'=>'application/json'}) to_return(status: 200, body: f, headers: {'Content-Type'=>'application/json'})
stub_request(:get, "#{gitlab_url}api/v3/user?access_token=some_token"). stub_request(:get, "#{gitlab_url}api/v3/user?access_token=some_token").
with(:headers => {'Content-Type'=>'application/json'}). with(headers: {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => f, :headers => {'Content-Type'=>'application/json'}) to_return(status: 200, body: f, headers: {'Content-Type'=>'application/json'})
end end
def stub_project_8 def stub_project_8
...@@ -54,24 +54,24 @@ module StubGitlabCalls ...@@ -54,24 +54,24 @@ module StubGitlabCalls
f = File.read(Rails.root.join('spec/support/gitlab_stubs/projects.json')) f = File.read(Rails.root.join('spec/support/gitlab_stubs/projects.json'))
stub_request(:get, "#{gitlab_url}api/v3/projects.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:get, "#{gitlab_url}api/v3/projects.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz").
with(:headers => {'Content-Type'=>'application/json'}). with(headers: {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => f, :headers => {'Content-Type'=>'application/json'}) to_return(status: 200, body: f, headers: {'Content-Type'=>'application/json'})
end end
def stub_projects_owned def stub_projects_owned
stub_request(:get, "#{gitlab_url}api/v3/projects/owned.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:get, "#{gitlab_url}api/v3/projects/owned.json?archived=false&ci_enabled_first=true&private_token=Wvjy2Krpb7y8xi93owUz").
with(:headers => {'Content-Type'=>'application/json'}). with(headers: {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => "", :headers => {}) to_return(status: 200, body: "", headers: {})
end end
def stub_ci_enable def stub_ci_enable
stub_request(:put, "#{gitlab_url}api/v3/projects/2/services/gitlab-ci.json?private_token=Wvjy2Krpb7y8xi93owUz"). stub_request(:put, "#{gitlab_url}api/v3/projects/2/services/gitlab-ci.json?private_token=Wvjy2Krpb7y8xi93owUz").
with(:headers => {'Content-Type'=>'application/json'}). with(headers: {'Content-Type'=>'application/json'}).
to_return(:status => 200, :body => "", :headers => {}) to_return(status: 200, body: "", headers: {})
end end
def project_hash_array def project_hash_array
f = File.read(Rails.root.join('spec/support/gitlab_stubs/projects.json')) f = File.read(Rails.root.join('spec/support/gitlab_stubs/projects.json'))
return JSON.parse f JSON.parse f
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment