diff options
| author | Teddy Wing | 2017-05-31 17:20:22 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-05-31 17:57:36 +0200 |
| commit | c54f4fcf6de971948a68dbb35413f16913b4054c (patch) | |
| tree | 2c31ef98e0a5a5e37750b73f0a0ec57e043f14e0 /db | |
| parent | b5fc278ecb1b59930614a03241e7463f128e8c75 (diff) | |
| download | chouette-core-c54f4fcf6de971948a68dbb35413f16913b4054c.tar.bz2 | |
vehicle_journey_at_stops_day_offset_spec.rb: Use `build_stubbed`
I had assumed `build` wouldn't create objects in the database but it
does. Turns out what I actually wanted was FactoryGirl's `build_stubbed`
method, which I didn't know about before.
Thanks to:
http://myprogrammingblog.com/2015/12/21/10-ways-how-to-speed-your-unit-tests-rails-rspec-capybara/
https://robots.thoughtbot.com/use-factory-girls-build-stubbed-for-a-faster-test
for tipping me off about this.
Here's the time differential running this spec before and after the
change:
Before:
rspec spec/models/chouette/vehicle_journey_at_stops_day_offset_spec.rb
Running via Spring preloader in process 39491
Run options:
include {:wip=>true}
exclude {:js=>true, :meta=>true}
All examples were filtered out; ignoring {:wip=>true}
...
Finished in 3.98 seconds (files took 0.80415 seconds to load)
3 examples, 0 failures
---
After:
rspec spec/models/chouette/vehicle_journey_at_stops_day_offset_spec.rb
Running via Spring preloader in process 39511
Run options:
include {:wip=>true}
exclude {:js=>true, :meta=>true}
All examples were filtered out; ignoring {:wip=>true}
...
Finished in 1.74 seconds (files took 0.73648 seconds to load)
3 examples, 0 failures
Refs #3596
Diffstat (limited to 'db')
0 files changed, 0 insertions, 0 deletions
