Skip to content

Isolate Travis::API specs #78

Closed
wants to merge 3 commits into from

5 participants

@henrikhodne
Travis CI member

This shaves off about 0.8 seconds from the test time with warm caches, and about two seconds with cold caches (disk cache not included).

Is this something we want to do? I could go ahead and isolate even more things, but if it's not wanted then I won't bother.

@travisbot

This pull request fails (merged 1b540796 into 3dc56d4).

@henrikhodne
Travis CI member

Oops.

@travisbot

This pull request fails (merged 8631a1b0 into 3dc56d4).

@henrikhodne
Travis CI member

The specs fail due to some odd bug. If I run them locally with bundle exec rspec spec/**/*_spec.rb, they pass. If I run bundle exec rake, they fail. Only difference is the order the spec files are run in.

@joshk
Travis CI member
joshk commented Jul 16, 2012

@henrikhodne if there is an ordering issue then maybe you could try and fix that as well?

@henrikhodne
Travis CI member

@joshk I'm working on it.

@joshk
Travis CI member
joshk commented Jul 16, 2012
@henrikhodne
Travis CI member

Ok, I found the problem. When api_spec.rb is run, it creates the Repository class. This means that rails won't autoload it. So, in short, this can't be done unless we separate specs into specs that can be run without rails and specs that have to be run with rails and then run them separately. At least that's all I can think of.

@henrikhodne henrikhodne Stub the Repository class
The api_spec.rb file is ran first on some ruby implementations/systems,
and if we create the Repository class there, that messes up Rails'
autoloading in later tests.
73b6ee0
@henrikhodne
Travis CI member

This pull request passes (merged 73b6ee0 into 2531cab).

@joshk
Travis CI member
joshk commented Jul 18, 2012

:/
why are you commenting like travisbot comments?

@henrikhodne
Travis CI member

Because the job got stuck, but the entire matrix passed (check the log messages).

@travisbot

This pull request passes (merged 73b6ee0 into 2531cab).

@henrikhodne
Travis CI member

I stand corrected… Sorry about that.

@dmathieu dmathieu commented on the diff Aug 21, 2012
spec/travis/api_spec.rb
@@ -1,9 +1,14 @@
-require 'spec_helper'
+require 'travis/api'
+
+RSpec.configure do |c|
+ c.mock_with :mocha
@dmathieu
dmathieu added a note Aug 21, 2012

What about not using mocha (in relation to #93) ?

@rkh
Travis CI member
rkh added a note Aug 21, 2012

I wouldn't mind moving away from mocha. I think the tests need some rewriting though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.