Update rspec due to deprecation warnings

This commit is contained in:
Tyranja 2016-05-27 11:55:40 +02:00
parent cecc501255
commit 0f2c7e0307
21 changed files with 171 additions and 180 deletions

View File

@ -1,20 +1,21 @@
GIT GIT
remote: git://github.com/eric/metriks-librato_metrics.git remote: git://github.com/eric/metriks-librato_metrics.git
revision: ccbeb751ec5fc4edfe446d8a67a423b96ebe86c7 revision: 2c124f024fd2e34378260cd24b0e8687ff9bd196
specs: specs:
metriks-librato_metrics (1.0.2) metriks-librato_metrics (1.0.5)
metriks (>= 0.9.9.6) metriks (>= 0.9.9.6)
GIT GIT
remote: git://github.com/rack/rack-contrib.git remote: git://github.com/rack/rack-contrib.git
revision: 1b11346d729efd88b274cd7f704e0bca9eb3de7a revision: ea0c82dc3a6353542b7fe0cbd262c43378e28b31
specs: specs:
rack-contrib (1.2.0) rack-contrib (1.4.0)
rack (>= 0.9.1) git-version-bump (~> 0.15)
rack (~> 1.4)
GIT GIT
remote: git://github.com/rkh/mustermann.git remote: git://github.com/rkh/mustermann.git
revision: fa22e2cf4cfdb57f452c366eac66f241827b7e9c revision: 9611951c5c789ad8227a740ae142c157a8bf7401
specs: specs:
mustermann (0.4.0) mustermann (0.4.0)
tool (~> 0.2) tool (~> 0.2)
@ -42,7 +43,7 @@ GIT
GIT GIT
remote: git://github.com/travis-ci/travis-amqp.git remote: git://github.com/travis-ci/travis-amqp.git
revision: c388299757b7eda2cc0e33cdc7d90113cf283e6a revision: 3966b3651adfd1c544f53d49d5986ac16cd9c4bc
specs: specs:
travis-amqp (0.0.1) travis-amqp (0.0.1)
@ -128,7 +129,7 @@ GEM
rack-cache (~> 1.2) rack-cache (~> 1.2)
rack-test (~> 0.6.1) rack-test (~> 0.6.1)
sprockets (~> 2.2.1) sprockets (~> 2.2.1)
active_model_serializers (0.9.0) active_model_serializers (0.9.5)
activemodel (>= 3.2) activemodel (>= 3.2)
activemodel (3.2.22.2) activemodel (3.2.22.2)
activesupport (= 3.2.22.2) activesupport (= 3.2.22.2)
@ -152,19 +153,17 @@ GEM
backports (3.6.8) backports (3.6.8)
builder (3.0.4) builder (3.0.4)
bunny (0.8.0) bunny (0.8.0)
celluloid (0.16.0)
timers (~> 4.0.0)
coder (0.4.0) coder (0.4.0)
coderay (1.1.0) coderay (1.1.1)
coercible (1.0.0) coercible (1.0.0)
descendants_tracker (~> 0.0.1) descendants_tracker (~> 0.0.1)
composite_primary_keys (5.0.14) composite_primary_keys (5.0.14)
activerecord (~> 3.2.0, >= 3.2.9) activerecord (~> 3.2.0, >= 3.2.9)
connection_pool (2.1.1) concurrent-ruby (1.0.2)
customerio (0.6.1) connection_pool (2.2.0)
httparty (>= 0.5, < 0.12) customerio (1.0.0)
multi_json (~> 1.0) multi_json (~> 1.0)
dalli (2.7.2) dalli (2.7.6)
data_migrations (0.0.1) data_migrations (0.0.1)
activerecord activerecord
rake rake
@ -173,17 +172,15 @@ GEM
thread_safe (~> 0.3, >= 0.3.1) thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.2.5) diff-lcs (1.2.5)
docile (1.1.5) docile (1.1.5)
dotenv (0.7.0)
equalizer (0.0.11) equalizer (0.0.11)
erubis (2.7.0) erubis (2.7.0)
factory_girl (2.4.2) factory_girl (2.4.2)
activesupport activesupport
faraday (0.9.2) faraday (0.9.2)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ffi (1.9.6) ffi (1.9.10)
foreman (0.64.0) foreman (0.82.0)
dotenv (~> 0.7.0) thor (~> 0.19.1)
thor (>= 0.13.6)
gh (0.14.0) gh (0.14.0)
addressable addressable
backports backports
@ -191,7 +188,8 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
net-http-persistent (>= 2.7) net-http-persistent (>= 2.7)
net-http-pipeline net-http-pipeline
google-api-client (0.9.6) git-version-bump (0.15.1)
google-api-client (0.9.8)
addressable (~> 2.3) addressable (~> 2.3)
googleauth (~> 0.5) googleauth (~> 0.5)
httpclient (~> 2.7) httpclient (~> 2.7)
@ -212,9 +210,6 @@ GEM
hashr (0.0.22) hashr (0.0.22)
hike (1.2.3) hike (1.2.3)
hitimes (1.2.4) hitimes (1.2.4)
httparty (0.11.0)
multi_json (~> 1.0)
multi_xml (>= 0.5.2)
httpclient (2.8.0) httpclient (2.8.0)
hurley (0.2) hurley (0.2)
i18n (0.7.0) i18n (0.7.0)
@ -223,11 +218,11 @@ GEM
journey (1.0.4) journey (1.0.4)
json (1.8.3) json (1.8.3)
jwt (1.5.4) jwt (1.5.4)
kgio (2.9.2) kgio (2.10.0)
listen (1.0.3) listen (3.1.5)
rb-fsevent (>= 0.9.3) rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (>= 0.9) rb-inotify (~> 0.9, >= 0.9.7)
rb-kqueue (>= 0.2) ruby_dep (~> 1.2)
little-plugger (1.1.4) little-plugger (1.1.4)
logging (2.1.0) logging (2.1.0)
little-plugger (~> 1.1) little-plugger (~> 1.1)
@ -249,16 +244,15 @@ GEM
mime-types (1.25.1) mime-types (1.25.1)
mocha (0.14.0) mocha (0.14.0)
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
multi_json (1.12.0) multi_json (1.12.1)
multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
net-http-persistent (2.9.4) net-http-persistent (2.9.4)
net-http-pipeline (1.0.1) net-http-pipeline (1.0.1)
os (0.9.6) os (0.9.6)
pg (0.18.2) pg (0.18.4)
polyglot (0.3.5) polyglot (0.3.5)
proxies (0.2.1) proxies (0.2.1)
pry (0.10.1) pry (0.10.3)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
slop (~> 3.4) slop (~> 3.4)
@ -268,7 +262,7 @@ GEM
pusher-signature (~> 0.1.8) pusher-signature (~> 0.1.8)
pusher-signature (0.1.8) pusher-signature (0.1.8)
rack (1.4.7) rack (1.4.7)
rack-attack (4.2.0) rack-attack (4.4.1)
rack rack
rack-protection (1.5.3) rack-protection (1.5.3)
rack rack
@ -283,23 +277,19 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
rdoc (~> 3.4) rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0) thor (>= 0.14.6, < 2.0)
raindrops (0.13.0) raindrops (0.16.0)
rake (0.9.6) rake (0.9.6)
rb-fsevent (0.9.4) rb-fsevent (0.9.7)
rb-inotify (0.9.5) rb-inotify (0.9.7)
ffi (>= 0.5.0)
rb-kqueue (0.2.3)
ffi (>= 0.5.0) ffi (>= 0.5.0)
rdoc (3.12.2) rdoc (3.12.2)
json (~> 1.4) json (~> 1.4)
redcarpet (2.3.0) redcarpet (2.3.0)
redis (3.3.0) redis (3.3.0)
redis-namespace (1.5.1)
redis (~> 3.0, >= 3.0.4)
representable (2.3.0) representable (2.3.0)
uber (~> 0.0.7) uber (~> 0.0.7)
rerun (0.8.2) rerun (0.11.0)
listen (~> 1.0.3) listen (~> 3.0)
retriable (2.1.0) retriable (2.1.0)
rollout (1.1.0) rollout (1.1.0)
rspec (2.99.0) rspec (2.99.0)
@ -313,14 +303,13 @@ GEM
rspec-core (>= 2.99.0.beta1) rspec-core (>= 2.99.0.beta1)
rspec-expectations (>= 2.99.0.beta1) rspec-expectations (>= 2.99.0.beta1)
rspec-mocks (2.99.4) rspec-mocks (2.99.4)
sentry-raven (0.15.3) ruby_dep (1.3.1)
sentry-raven (1.0.0)
faraday (>= 0.7.6) faraday (>= 0.7.6)
sidekiq (3.3.0) sidekiq (4.1.2)
celluloid (>= 0.16.0) concurrent-ruby (~> 1.0)
connection_pool (>= 2.0.0) connection_pool (~> 2.2, >= 2.2.0)
json redis (~> 3.2, >= 3.2.1)
redis (>= 3.0.6)
redis-namespace (>= 1.3.1)
signet (0.7.2) signet (0.7.2)
addressable (~> 2.3) addressable (~> 2.3)
faraday (~> 0.9) faraday (~> 0.9)
@ -329,23 +318,23 @@ GEM
simple_states (1.0.1) simple_states (1.0.1)
activesupport activesupport
hashr (~> 0.0.10) hashr (~> 0.0.10)
simplecov (0.9.1) simplecov (0.11.2)
docile (~> 1.1.0) docile (~> 1.1.0)
multi_json (~> 1.0) json (~> 1.8)
simplecov-html (~> 0.8.0) simplecov-html (~> 0.10.0)
simplecov-html (0.8.0) simplecov-html (0.10.0)
sinatra (1.4.6) sinatra (1.4.6)
rack (~> 1.4) rack (~> 1.4)
rack-protection (~> 1.4) rack-protection (~> 1.4)
tilt (>= 1.3, < 3) tilt (>= 1.3, < 3)
sinatra-contrib (1.4.2) sinatra-contrib (1.4.7)
backports (>= 2.0) backports (>= 2.0)
multi_json multi_json
rack-protection rack-protection
rack-test rack-test
sinatra (~> 1.4.0) sinatra (~> 1.4.0)
tilt (~> 1.3) tilt (>= 1.3, < 3)
skylight (0.6.0.beta.1) skylight (0.6.2.beta.2)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
slop (3.6.0) slop (3.6.0)
sprockets (2.2.3) sprockets (2.2.3)
@ -353,13 +342,11 @@ GEM
multi_json (~> 1.0) multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
stackprof (0.2.7) stackprof (0.2.9)
thor (0.19.1) thor (0.19.1)
thread_safe (0.3.5) thread_safe (0.3.5)
tilt (1.4.1) tilt (1.4.1)
timecop (0.8.0) timecop (0.8.1)
timers (4.0.1)
hitimes
tool (0.2.3) tool (0.2.3)
travis-config (0.1.4) travis-config (0.1.4)
hashr (~> 0.0) hashr (~> 0.0)
@ -368,11 +355,10 @@ GEM
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
tzinfo (0.3.49) tzinfo (0.3.49)
uber (0.0.15) uber (0.0.15)
unicorn (4.8.3) unicorn (5.1.0)
kgio (~> 2.6) kgio (~> 2.6)
rack
raindrops (~> 0.7) raindrops (~> 0.7)
useragent (0.13.3) useragent (0.16.7)
virtus (1.0.5) virtus (1.0.5)
axiom-types (~> 0.1) axiom-types (~> 0.1)
coercible (~> 1.0) coercible (~> 1.0)

View File

@ -49,7 +49,7 @@ describe AnnotationProvider do
context 'given no annotation exists yet for the job' do context 'given no annotation exists yet for the job' do
it 'returns a new annotation object' do it 'returns a new annotation object' do
provider.annotation_for_job(job.id).new_record?.should be_true provider.annotation_for_job(job.id).new_record?.should be true
end end
end end
end end

View File

@ -8,13 +8,13 @@ describe Annotation do
describe 'validations' do describe 'validations' do
it 'only allows http or https URLs' do it 'only allows http or https URLs' do
annotation.url = 'ftp://travis-ci.org' annotation.url = 'ftp://travis-ci.org'
annotation.save.should be_false annotation.save.should be false
annotation.errors[:url].first.should match(/scheme/) annotation.errors[:url].first.should match(/scheme/)
end end
it 'only allows valid URLs' do it 'only allows valid URLs' do
annotation.url = 'http://travis-ci.org:80b/' annotation.url = 'http://travis-ci.org:80b/'
annotation.save.should be_false annotation.save.should be false
annotation.errors[:url].first.should match(/invalid/) annotation.errors[:url].first.should match(/invalid/)
end end
end end

View File

@ -11,7 +11,7 @@ describe Build, 'matrix' do
build.matrix[0].update_attributes(state: :passed) build.matrix[0].update_attributes(state: :passed)
build.matrix[1].update_attributes(state: :started) build.matrix[1].update_attributes(state: :started)
build.matrix_finished?.should_not be_true build.matrix_finished?.should_not be true
end end
end end
@ -21,7 +21,7 @@ describe Build, 'matrix' do
build.matrix[0].update_attributes(state: :passed) build.matrix[0].update_attributes(state: :passed)
build.matrix[1].update_attributes(state: :started, allow_failure: true) build.matrix[1].update_attributes(state: :started, allow_failure: true)
build.matrix_finished?.should_not be_true build.matrix_finished?.should_not be true
end end
end end
@ -31,7 +31,7 @@ describe Build, 'matrix' do
build.matrix[0].update_attributes!(state: :passed) build.matrix[0].update_attributes!(state: :passed)
build.matrix[1].update_attributes!(state: :passed) build.matrix[1].update_attributes!(state: :passed)
build.matrix_finished?.should be_true build.matrix_finished?.should be true
end end
end end
end end
@ -42,7 +42,7 @@ describe Build, 'matrix' do
build.matrix[0].update_attributes(state: :passed) build.matrix[0].update_attributes(state: :passed)
build.matrix[1].update_attributes(state: :started) build.matrix[1].update_attributes(state: :started)
build.matrix_finished?.should be_false build.matrix_finished?.should be false
end end
end end
@ -52,7 +52,7 @@ describe Build, 'matrix' do
build.matrix[0].update_attributes(state: :passed) build.matrix[0].update_attributes(state: :passed)
build.matrix[1].update_attributes(state: :started, allow_failure: true) build.matrix[1].update_attributes(state: :started, allow_failure: true)
build.matrix_finished?.should be_true build.matrix_finished?.should be true
end end
end end
@ -62,7 +62,7 @@ describe Build, 'matrix' do
build.matrix[0].update_attributes!(state: :passed) build.matrix[0].update_attributes!(state: :passed)
build.matrix[1].update_attributes!(state: :passed) build.matrix[1].update_attributes!(state: :passed)
build.matrix_finished?.should be_true build.matrix_finished?.should be true
end end
end end
end end

View File

@ -5,7 +5,7 @@ describe Build::ResultMessage do
described_class.new(data) described_class.new(data)
end end
describe :short do describe "short" do
it 'returns :pending if the build is pending' do it 'returns :pending if the build is pending' do
data = { state: :created, previous_state: nil } data = { state: :created, previous_state: nil }
message(data).short.should == 'Pending' message(data).short.should == 'Pending'
@ -52,7 +52,7 @@ describe Build::ResultMessage do
end end
end end
describe :full do describe "full" do
it 'returns :pending if the build is pending' do it 'returns :pending if the build is pending' do
data = { state: :created, previous_state: nil } data = { state: :created, previous_state: nil }
message(data).full.should == 'The build is pending.' message(data).full.should == 'The build is pending.'
@ -99,7 +99,7 @@ describe Build::ResultMessage do
end end
end end
describe :email do describe "email" do
it 'returns :pending if the build is pending' do it 'returns :pending if the build is pending' do
data = { state: :created, previous_state: nil, number: 2 } data = { state: :created, previous_state: nil, number: 2 }
message(data).email.should == 'Build #2 is pending.' message(data).email.should == 'Build #2 is pending.'

View File

@ -53,7 +53,7 @@ describe Build::States do
let(:data) { WORKER_PAYLOADS['job:test:receive'] } let(:data) { WORKER_PAYLOADS['job:test:receive'] }
it 'does not denormalize attributes' do it 'does not denormalize attributes' do
build.denormalize?('job:test:receive').should be_false build.denormalize?('job:test:receive').should be false
end end
describe 'when the build is not already received' do describe 'when the build is not already received' do

View File

@ -38,21 +38,21 @@ describe Build, truncation: true do
it 'returns true if we\'re not dealing with pull request' do it 'returns true if we\'re not dealing with pull request' do
build = Factory.build(:build) build = Factory.build(:build)
build.stubs(:pull_request?).returns(false) build.stubs(:pull_request?).returns(false)
build.secure_env_enabled?.should be_true build.secure_env_enabled?.should be true
end end
it 'returns true if pull request is from the same repository' do it 'returns true if pull request is from the same repository' do
build = Factory.build(:build) build = Factory.build(:build)
build.stubs(:pull_request?).returns(true) build.stubs(:pull_request?).returns(true)
build.stubs(:same_repo_pull_request?).returns(true) build.stubs(:same_repo_pull_request?).returns(true)
build.secure_env_enabled?.should be_true build.secure_env_enabled?.should be true
end end
it 'returns false if pull request is not from the same repository' do it 'returns false if pull request is not from the same repository' do
build = Factory.build(:build) build = Factory.build(:build)
build.stubs(:pull_request?).returns(true) build.stubs(:pull_request?).returns(true)
build.stubs(:same_repo_pull_request?).returns(false) build.stubs(:same_repo_pull_request?).returns(false)
build.secure_env_enabled?.should be_false build.secure_env_enabled?.should be false
end end
end end
@ -243,24 +243,24 @@ describe Build, truncation: true do
describe :pending? do describe :pending? do
it 'returns true if the build is finished' do it 'returns true if the build is finished' do
build = Factory(:build, state: :finished) build = Factory(:build, state: :finished)
build.pending?.should be_false build.pending?.should be false
end end
it 'returns true if the build is not finished' do it 'returns true if the build is not finished' do
build = Factory(:build, state: :started) build = Factory(:build, state: :started)
build.pending?.should be_true build.pending?.should be true
end end
end end
describe :passed? do describe :passed? do
it 'passed? returns true if state equals :passed' do it 'passed? returns true if state equals :passed' do
build = Factory(:build, state: :passed) build = Factory(:build, state: :passed)
build.passed?.should be_true build.passed?.should be true
end end
it 'passed? returns true if result does not equal :passed' do it 'passed? returns true if result does not equal :passed' do
build = Factory(:build, state: :failed) build = Factory(:build, state: :failed)
build.passed?.should be_false build.passed?.should be false
end end
end end

View File

@ -26,22 +26,22 @@ describe Commit do
describe 'pull_request?' do describe 'pull_request?' do
it 'is false for a nil ref' do it 'is false for a nil ref' do
commit.ref = nil commit.ref = nil
commit.pull_request?.should be_false commit.pull_request?.should be_falsey
end end
it 'is false for a ref named ref/branch/master' do it 'is false for a ref named ref/branch/master' do
commit.ref = 'refs/branch/master' commit.ref = 'refs/branch/master'
commit.pull_request?.should be_false commit.pull_request?.should be_falsey
end end
it 'is false for a ref named ref/pull/180/head' do it 'is false for a ref named ref/pull/180/head' do
commit.ref = 'refs/pull/180/head' commit.ref = 'refs/pull/180/head'
commit.pull_request?.should be_false commit.pull_request?.should be_falsey
end end
it 'is true for a ref named ref/pull/180/merge' do it 'is true for a ref named ref/pull/180/merge' do
commit.ref = 'refs/pull/180/merge' commit.ref = 'refs/pull/180/merge'
commit.pull_request?.should be_true commit.pull_request?.should be_truthy
end end
end end

View File

@ -13,22 +13,22 @@ class Travis::Model < ActiveRecord::Base
describe '#encrypt?' do describe '#encrypt?' do
it 'does not encrypt if given data is empty' do it 'does not encrypt if given data is empty' do
column.encrypt?(nil).should be_false column.encrypt?(nil).should be false
column.encrypt?('').should be_false column.encrypt?('').should be false
end end
context 'when disabled' do context 'when disabled' do
let(:options) { { disable: true, key: 'secret-key' } } let(:options) { { disable: true, key: 'secret-key' } }
it 'does not encrypt' do it 'does not encrypt' do
column.encrypt?('--ENCR--abc').should be_false column.encrypt?('--ENCR--abc').should be false
end end
end end
end end
describe '#decrypt?' do describe '#decrypt?' do
it 'does not decrypt if given data is empty' do it 'does not decrypt if given data is empty' do
column.decrypt?(nil).should be_false column.decrypt?(nil).should be false
column.decrypt?('').should be_false column.decrypt?('').should be false
end end
end end
@ -43,7 +43,7 @@ class Travis::Model < ActiveRecord::Base
end end
it 'allows to pass use_prefix as an option' do it 'allows to pass use_prefix as an option' do
EncryptedColumn.new(use_prefix: true).use_prefix?.should be_true EncryptedColumn.new(use_prefix: true).use_prefix?.should be true
end end
it 'allows to pass key as an option' do it 'allows to pass key as an option' do

View File

@ -224,87 +224,87 @@ describe 'Job::Queue' do
describe 'matches?' do describe 'matches?' do
it "returns false when neither of slug or language match" do it "returns false when neither of slug or language match" do
queue = queue('builds.linux', {}) queue = queue('builds.linux', {})
queue.matches?(stub('job', repository: stub('repository', owner_name: 'foo', name: 'bar', owner: nil), config: { language: 'COBOL' })).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: 'foo', name: 'bar', owner: nil), config: { language: 'COBOL' })).should be false
end end
it "returns true when the given owner matches" do it "returns true when the given owner matches" do
queue = queue('builds.cloudfoundry', { owner: 'cloudfoundry' }) queue = queue('builds.cloudfoundry', { owner: 'cloudfoundry' })
queue.matches?(stub('job', repository: stub('repository', owner_name: 'cloudfoundry', name: 'bosh', owner: nil), config: {})).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: 'cloudfoundry', name: 'bosh', owner: nil), config: {})).should be true
end end
it "returns true when the given slug matches" do it "returns true when the given slug matches" do
queue = queue('builds.rails', { slug: 'rails/rails' }) queue = queue('builds.rails', { slug: 'rails/rails' })
queue.matches?(stub('job', repository: stub('repository', owner_name: 'rails', name: 'rails', owner: nil), config: {})).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: 'rails', name: 'rails', owner: nil), config: {})).should be true
end end
it "returns true when the given language matches" do it "returns true when the given language matches" do
queue = queue('builds.linux', { language: 'clojure' }) queue = queue('builds.linux', { language: 'clojure' })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { language: 'clojure' })).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { language: 'clojure' })).should be true
end end
it 'returns true when os is missing' do it 'returns true when os is missing' do
queue = queue('builds.linux', { language: 'clojure' }) queue = queue('builds.linux', { language: 'clojure' })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { language: 'clojure' })).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { language: 'clojure' })).should be true
end end
it 'returns true when sudo is false' do it 'returns true when sudo is false' do
queue = queue('builds.docker', { sudo: false }) queue = queue('builds.docker', { sudo: false })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { sudo: false })).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { sudo: false })).should be true
end end
it 'returns false when sudo is true' do it 'returns false when sudo is true' do
queue = queue('builds.docker', { sudo: false }) queue = queue('builds.docker', { sudo: false })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { sudo: true })).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { sudo: true })).should be false
end end
it 'returns false when sudo is not specified' do it 'returns false when sudo is not specified' do
queue = queue('builds.docker', { sudo: false }) queue = queue('builds.docker', { sudo: false })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be false
end end
it 'returns true when dist matches' do it 'returns true when dist matches' do
queue = queue('builds.gce', { dist: 'trusty' }) queue = queue('builds.gce', { dist: 'trusty' })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { dist: 'trusty' })).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { dist: 'trusty' })).should be true
end end
it 'returns false when dist does not match' do it 'returns false when dist does not match' do
queue = queue('builds.docker', { dist: 'precise' }) queue = queue('builds.docker', { dist: 'precise' })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { dist: 'trusty' })).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { dist: 'trusty' })).should be false
end end
it 'returns true when osx_image matches' do it 'returns true when osx_image matches' do
queue = queue('builds.mac_beta', { osx_image: 'beta' }) queue = queue('builds.mac_beta', { osx_image: 'beta' })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { osx_image: 'beta' })).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { osx_image: 'beta' })).should be true
end end
it 'returns false when osx_image does not match' do it 'returns false when osx_image does not match' do
queue = queue('builds.mac_stable', { osx_image: 'stable' }) queue = queue('builds.mac_stable', { osx_image: 'stable' })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { osx_image: 'beta' })).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { osx_image: 'beta' })).should be false
end end
it 'returns true when services match' do it 'returns true when services match' do
queue = queue('builds.gce', { services: %w(docker) }) queue = queue('builds.gce', { services: %w(docker) })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { services: %w(redis docker postgresql) })).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { services: %w(redis docker postgresql) })).should be true
end end
it 'returns false when services do not match' do it 'returns false when services do not match' do
queue = queue('builds.gce', { services: %w(docker) }) queue = queue('builds.gce', { services: %w(docker) })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { services: %w(redis postgresql) })).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: { services: %w(redis postgresql) })).should be false
end end
it 'returns false if no valid matchers are specified' do it 'returns false if no valid matchers are specified' do
queue = queue('builds.invalid', { foobar_donotmatch: true }) queue = queue('builds.invalid', { foobar_donotmatch: true })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be false
end end
it 'returns true for percentage: 100' do it 'returns true for percentage: 100' do
queue = queue('builds.always', { percentage: 100 }) queue = queue('builds.always', { percentage: 100 })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be_true queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be true
end end
it 'returns false for percentage: 0' do it 'returns false for percentage: 0' do
queue = queue('builds.always', { percentage: 0 }) queue = queue('builds.always', { percentage: 0 })
queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be_false queue.matches?(stub('job', repository: stub('repository', owner_name: nil, name: nil, owner: nil), config: {})).should be false
end end
end end
end end

View File

@ -210,7 +210,7 @@ describe Job do
job = Job.new job = Job.new
job.commit = commit job.commit = commit
job.pull_request?.should be_true job.pull_request?.should be true
end end
end end

View File

@ -12,11 +12,11 @@ describe User do
it 'returns true if organization is flagged as educational_org' do it 'returns true if organization is flagged as educational_org' do
Travis::Features.activate_owner(:educational_org, org) Travis::Features.activate_owner(:educational_org, org)
org.education?.should be_true org.education?.should be true
end end
it 'returns false if the organization has not been flagged as educational_org' do it 'returns false if the organization has not been flagged as educational_org' do
org.education?.should be_false org.education?.should be false
end end
end end
end end

View File

@ -23,12 +23,12 @@ describe Repository::Settings do
describe '#restricts_number_of_builds?' do describe '#restricts_number_of_builds?' do
it 'returns true if number of builds is restricted' do it 'returns true if number of builds is restricted' do
settings = Repository::Settings.new(maximum_number_of_builds: 2) settings = Repository::Settings.new(maximum_number_of_builds: 2)
settings.restricts_number_of_builds?.should be_true settings.restricts_number_of_builds?.should be true
end end
it 'returns false if builds are not restricted' do it 'returns false if builds are not restricted' do
settings = Repository::Settings.new(maximum_number_of_builds: 0) settings = Repository::Settings.new(maximum_number_of_builds: 0)
settings.restricts_number_of_builds?.should be_false settings.restricts_number_of_builds?.should be false
end end
end end

View File

@ -351,10 +351,10 @@ describe Repository, truncation: true do
repo.settings = {} repo.settings = {}
repo.update_column(:settings, { 'build_pushes' => false }.to_json) repo.update_column(:settings, { 'build_pushes' => false }.to_json)
repo.reload repo.reload
repo.settings.build_pushes?.should be_false repo.settings.build_pushes?.should be false
repo.update_column(:settings, { 'build_pushes' => true }.to_json) repo.update_column(:settings, { 'build_pushes' => true }.to_json)
repo.reload repo.reload
repo.settings.build_pushes?.should be_true repo.settings.build_pushes?.should be true
end end
it "allows to set nil for settings" do it "allows to set nil for settings" do

View File

@ -14,38 +14,38 @@ describe Request::Approval do
describe 'config_accepted?' do describe 'config_accepted?' do
it 'approves the build when .travis.yml is missing, but builds with .travis.yml are allowed' do it 'approves the build when .travis.yml is missing, but builds with .travis.yml are allowed' do
request.config['.result'] = 'not_found' request.config['.result'] = 'not_found'
approval.config_accepted?.should be_true approval.config_accepted?.should be true
end end
it 'does not approve the build if .travis.yml is missing and builds without it are not allowed' do it 'does not approve the build if .travis.yml is missing and builds without it are not allowed' do
request.repository.stubs(:builds_only_with_travis_yml?).returns(true) request.repository.stubs(:builds_only_with_travis_yml?).returns(true)
request.config['.result'] = 'not_found' request.config['.result'] = 'not_found'
approval.config_accepted?.should be_false approval.config_accepted?.should be false
approval.message.should == '.travis.yml is missing and builds without .travis.yml are disabled' approval.message.should == '.travis.yml is missing and builds without .travis.yml are disabled'
end end
it 'approves the build when .travis.yml is present' do it 'approves the build when .travis.yml is present' do
request.config['.result'] = 'configured' request.config['.result'] = 'configured'
approval.config_accepted?.should be_true approval.config_accepted?.should be true
end end
end end
describe 'branch_accepted?' do describe 'branch_accepted?' do
it 'does not accept a request that belongs to the github_pages branch' do it 'does not accept a request that belongs to the github_pages branch' do
request.commit.stubs(:branch).returns('gh_pages') request.commit.stubs(:branch).returns('gh_pages')
approval.branch_accepted?.should be_false approval.branch_accepted?.should be false
end end
it 'accepts a request that belongs to the gh-pages branch if it\'s specified in branches:only' do it 'accepts a request that belongs to the gh-pages branch if it\'s specified in branches:only' do
request.commit.stubs(:branch).returns('gh_pages') request.commit.stubs(:branch).returns('gh_pages')
request.config['branches'] = { 'only' => ['gh-pages'] } request.config['branches'] = { 'only' => ['gh-pages'] }
approval.branch_accepted?.should be_true approval.branch_accepted?.should be_truthy
end end
it "doesn't fail when the branch configuration is an array" do it "doesn't fail when the branch configuration is an array" do
request.config['branches'] = [{ 'only' => ['gh-pages'] }] request.config['branches'] = [{ 'only' => ['gh-pages'] }]
approval.branch_accepted?.should be_true approval.branch_accepted?.should be true
end end
end end
@ -162,109 +162,111 @@ describe Request::Approval do
describe 'skipped?' do describe 'skipped?' do
it 'returns true when the commit message contains [ci skip]' do it 'returns true when the commit message contains [ci skip]' do
request.commit.stubs(:message).returns 'lets party like its 1999 [ci skip]' request.commit.stubs(:message).returns 'lets party like its 1999 [ci skip]'
approval.send(:skipped?).should be_true approval.send(:skipped?).should be true
end end
end end
describe 'github_pages?' do describe 'github_pages?' do
it 'returns true for a branch named gh-pages' do it 'returns true for a branch named gh-pages' do
request.commit.stubs(:branch).returns 'gh-pages' request.commit.stubs(:branch).returns 'gh-pages'
approval.send(:github_pages?).should be_true approval.send(:github_pages?).should be_truthy
end end
it 'returns true for a branch named gh_pages' do it 'returns true for a branch named gh_pages' do
request.commit.stubs(:branch).returns 'gh_pages' request.commit.stubs(:branch).returns 'gh_pages'
approval.send(:github_pages?).should be_true approval.send(:github_pages?).should be_truthy
end end
it 'returns true when a PR is for gh_pages' do it 'returns true when a PR is for gh_pages' do
request.commit.stubs(:ref).returns 'refs/pulls/1/merge' request.commit.stubs(:ref).returns 'refs/pulls/1/merge'
request.commit.stubs(:branch).returns 'gh_pages' request.commit.stubs(:branch).returns 'gh_pages'
approval.send(:github_pages?).should be_true approval.send(:github_pages?).should be_truthy
end end
it 'returns false for a branch named master' do it 'returns false for a branch named master' do
commit.stubs(:branch).returns 'master' commit.stubs(:branch).returns 'master'
approval.send(:github_pages?).should be_false approval.send(:github_pages?).should be_falsy
end end
end end
describe 'included_repository?' do describe 'included_repository?' do
it 'returns true if the repository is an included repository' do it 'returns true if the repository is an included repository' do
request.repository.stubs(:slug).returns 'rails/rails' request.repository.stubs(:slug).returns 'rails/rails'
approval.send(:included_repository?).should be_true approval.send(:included_repository?).should be true
end end
it 'returns true if the repository is an included repository with rule as a string' do it 'returns true if the repository is an included repository with rule as a string' do
Travis.config.repository_filter.stubs(:include).returns(["rails\\/rails"]) Travis.config.repository_filter.stubs(:include).returns(["rails\\/rails"])
request.repository.stubs(:slug).returns 'rails/rails' request.repository.stubs(:slug).returns 'rails/rails'
approval.send(:included_repository?).should be_true approval.send(:included_repository?).should be true
end end
it 'returns false if the repository is not included' do it 'returns false if the repository is not included' do
request.repository.stubs(:slug).returns 'josh/completeness-fu' request.repository.stubs(:slug).returns 'josh/completeness-fu'
approval.send(:included_repository?).should be_false approval.send(:included_repository?).should be false
end end
it 'returns false if the repository is not included with rule as a string' do it 'returns false if the repository is not included with rule as a string' do
Travis.config.repository_filter.stubs(:include).returns(["rails\\/rails"]) Travis.config.repository_filter.stubs(:include).returns(["rails\\/rails"])
request.repository.stubs(:slug).returns 'josh/completeness-fu' request.repository.stubs(:slug).returns 'josh/completeness-fu'
approval.send(:included_repository?).should be_false approval.send(:included_repository?).should be false
end end
end end
describe 'excluded_repository?' do describe 'excluded_repository?' do
it 'returns true if the repository is an excluded repository' do it 'returns true if the repository is an excluded repository' do
request.repository.stubs(:slug).returns 'josh/rails' request.repository.stubs(:slug).returns 'josh/rails'
approval.send(:excluded_repository?).should be_true approval.send(:excluded_repository?).should be true
end end
it 'returns false if the repository is not excluded' do it 'returns false if the repository is not excluded' do
request.repository.stubs(:slug).returns 'josh/completeness-fu' request.repository.stubs(:slug).returns 'josh/completeness-fu'
approval.send(:excluded_repository?).should be_false approval.send(:excluded_repository?).should be false
end end
it 'returns true if the repository is an excluded repository with rule as a string' do it 'returns true if the repository is an excluded repository with rule as a string' do
Travis.config.repository_filter.stubs(:exclude).returns(["\\/rails$"]) Travis.config.repository_filter.stubs(:exclude).returns(["\\/rails$"])
request.repository.stubs(:slug).returns 'josh/rails' request.repository.stubs(:slug).returns 'josh/rails'
approval.send(:excluded_repository?).should be_true approval.send(:excluded_repository?).should be true
end end
it 'returns false if the repository is not excluded with rule as a string' do it 'returns false if the repository is not excluded with rule as a string' do
Travis.config.repository_filter.stubs(:exclude).returns(["\\/rails$"]) Travis.config.repository_filter.stubs(:exclude).returns(["\\/rails$"])
request.repository.stubs(:slug).returns 'josh/completeness-fu' request.repository.stubs(:slug).returns 'josh/completeness-fu'
approval.send(:excluded_repository?).should be_false approval.send(:excluded_repository?).should be false
end end
end end
describe 'enabled_in_settings?' do describe 'enabled_in_settings?' do
it 'returns true if a request is an api request' do it 'returns true if a request is an api request' do
request.stubs(:api_request?).returns(true) request.stubs(:api_request?).returns(true)
approval.enabled_in_settings?.should be_true approval.enabled_in_settings?.should be true
end end
it 'returns true if pull requests are enabled and a request is a pull request' do it 'returns true if pull requests are enabled and a request is a pull request' do
request.stubs(:pull_request?).returns(true) request.stubs(:pull_request?).returns(true)
approval.stubs(:build_pull_requests?).returns(true) approval.stubs(:build_pull_requests?).returns(true)
approval.enabled_in_settings?.should be_true approval.enabled_in_settings?.should be true
end end
it 'returns true if pushes are enabled and a request is a push' do it 'returns true if pushes are enabled and a request is a push' do
request.stubs(:pull_request?).returns(false) request.stubs(:pull_request?).returns(false)
approval.stubs(:build_pushes?).returns(true) approval.stubs(:build_pushes?).returns(true)
approval.enabled_in_settings?.should be_true approval.enabled_in_settings?.should be true
end end
it 'returns false if pull requests are disabled and a request is a pull request' do it 'returns false if pull requests are disabled and a request is a pull request' do
request.stubs(:pull_request?).returns(true) request.stubs(:pull_request?).returns(true)
approval.stubs(:build_pull_requests?).returns(false) approval.stubs(:build_pull_requests?).returns(false)
approval.enabled_in_settings?.should be_false approval.enabled_in_settings?.should be false
end end
it 'returns false if pushes are disabled and a request is a push' do it 'returns false if pushes are disabled and a request is a push' do
request.stubs(:pull_request?).returns(false) request.stubs(:pull_request?).returns(false)
approval.stubs(:build_pushes?).returns(false) approval.stubs(:build_pushes?).returns(false)
approval.enabled_in_settings?.should be_false approval.enabled_in_settings?.should be false
end end
end end
end end

View File

@ -8,74 +8,74 @@ describe Request::Branches do
describe '#included?' do describe '#included?' do
it 'defaults to true if no branches are included' do it 'defaults to true if no branches are included' do
request.config['branches'] = { 'only' => nil } request.config['branches'] = { 'only' => nil }
branches.included?('feature').should be_true branches.included?('feature').should be true
end end
describe 'returns true if the included branches include the given branch' do describe 'returns true if the included branches include the given branch' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'only' => 'feature' } request.config['branches'] = { 'only' => 'feature' }
branches.included?('feature').should be_true branches.included?('feature').should be true
end end
it 'given as a comma separated list of branches' do it 'given as a comma separated list of branches' do
request.config['branches'] = { 'only' => 'feature, develop' } request.config['branches'] = { 'only' => 'feature, develop' }
branches.included?('feature').should be_true branches.included?('feature').should be true
end end
it 'given as an array of branches' do it 'given as an array of branches' do
request.config['branches'] = { 'only' => %w(feature develop) } request.config['branches'] = { 'only' => %w(feature develop) }
branches.included?('feature').should be_true branches.included?('feature').should be true
end end
end end
describe 'returns true if the given branch matches a pattern from the included branches' do describe 'returns true if the given branch matches a pattern from the included branches' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'only' => '/^feature-\d+$/' } request.config['branches'] = { 'only' => '/^feature-\d+$/' }
branches.included?('feature-42').should be_true branches.included?('feature-42').should be true
end end
it 'given as a comma separated list of patterns' do it 'given as a comma separated list of patterns' do
request.config['branches'] = { 'only' => '/^feature-\d+$/,/^develop-\d+$/' } request.config['branches'] = { 'only' => '/^feature-\d+$/,/^develop-\d+$/' }
branches.included?('feature-42').should be_true branches.included?('feature-42').should be true
end end
it 'given as an array of patterns' do it 'given as an array of patterns' do
request.config['branches'] = { 'only' => %w(/^feature-\d+$/ /^develop-\d+$/) } request.config['branches'] = { 'only' => %w(/^feature-\d+$/ /^develop-\d+$/) }
branches.included?('feature-42').should be_true branches.included?('feature-42').should be true
end end
end end
describe 'returns false if the included branches do not include the given branch' do describe 'returns false if the included branches do not include the given branch' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'only' => 'feature' } request.config['branches'] = { 'only' => 'feature' }
branches.included?('master').should be_false branches.included?('master').should be false
end end
it 'given as a comma separated list of branches' do it 'given as a comma separated list of branches' do
request.config['branches'] = { 'only' => 'feature, develop' } request.config['branches'] = { 'only' => 'feature, develop' }
branches.included?('master').should be_false branches.included?('master').should be false
end end
it 'given as an array of branches' do it 'given as an array of branches' do
request.config['branches'] = { 'only' => %w(feature develop) } request.config['branches'] = { 'only' => %w(feature develop) }
branches.included?('master').should be_false branches.included?('master').should be false
end end
end end
describe 'returns false if the given branch does not match any pattern from the included branches' do describe 'returns false if the given branch does not match any pattern from the included branches' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'only' => '/^feature-\d+$/' } request.config['branches'] = { 'only' => '/^feature-\d+$/' }
branches.included?('master').should be_false branches.included?('master').should be false
end end
it 'given as a comma separated list of patterns' do it 'given as a comma separated list of patterns' do
request.config['branches'] = { 'only' => '/^feature-\d+$/,/^develop-\d+$/' } request.config['branches'] = { 'only' => '/^feature-\d+$/,/^develop-\d+$/' }
branches.included?('master').should be_false branches.included?('master').should be false
end end
it 'given as an array of patterns' do it 'given as an array of patterns' do
request.config['branches'] = { 'only' => %w(/^feature-\d+$/ /^develop-\d+$/) } request.config['branches'] = { 'only' => %w(/^feature-\d+$/ /^develop-\d+$/) }
branches.included?('master').should be_false branches.included?('master').should be false
end end
end end
end end
@ -83,74 +83,76 @@ describe Request::Branches do
describe '#excluded?' do describe '#excluded?' do
it 'defaults to false if no branches are excluded' do it 'defaults to false if no branches are excluded' do
request.config['branches'] = { 'except' => nil } request.config['branches'] = { 'except' => nil }
branches.excluded?('feature').should be_false branches.excluded?('feature').should be_falsy
end end
describe 'returns true if the excluded branches include the given branch' do describe 'returns true if the excluded branches include the given branch' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'except' => 'feature' } request.config['branches'] = { 'except' => 'feature' }
branches.excluded?('feature').should be_true branches.excluded?('feature').should be true
end end
it 'given as a comma separated list of branches' do it 'given as a comma separated list of branches' do
request.config['branches'] = { 'except' => 'feature, develop' } request.config['branches'] = { 'except' => 'feature, develop' }
branches.excluded?('feature').should be_true branches.excluded?('feature').should be true
end end
it 'given as an array of branches' do it 'given as an array of branches' do
request.config['branches'] = { 'except' => %w(feature develop) } request.config['branches'] = { 'except' => %w(feature develop) }
branches.excluded?('feature').should be_true branches.excluded?('feature').should be true
end end
end end
describe 'returns true if the given branch matches a pattern from the excluded branches' do describe 'returns true if the given branch matches a pattern from the excluded branches' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'except' => '/^feature-\d+$/' } request.config['branches'] = { 'except' => '/^feature-\d+$/' }
branches.excluded?('feature-42').should be_true branches.excluded?('feature-42').should be true
end end
it 'given as a comma separated list of patterns' do it 'given as a comma separated list of patterns' do
request.config['branches'] = { 'except' => '/^feature-\d+$/,/^develop-\d+$/' } request.config['branches'] = { 'except' => '/^feature-\d+$/,/^develop-\d+$/' }
branches.excluded?('feature-42').should be_true branches.excluded?('feature-42').should be true
end end
it 'given as an array of patterns' do it 'given as an array of patterns' do
request.config['branches'] = { 'except' => %w(/^feature-\d+$/ /^develop-\d+$/) } request.config['branches'] = { 'except' => %w(/^feature-\d+$/ /^develop-\d+$/) }
branches.excluded?('feature-42').should be_true branches.excluded?('feature-42').should be true
end end
end end
describe 'returns false if the excluded branches do not include the given branch' do describe 'returns false if the excluded branches do not include the given branch' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'except' => 'feature' } request.config['branches'] = { 'except' => 'feature' }
branches.excluded?('master').should be_false branches.excluded?('master').should be false
end end
it 'given as a comma separated list of branches' do it 'given as a comma separated list of branches' do
request.config['branches'] = { 'except' => 'feature, develop' } request.config['branches'] = { 'except' => 'feature, develop' }
branches.excluded?('master').should be_false branches.excluded?('master').should be false
end end
it 'given as an array of branches' do it 'given as an array of branches' do
request.config['branches'] = { 'except' => %w(feature develop) } request.config['branches'] = { 'except' => %w(feature develop) }
branches.excluded?('master').should be_false branches.excluded?('master').should be false
end end
end end
describe 'returns false if the given branch does not match any pattern from the excluded branches' do describe 'returns false if the given branch does not match any pattern from the excluded branches' do
it 'given as a string' do it 'given as a string' do
request.config['branches'] = { 'except' => '/^feature-\d+$/' } request.config['branches'] = { 'except' => '/^feature-\d+$/' }
branches.excluded?('master').should be_false branches.excluded?('master').should be false
end end
it 'given as a comma separated list of patterns' do it 'given as a comma separated list of patterns' do
request.config['branches'] = { 'except' => '/^feature-\d+$/,/^develop-\d+$/' } request.config['branches'] = { 'except' => '/^feature-\d+$/,/^develop-\d+$/' }
branches.excluded?('master').should be_false branches.excluded?('master').should be false
end end
it 'given as an array of patterns' do it 'given as an array of patterns' do
request.config['branches'] = { 'except' => %w(/^feature-\d+$/ /^develop-\d+$/) } request.config['branches'] = { 'except' => %w(/^feature-\d+$/ /^develop-\d+$/) }
branches.excluded?('master').should be_false branches.excluded?('master').should be false
end end
end end
end end

View File

@ -40,7 +40,7 @@ describe Request::States do
it 'sets the state to started' do it 'sets the state to started' do
request.start request.start
request.was_started?.should be_true request.was_started?.should be true
end end
it 'sets the result to :accepted' do it 'sets the result to :accepted' do
@ -94,7 +94,7 @@ describe Request::States do
it 'sets the state to started' do it 'sets the state to started' do
request.start request.start
request.was_started?.should be_true request.was_started?.should be true
end end
it 'sets the result to :rejected' do it 'sets the result to :rejected' do
@ -123,7 +123,7 @@ describe Request::States do
it 'sets the state to configured' do it 'sets the state to configured' do
request.configure request.configure
request.was_configured?.should be_true request.was_configured?.should be true
end end
end end

View File

@ -132,7 +132,7 @@ describe Request do
} }
} }
request.same_repo_pull_request?.should be_true request.same_repo_pull_request?.should be true
end end
it 'returns false if the base and head repos do not match' do it 'returns false if the base and head repos do not match' do
@ -143,13 +143,13 @@ describe Request do
} }
} }
request.same_repo_pull_request?.should be_false request.same_repo_pull_request?.should be false
end end
it 'returns false if repo data is not available' do it 'returns false if repo data is not available' do
request.payload = {} request.payload = {}
request.same_repo_pull_request?.should be_false request.same_repo_pull_request?.should be_falsy
end end
end end
end end

View File

@ -33,21 +33,21 @@ describe User, truncation: true do
it 'given roles and a condition it returns true if the user has a matching permission for this role' do it 'given roles and a condition it returns true if the user has a matching permission for this role' do
user.permissions.create!(push: true, repository_id: repo.id) user.permissions.create!(push: true, repository_id: repo.id)
user.permission?(['push'], repository_id: repo.id).should be_true user.permission?(['push'], repository_id: repo.id).should be true
end end
it 'given roles and a condition it returns false if the user does not have a matching permission for this role' do it 'given roles and a condition it returns false if the user does not have a matching permission for this role' do
user.permissions.create!(pull: true, repository_id: repo.id) user.permissions.create!(pull: true, repository_id: repo.id)
user.permission?(['push'], repository_id: repo.id).should be_false user.permission?(['push'], repository_id: repo.id).should be false
end end
it 'given a condition it returns true if the user has a matching permission' do it 'given a condition it returns true if the user has a matching permission' do
user.permissions.create!(push: true, repository_id: repo.id) user.permissions.create!(push: true, repository_id: repo.id)
user.permission?(repository_id: repo.id).should be_true user.permission?(repository_id: repo.id).should be true
end end
it 'given a condition it returns true if the user has a matching permission' do it 'given a condition it returns true if the user has a matching permission' do
user.permission?(repository_id: repo.id).should be_false user.permission?(repository_id: repo.id).should be false
end end
end end

View File

@ -10,6 +10,7 @@ require 'logger'
require 'gh' require 'gh'
require 'multi_json' require 'multi_json'
require 'travis/support'
require 'travis/api/app' require 'travis/api/app'
require 'travis/testing' require 'travis/testing'
require 'travis/testing/scenario' require 'travis/testing/scenario'

View File

@ -32,7 +32,7 @@ include Mocha::API
RSpec.configure do |c| RSpec.configure do |c|
c.mock_with :mocha c.mock_with :mocha
c.alias_example_to :fit, :focused => true c.alias_example_to :fit, :focused => true
c.filter_run :focused => true c.filter_run :focus => true
c.run_all_when_everything_filtered = true c.run_all_when_everything_filtered = true
# c.backtrace_clean_patterns.clear # c.backtrace_clean_patterns.clear