ruby on rails - RSpec suite performance difference -
i've got interesting problem that's causing myself , team lot of headaches when comes running our spec suite.
our spec suite broken following sub-folders, , next them total execution time completion:
rspec spec/acceptance 311.67s rspec spec/controllers 18.97s rspec spec/decorators 4.39s rspec spec/helpers 9.45s rspec spec/lib 16.88s rspec spec/mailers 5.27s rspec spec/models 121.05s rspec spec/presenters 0.03s rspec spec/workers 19.3s total run time: 8m 27s
which improved, in pretty managable.
however, if, run rspec spec
, run entire suite @ once, total time complete 27m 11s
!
so, doing dramatically affecting performance of entire suite when run @ once. i'm hoping can pointers can begin try troubleshoot problem.
if helps, i've posted spec_helper.rb
file here
thanks in advance,
joe
at guess, i'd integration specs setting databasecleaner
:truncation
, it's not getting switched :transaction
other specs. have sample spec_helper
navigates situation here. there couple methods provided dig in , figure out strategy being used @ given time. here convenience:
def cleaner_strategy active_record_cleaner.instance_variable_get(:@strategy).class end def active_record_cleaner databasecleaner.instance_variable_get(:@cleaners)[[:active_record, {}]] end
side note: use filter our integration specs since slow. disable them default in our local env, , let ci run them.
config.filter_run_excluding :slow unless env['slow']
then can run them individually with:
$ slow=true rspec spec/features/some_awesome_feature_spec.rb
Comments
Post a Comment