Commit cc4ef4da authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Refactor CI tests

parent 76c6aeb9
require "spec_helper" require "spec_helper"
describe ProjectsController do describe Ci::ProjectsController do
before do before do
@project = FactoryGirl.create :project @project = FactoryGirl.create :ci_project
end end
describe "POST #build" do describe "POST #build" do
...@@ -55,25 +55,25 @@ describe ProjectsController do ...@@ -55,25 +55,25 @@ describe ProjectsController do
end end
let(:user) do let(:user) do
User.new(user_data) Ci::User.new(user_data)
end end
it "creates project" do it "creates project" do
allow(controller).to receive(:reset_cache) { true } allow(controller).to receive(:reset_cache) { true }
allow(controller).to receive(:current_user) { user } allow(controller).to receive(:current_user) { user }
Network.any_instance.stub(:enable_ci).and_return(true) allow_any_instance_of(Ci::Network).to receive(:enable_ci).and_return(true)
Network.any_instance.stub(:project_hooks).and_return(true) allow_any_instance_of(Ci::Network).to receive(:project_hooks).and_return(true)
post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access
expect(response.code).to eq('302') expect(response.code).to eq('302')
expect(assigns(:project)).not_to be_a_new(Project) expect(assigns(:project)).not_to be_a_new(Ci::Project)
end end
it "shows error" do it "shows error" do
allow(controller).to receive(:reset_cache) { true } allow(controller).to receive(:reset_cache) { true }
allow(controller).to receive(:current_user) { user } allow(controller).to receive(:current_user) { user }
User.any_instance.stub(:can_manage_project?).and_return(false) allow_any_instance_of(Ci::User).to receive(:can_manage_project?).and_return(false)
post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access post :create, { project: JSON.dump(project_dump.to_h) }.with_indifferent_access
...@@ -91,13 +91,13 @@ describe ProjectsController do ...@@ -91,13 +91,13 @@ describe ProjectsController do
end end
let(:user) do let(:user) do
User.new(user_data) Ci::User.new(user_data)
end end
it "searches projects" do it "searches projects" do
allow(controller).to receive(:reset_cache) { true } allow(controller).to receive(:reset_cache) { true }
allow(controller).to receive(:current_user) { user } allow(controller).to receive(:current_user) { user }
Network.any_instance.should_receive(:projects).with(hash_including(search: 'str'), :authorized) allow_any_instance_of(Ci::Network).to receive(:projects).with(hash_including(search: 'str'), :authorized)
xhr :get, :gitlab, { search: "str", format: "js" }.with_indifferent_access xhr :get, :gitlab, { search: "str", format: "js" }.with_indifferent_access
......
# Read about factories at https://github.com/thoughtbot/factory_girl # Read about factories at https://github.com/thoughtbot/factory_girl
FactoryGirl.define do FactoryGirl.define do
factory :trigger_request do factory :ci_trigger_request do
factory :trigger_request_with_variables do factory :ci_trigger_request_with_variables do
variables do variables do
{ {
TRIGGER_KEY: 'TRIGGER_VALUE' TRIGGER_KEY: 'TRIGGER_VALUE'
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
FactoryGirl.define do FactoryGirl.define do
factory :ci_trigger_without_token, class: Ci::Trigger do factory :ci_trigger_without_token, class: Ci::Trigger do
factory :trigger do factory :ci_trigger do
token 'token' token 'token'
end end
end end
......
require 'spec_helper' require 'spec_helper'
describe ApplicationHelper do describe Ci::ApplicationHelper do
describe "#duration_in_words" do describe "#duration_in_words" do
it "returns minutes and seconds" do it "returns minutes and seconds" do
intervals_in_words = { intervals_in_words = {
......
require 'spec_helper' require 'spec_helper'
describe RunnersHelper do describe Ci::RunnersHelper do
it "returns - not contacted yet" do it "returns - not contacted yet" do
runner = FactoryGirl.build :runner runner = FactoryGirl.build :runner
runner_status_icon(runner).should include("not connected yet") runner_status_icon(runner).should include("not connected yet")
......
require 'spec_helper' require 'spec_helper'
describe UserHelper do describe Ci::UserHelper do
describe :user_avatar_url do describe :user_avatar_url do
let (:user) { User.new({'avatar_url' => avatar_url}) } let (:user) { User.new({'avatar_url' => avatar_url}) }
......
require 'spec_helper' require 'spec_helper'
describe UserSessionsHelper do describe Ci::UserSessionsHelper do
describe :generate_oauth_hmac do describe :generate_oauth_hmac do
let (:salt) { 'a' } let (:salt) { 'a' }
let (:salt2) { 'b' } let (:salt2) { 'b' }
......
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
require 'spec_helper' require 'spec_helper'
describe Build do describe Ci::Build do
let(:project) { FactoryGirl.create :project } let(:project) { FactoryGirl.create :ci_project }
let(:commit) { FactoryGirl.create :commit, project: project } let(:commit) { FactoryGirl.create :ci_commit, project: project }
let(:build) { FactoryGirl.create :build, commit: commit } let(:build) { FactoryGirl.create :ci_build, commit: commit }
it { should belong_to(:commit) } it { should belong_to(:commit) }
it { should validate_presence_of :status } it { should validate_presence_of :status }
...@@ -40,12 +40,12 @@ describe Build do ...@@ -40,12 +40,12 @@ describe Build do
it { should respond_to :trace_html } it { should respond_to :trace_html }
describe :first_pending do describe :first_pending do
let(:first) { FactoryGirl.create :build, commit: commit, status: 'pending', created_at: Date.yesterday } let(:first) { FactoryGirl.create :ci_build, commit: commit, status: 'pending', created_at: Date.yesterday }
let(:second) { FactoryGirl.create :build, commit: commit, status: 'pending' } let(:second) { FactoryGirl.create :ci_build, commit: commit, status: 'pending' }
before { first; second } before { first; second }
subject { Build.first_pending } subject { Ci::Build.first_pending }
it { should be_a(Build) } it { should be_a(Ci::Build) }
it('returns with the first pending build') { should eq(first) } it('returns with the first pending build') { should eq(first) }
end end
...@@ -54,12 +54,12 @@ describe Build do ...@@ -54,12 +54,12 @@ describe Build do
build.status = 'success' build.status = 'success'
build.save build.save
end end
let(:create_from_build) { Build.create_from build } let(:create_from_build) { Ci::Build.create_from build }
it ('there should be a pending task') do it ('there should be a pending task') do
expect(Build.pending.count(:all)).to eq 0 expect(Ci::Build.pending.count(:all)).to eq 0
create_from_build create_from_build
expect(Build.pending.count(:all)).to be > 0 expect(Ci::Build.pending.count(:all)).to be > 0
end end
end end
...@@ -69,14 +69,14 @@ describe Build do ...@@ -69,14 +69,14 @@ describe Build do
context 'without started_at' do context 'without started_at' do
before { build.started_at = nil } before { build.started_at = nil }
it { should be_false } it { should be_falsey }
end end
%w(running success failed).each do |status| %w(running success failed).each do |status|
context "if build status is #{status}" do context "if build status is #{status}" do
before { build.status = status } before { build.status = status }
it { should be_true } it { should be_truthy }
end end
end end
...@@ -84,7 +84,7 @@ describe Build do ...@@ -84,7 +84,7 @@ describe Build do
context "if build status is #{status}" do context "if build status is #{status}" do
before { build.status = status } before { build.status = status }
it { should be_false } it { should be_falsey }
end end
end end
end end
...@@ -96,7 +96,7 @@ describe Build do ...@@ -96,7 +96,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
it { should be_true } it { should be_truthy }
end end
end end
...@@ -104,7 +104,7 @@ describe Build do ...@@ -104,7 +104,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
it { should be_false } it { should be_falsey }
end end
end end
end end
...@@ -116,7 +116,7 @@ describe Build do ...@@ -116,7 +116,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
it { should be_true } it { should be_truthy }
end end
end end
...@@ -124,7 +124,7 @@ describe Build do ...@@ -124,7 +124,7 @@ describe Build do
context "if build.status is #{state}" do context "if build.status is #{state}" do
before { build.status = state } before { build.status = state }
it { should be_false } it { should be_falsey }
end end
end end
end end
...@@ -138,13 +138,13 @@ describe Build do ...@@ -138,13 +138,13 @@ describe Build do
context 'and build.status is success' do context 'and build.status is success' do
before { build.status = 'success' } before { build.status = 'success' }
it { should be_false } it { should be_falsey }
end end
context 'and build.status is failed' do context 'and build.status is failed' do
before { build.status = 'failed' } before { build.status = 'failed' }
it { should be_false } it { should be_falsey }
end end
end end
...@@ -154,13 +154,13 @@ describe Build do ...@@ -154,13 +154,13 @@ describe Build do
context 'and build.status is success' do context 'and build.status is success' do
before { build.status = 'success' } before { build.status = 'success' }
it { should be_false } it { should be_falsey }
end end
context 'and build.status is failed' do context 'and build.status is failed' do
before { build.status = 'failed' } before { build.status = 'failed' }
it { should be_true } it { should be_truthy }
end end
end end
end end
...@@ -324,14 +324,14 @@ describe Build do ...@@ -324,14 +324,14 @@ describe Build do
} }
before do before do
build.project.variables << Variable.new(key: 'SECRET_KEY', value: 'secret_value') build.project.variables << Ci::Variable.new(key: 'SECRET_KEY', value: 'secret_value')
end end
it { should eq(variables + secure_variables) } it { should eq(variables + secure_variables) }
context 'and trigger variables' do context 'and trigger variables' do
let(:trigger) { FactoryGirl.create :trigger, project: project } let(:trigger) { FactoryGirl.create :ci_trigger, project: project }
let(:trigger_request) { FactoryGirl.create :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) {
[ [
{key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false} {key: :TRIGGER_KEY, value: 'TRIGGER_VALUE', public: false}
......
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
require 'spec_helper' require 'spec_helper'
describe Commit do describe Ci::Commit do
let(:project) { FactoryGirl.create :project } let(:project) { FactoryGirl.create :ci_project }
let(:commit) { FactoryGirl.create :commit, project: project } let(:commit) { FactoryGirl.create :ci_commit, project: project }
let(:commit_with_project) { FactoryGirl.create :commit, project: project } let(:commit_with_project) { FactoryGirl.create :ci_commit, project: project }
let(:config_processor) { GitlabCiYamlProcessor.new(gitlab_ci_yaml) } let(:config_processor) { GitlabCiYamlProcessor.new(gitlab_ci_yaml) }
it { should belong_to(:project) } it { should belong_to(:project) }
...@@ -37,18 +37,18 @@ describe Commit do ...@@ -37,18 +37,18 @@ describe Commit do
describe :last_build do describe :last_build do
subject { commit.last_build } subject { commit.last_build }
before do before do
@first = FactoryGirl.create :build, commit: commit, created_at: Date.yesterday @first = FactoryGirl.create :ci_build, commit: commit, created_at: Date.yesterday
@second = FactoryGirl.create :build, commit: commit @second = FactoryGirl.create :ci_build, commit: commit
end end
it { should be_a(Build) } it { should be_a(Ci::Build) }
it('returns with the most recently created build') { should eq(@second) } it('returns with the most recently created build') { should eq(@second) }
end end
describe :retry do describe :retry do
before do before do
@first = FactoryGirl.create :build, commit: commit, created_at: Date.yesterday @first = FactoryGirl.create :ci_build, commit: commit, created_at: Date.yesterday
@second = FactoryGirl.create :build, commit: commit @second = FactoryGirl.create :ci_build, commit: commit
end end
it "creates new build" do it "creates new build" do
...@@ -62,38 +62,38 @@ describe Commit do ...@@ -62,38 +62,38 @@ describe Commit do
context 'always sending notification' do context 'always sending notification' do
it 'should return commit_pusher_email as only recipient when no additional recipients are given' do it 'should return commit_pusher_email as only recipient when no additional recipients are given' do
project = FactoryGirl.create :project, project = FactoryGirl.create :ci_project,
email_add_pusher: true, email_add_pusher: true,
email_recipients: '' email_recipients: ''
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :ci_commit, project: project
expected = 'commit_pusher_email' expected = 'commit_pusher_email'
commit.stub(:push_data) { { user_email: expected } } commit.stub(:push_data) { { user_email: expected } }
commit.project_recipients.should == [expected] commit.project_recipients.should == [expected]
end end
it 'should return commit_pusher_email and additional recipients' do it 'should return commit_pusher_email and additional recipients' do
project = FactoryGirl.create :project, project = FactoryGirl.create :ci_project,
email_add_pusher: true, email_add_pusher: true,
email_recipients: 'rec1 rec2' email_recipients: 'rec1 rec2'
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :ci_commit, project: project
expected = 'commit_pusher_email' expected = 'commit_pusher_email'
commit.stub(:push_data) { { user_email: expected } } commit.stub(:push_data) { { user_email: expected } }
commit.project_recipients.should == ['rec1', 'rec2', expected] commit.project_recipients.should == ['rec1', 'rec2', expected]
end end
it 'should return recipients' do it 'should return recipients' do
project = FactoryGirl.create :project, project = FactoryGirl.create :ci_project,
email_add_pusher: false, email_add_pusher: false,
email_recipients: 'rec1 rec2' email_recipients: 'rec1 rec2'
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :ci_commit, project: project
commit.project_recipients.should == ['rec1', 'rec2'] commit.project_recipients.should == ['rec1', 'rec2']
end end
it 'should return unique recipients only' do it 'should return unique recipients only' do
project = FactoryGirl.create :project, project = FactoryGirl.create :ci_project,
email_add_pusher: true, email_add_pusher: true,
email_recipients: 'rec1 rec1 rec2' email_recipients: 'rec1 rec1 rec2'
commit = FactoryGirl.create :commit, project: project commit = FactoryGirl.create :ci_commit, project: project
expected = 'rec2' expected = 'rec2'
commit.stub(:push_data) { { user_email: expected } } commit.stub(:push_data) { { user_email: expected } }
commit.project_recipients.should == ['rec1', 'rec2'] commit.project_recipients.should == ['rec1', 'rec2']
...@@ -168,8 +168,8 @@ describe Commit do ...@@ -168,8 +168,8 @@ describe Commit do
end end
context 'for build triggers' do context 'for build triggers' do
let(:trigger) { FactoryGirl.create :trigger, project: project } let(:trigger) { FactoryGirl.create :ci_trigger, project: project }
let(:trigger_request) { FactoryGirl.create :trigger_request, commit: commit, trigger: trigger } let(:trigger_request) { FactoryGirl.create :ci_trigger_request, commit: commit, trigger: trigger }
it 'creates builds' do it 'creates builds' do
commit.create_builds(trigger_request).should be_true commit.create_builds(trigger_request).should be_true
...@@ -215,49 +215,49 @@ describe Commit do ...@@ -215,49 +215,49 @@ describe Commit do
end end
describe "#finished_at" do describe "#finished_at" do
let(:project) { FactoryGirl.create :project } let(:project) { FactoryGirl.create :ci_project }
let(:commit) { FactoryGirl.create :commit, project: project } let(:commit) { FactoryGirl.create :ci_commit, project: project }
it "returns finished_at of latest build" do it "returns finished_at of latest build" do
build = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 60 build = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 60
build1 = FactoryGirl.create :build, commit: commit, finished_at: Time.now - 120 build1 = FactoryGirl.create :ci_build, commit: commit, finished_at: Time.now - 120
commit.finished_at.to_i.should == build.finished_at.to_i commit.finished_at.to_i.should == build.finished_at.to_i
end end
it "returns nil if there is no finished build" do it "returns nil if there is no finished build" do
build = FactoryGirl.create :not_started_build, commit: commit build = FactoryGirl.create :ci_not_started_build, commit: commit
commit.finished_at.should be_nil commit.finished_at.should be_nil
end end
end end
describe "coverage" do describe "coverage" do
let(:project) { FactoryGirl.create :project, coverage_regex: "/.*/" } let(:project) { FactoryGirl.create :ci_project, coverage_regex: "/.*/" }
let(:commit) { FactoryGirl.create :commit, project: project } let(:commit) { FactoryGirl.create :ci_commit, project: project }
it "calculates average when there are two builds with coverage" do it "calculates average when there are two builds with coverage" do
FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
commit.coverage.should == "35.00" commit.coverage.should == "35.00"
end end
it "calculates average when there are two builds with coverage and one with nil" do it "calculates average when there are two builds with coverage and one with nil" do
FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
FactoryGirl.create :build, commit: commit FactoryGirl.create :ci_build, commit: commit
commit.coverage.should == "35.00" commit.coverage.should == "35.00"
end end
it "calculates average when there are two builds with coverage and one is retried" do it "calculates average when there are two builds with coverage and one is retried" do
FactoryGirl.create :build, name: "rspec", coverage: 30, commit: commit FactoryGirl.create :ci_build, name: "rspec", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 30, commit: commit FactoryGirl.create :ci_build, name: "rubocop", coverage: 30, commit: commit
FactoryGirl.create :build, name: "rubocop", coverage: 40, commit: commit FactoryGirl.create :ci_build, name: "rubocop", coverage: 40, commit: commit
commit.coverage.should == "35.00" commit.coverage.should == "35.00"
end end
it "calculates average when there is one build without coverage" do it "calculates average when there is one build without coverage" do
FactoryGirl.create :build, commit: commit FactoryGirl.create :ci_build, commit: commit
commit.coverage.should be_nil commit.coverage.should be_nil
end end
end end
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
require 'spec_helper' require 'spec_helper'
describe MailService do describe Ci::MailService do
describe "Associations" do describe "Associations" do
it { should belong_to :project } it { should belong_to :project }
end end
...@@ -28,12 +28,12 @@ describe MailService do ...@@ -28,12 +28,12 @@ describe MailService do
end end
describe 'Sends email for' do describe 'Sends email for' do
let(:mail) { MailService.new } let(:mail) { Ci::MailService.new }
describe 'failed build' do describe 'failed build' do
let(:project) { FactoryGirl.create(:project, email_add_pusher: true) } let(:project) { FactoryGirl.create(:ci_project, email_add_pusher: true) }
let(:commit) { FactoryGirl.create(:commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:build, status: :failed, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :failed, commit: commit) }
before do before do
mail.stub( mail.stub(
...@@ -53,9 +53,9 @@ describe MailService do ...@@ -53,9 +53,9 @@ describe MailService do
end end
describe 'successfull build' do describe 'successfull build' do
let(:project) { FactoryGirl.create(:project, email_add_pusher: true, email_only_broken_builds: false) } let(:project) { FactoryGirl.create(:ci_project, email_add_pusher: true, email_only_broken_builds: false) }
let(:commit) { FactoryGirl.create(:commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) }
before do before do
mail.stub( mail.stub(
...@@ -76,13 +76,13 @@ describe MailService do ...@@ -76,13 +76,13 @@ describe MailService do
describe 'successfull build and project has email_recipients' do describe 'successfull build and project has email_recipients' do
let(:project) { let(:project) {
FactoryGirl.create(: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")
} }
let(:commit) { FactoryGirl.create(:commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) }
before do before do
mail.stub( mail.stub(
...@@ -104,13 +104,13 @@ describe MailService do ...@@ -104,13 +104,13 @@ describe MailService do
describe 'successful build and notify only broken builds' do describe 'successful build and notify only broken builds' do
let(:project) { let(:project) {
FactoryGirl.create(: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")
} }
let(:commit) { FactoryGirl.create(:commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) }
before do before do
mail.stub( mail.stub(
...@@ -132,13 +132,13 @@ describe MailService do ...@@ -132,13 +132,13 @@ describe MailService do
describe 'successful build and can test service' do describe 'successful build and can test service' do
let(:project) { let(:project) {
FactoryGirl.create(: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")
} }
let(:commit) { FactoryGirl.create(:commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:build, status: :success, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :success, commit: commit) }
before do before do
mail.stub( mail.stub(
...@@ -154,13 +154,13 @@ describe MailService do ...@@ -154,13 +154,13 @@ describe MailService do
describe 'retried build should not receive email' do describe 'retried build should not receive email' do
let(:project) { let(:project) {
FactoryGirl.create(: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")
} }
let(:commit) { FactoryGirl.create(:commit, project: project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) }
let(:build) { FactoryGirl.create(:build, status: :failed, commit: commit) } let(:build) { FactoryGirl.create(:ci_build, status: :failed, commit: commit) }
before do before do
mail.stub( mail.stub(
......
require 'spec_helper' require 'spec_helper'
describe HipChatMessage do describe Ci::HipChatMessage do
subject { HipChatMessage.new(build) } subject { HipChatMessage.new(build) }
let(:project) { FactoryGirl.create(:project) } let(:project) { FactoryGirl.create(:project) }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
require 'spec_helper' require 'spec_helper'
describe HipChatService do describe Ci::HipChatService do
describe "Validations" do describe "Validations" do
......
require 'spec_helper' require 'spec_helper'
describe SlackMessage do describe Ci::SlackMessage do
subject { SlackMessage.new(commit) } subject { SlackMessage.new(commit) }
let(:project) { FactoryGirl.create :project } let(:project) { FactoryGirl.create :project }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
require 'spec_helper' require 'spec_helper'
describe SlackService do describe Ci::SlackService do
describe "Associations" do describe "Associations" do
it { should belong_to :project } it { should belong_to :project }
end end
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
require 'spec_helper' require 'spec_helper'
describe RunnerProject do describe Ci::RunnerProject do
pending "add some examples to (or delete) #{__FILE__}" pending "add some examples to (or delete) #{__FILE__}"
end end
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
require 'spec_helper' require 'spec_helper'
describe Runner do describe Ci::Runner do
describe '#display_name' do describe '#display_name' do
it 'should return the description if it has a value' do it 'should return the description if it has a value' do
runner = FactoryGirl.build(:runner, description: 'Linux/Ruby-1.9.3-p448') runner = FactoryGirl.build(:runner, description: 'Linux/Ruby-1.9.3-p448')
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
require 'spec_helper' require 'spec_helper'
describe Service do describe Ci::Service do
describe "Associations" do describe "Associations" do
it { should belong_to :project } it { should belong_to :project }
......
require 'spec_helper' require 'spec_helper'
describe Trigger do describe Ci::Trigger do
let(:project) { FactoryGirl.create :project } let(:project) { FactoryGirl.create :project }
describe 'before_validation' do describe 'before_validation' do
......
require 'spec_helper' require 'spec_helper'
describe User do describe Ci::User do
describe "has_developer_access?" do describe "has_developer_access?" do
before do before do
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
require 'spec_helper' require 'spec_helper'
describe Variable do describe Ci::Variable do
subject { Variable.new } subject { Variable.new }
let(:secret_value) { 'secret' } let(:secret_value) { 'secret' }
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
require 'spec_helper' require 'spec_helper'
describe WebHook do describe Ci::WebHook do
describe "Associations" do describe "Associations" do
it { should belong_to :project } it { should belong_to :project }
end end
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe Ci::API::API do
include ApiHelpers include ApiHelpers
let(:runner) { FactoryGirl.create(:runner, tag_list: ["mysql", "ruby"]) } let(:runner) { FactoryGirl.create(:runner, tag_list: ["mysql", "ruby"]) }
......
require 'spec_helper' require 'spec_helper'
describe API::API, 'Commits' do describe Ci::API::API, 'Commits' do
include ApiHelpers include ApiHelpers
let(:project) { FactoryGirl.create(:project) } let(:project) { FactoryGirl.create(:project) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe Ci::API::API do
include ApiHelpers include ApiHelpers
let(:project) { FactoryGirl.create(:project) } let(:project) { FactoryGirl.create(:project) }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe Ci::API::API do
include ApiHelpers include ApiHelpers
let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:gitlab_url) { GitlabCi.config.gitlab_server.url }
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe Ci::API::API do
include ApiHelpers include ApiHelpers
include StubGitlabCalls include StubGitlabCalls
......
require 'spec_helper' require 'spec_helper'
describe API::API do describe Ci::API::API do
include ApiHelpers include ApiHelpers
describe 'POST /projects/:project_id/refs/:ref/trigger' do describe 'POST /projects/:project_id/refs/:ref/trigger' do
......
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