summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb70
1 files changed, 35 insertions, 35 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index ec30fa8..cc6a900 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -30,21 +30,21 @@ require 'spec_helper'
describe Project do
subject { FactoryGirl.build :project }
- it { should have_many(:commits) }
+ it { is_expected.to have_many(:commits) }
- it { should validate_presence_of :name }
- it { should validate_presence_of :timeout }
- it { should validate_presence_of :default_ref }
+ it { is_expected.to validate_presence_of :name }
+ it { is_expected.to validate_presence_of :timeout }
+ it { is_expected.to validate_presence_of :default_ref }
describe 'before_validation' do
it 'should set an random token if none provided' do
project = FactoryGirl.create :project_without_token
- project.token.should_not eq ""
+ expect(project.token).not_to eq ""
end
it 'should not set an random toke if one provided' do
project = FactoryGirl.create :project
- project.token.should eq "iPWx6WM4lhHNedGfBpPJNP"
+ expect(project.token).to eq "iPWx6WM4lhHNedGfBpPJNP"
end
end
@@ -57,7 +57,7 @@ describe Project do
FactoryGirl.create :commit, committed_at: 1.hour.ago, project: newest_project
FactoryGirl.create :commit, committed_at: 2.hour.ago, project: oldest_project
- described_class.ordered_by_last_commit_date.should eq [newest_project, oldest_project, project_without_commits]
+ expect(described_class.ordered_by_last_commit_date).to eq [newest_project, oldest_project, project_without_commits]
end
end
@@ -70,26 +70,26 @@ describe Project do
FactoryGirl.create(:build, commit: commit)
end
- it { project.status.should eq 'pending' }
- it { project.last_commit.should be_kind_of(Commit) }
- it { project.human_status.should eq 'pending' }
+ it { expect(project.status).to eq 'pending' }
+ it { expect(project.last_commit).to be_kind_of(Commit) }
+ it { expect(project.human_status).to eq 'pending' }
end
end
describe '#email_notification?' do
it do
project = FactoryGirl.create :project, email_add_pusher: true
- project.email_notification?.should eq true
+ expect(project.email_notification?).to eq true
end
it do
project = FactoryGirl.create :project, email_add_pusher: false, email_recipients: 'test tesft'
- project.email_notification?.should eq true
+ expect(project.email_notification?).to eq true
end
it do
project = FactoryGirl.create :project, email_add_pusher: false, email_recipients: ''
- project.email_notification?.should eq false
+ expect(project.email_notification?).to eq false
end
end
@@ -98,28 +98,28 @@ describe Project do
project = FactoryGirl.create :project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(true)
allow(project).to receive(:success?).and_return(true)
- project.broken_or_success?.should eq true
+ expect(project.broken_or_success?).to eq true
}
it {
project = FactoryGirl.create :project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(true)
allow(project).to receive(:success?).and_return(false)
- project.broken_or_success?.should eq true
+ expect(project.broken_or_success?).to eq true
}
it {
project = FactoryGirl.create :project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(false)
allow(project).to receive(:success?).and_return(true)
- project.broken_or_success?.should eq true
+ expect(project.broken_or_success?).to eq true
}
it {
project = FactoryGirl.create :project, email_add_pusher: true
allow(project).to receive(:broken?).and_return(false)
allow(project).to receive(:success?).and_return(false)
- project.broken_or_success?.should eq false
+ expect(project.broken_or_success?).to eq false
}
end
@@ -128,14 +128,14 @@ describe Project do
let(:parsed_project) { described_class.parse(project_dump) }
- it { parsed_project.should be_valid }
- it { parsed_project.should be_kind_of(described_class) }
- it { parsed_project.name.should eq("GitLab / api.gitlab.org") }
- it { parsed_project.gitlab_id.should eq(189) }
- it { parsed_project.gitlab_url.should eq("http://demo.gitlab.com/gitlab/api-gitlab-org") }
+ it { expect(parsed_project).to be_valid }
+ it { expect(parsed_project).to be_kind_of(described_class) }
+ it { expect(parsed_project.name).to eq("GitLab / api.gitlab.org") }
+ it { expect(parsed_project.gitlab_id).to eq(189) }
+ it { expect(parsed_project.gitlab_url).to eq("http://demo.gitlab.com/gitlab/api-gitlab-org") }
it "parses plain hash" do
- described_class.parse(project_dump).name.should eq("GitLab / api.gitlab.org")
+ expect(described_class.parse(project_dump).name).to eq("GitLab / api.gitlab.org")
end
end
@@ -143,43 +143,43 @@ describe Project do
let(:project) { FactoryGirl.create :project }
subject { project.repo_url_with_auth }
- it { should be_a(String) }
- it { should end_with(".git") }
- it { should start_with(project.gitlab_url[0..6]) }
- it { should include(project.token) }
- it { should include('gitlab-ci-token') }
- it { should include(project.gitlab_url[7..-1]) }
+ it { is_expected.to be_a(String) }
+ it { is_expected.to end_with(".git") }
+ it { is_expected.to start_with(project.gitlab_url[0..6]) }
+ it { is_expected.to include(project.token) }
+ it { is_expected.to include('gitlab-ci-token') }
+ it { is_expected.to include(project.gitlab_url[7..-1]) }
end
describe '.search' do
let!(:project) { FactoryGirl.create(:project, name: "foo") }
- it { described_class.search('fo').should include(project) }
- it { described_class.search('bar').should be_empty }
+ it { expect(described_class.search('fo')).to include(project) }
+ it { expect(described_class.search('bar')).to be_empty }
end
describe '#any_runners' do
it "there are no runners available" do
project = FactoryGirl.create(:project)
- project.any_runners?.should be_falsey
+ expect(project.any_runners?).to be_falsey
end
it "there is a specific runner" do
project = FactoryGirl.create(:project)
project.runners << FactoryGirl.create(:specific_runner)
- project.any_runners?.should be_truthy
+ expect(project.any_runners?).to be_truthy
end
it "there is a shared runner" do
project = FactoryGirl.create(:project, shared_runners_enabled: true)
FactoryGirl.create(:shared_runner)
- project.any_runners?.should be_truthy
+ expect(project.any_runners?).to be_truthy
end
it "there is a shared runner, but they are prohibited to use" do
project = FactoryGirl.create(:project)
FactoryGirl.create(:shared_runner)
- project.any_runners?.should be_falsey
+ expect(project.any_runners?).to be_falsey
end
end
end