pat / combustion

Simple, elegant testing for Rails Engines
MIT License
708 stars 51 forks source link

Fix failing tests while using sqlite #40

Closed brain-geek closed 11 years ago

brain-geek commented 11 years ago

In some cases, running tests on CI might result in getting this error:

/home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:1406:in `unlink': No such file or directory - /home/travis/build/brain-geek/modular/spec/internal/db/combustion_test.sqlite (Errno::ENOENT)
    from /home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:1406:in `block in remove_file'
    from /home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:1411:in `platform_support'
    from /home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:1405:in `remove_file'
    from /home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:785:in `remove_file'
    from /home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:563:in `block in rm'
    from /home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:562:in `each'
    from /home/travis/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/fileutils.rb:562:in `rm'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/combustion-0.3.3/lib/combustion/database.rb:150:in `drop_database'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/combustion-0.3.3/lib/combustion/database.rb:23:in `reset_database'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/combustion-0.3.3/lib/combustion/database.rb:4:in `block in setup'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/activesupport-3.2.12/lib/active_support/core_ext/kernel/reporting.rb:43:in `silence_stream'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/combustion-0.3.3/lib/combustion/database.rb:3:in `setup'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/combustion-0.3.3/lib/combustion.rb:25:in `initialize!'
    from /home/travis/build/brain-geek/modular/spec/spec_helper.rb:7:in `<top (required)>'
    from /home/travis/build/brain-geek/modular/spec/components/base_spec.rb:1:in `require'
    from /home/travis/build/brain-geek/modular/spec/components/base_spec.rb:1:in `<top (required)>'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
    from /home/travis/.rvm/gems/ruby-1.9.3-p327/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'

This fix may not have really good coding style, but it helps.

parndt commented 11 years ago

I've never seen this before on Travis with combustion. Can you please link to your failing build and then the passing build which was then fixed by this patch?

brain-geek commented 11 years ago

I`ve reproduced this issue for you: failing - https://travis-ci.org/brain-geek/modular/builds/5540284 passing - https://travis-ci.org/brain-geek/modular/builds/5537253

Commit - https://github.com/brain-geek/modular/compare/756e4b7f1831...ec4b5dc0aa0d

pat commented 11 years ago

To be honest, I'm a little surprised this error doesn't crop up all the time! It's happening at the start of your tests, so of course there's no database file.

I'm going to close this, but only because I just pushed a simpler fix (I could have asked you to resubmit a pull request, but I had the code open already and it was a one-liner). Give 155f159dd8eb99781364cfb918b7ebfd10f3fb2e a try.

brain-geek commented 11 years ago

Thanks! It's great that this issue is gone.

Can you release the new version of gem?

parndt commented 11 years ago

Personally, I use combustion via git:

gem 'combustion', :github => 'pat/combustion'
pat commented 11 years ago

Phil, I think I might push out a 0.4.0 release… the minor number gets a bump because of your change a while ago: "Combustion no longer loads all of the Rails stack by default, just Railties and ActiveSupport."

Does that sound reasonable?

Although first I want to solve ticket #36, just in case that's related to Combustion code rather than a load order problem.

parndt commented 11 years ago

I'll take a look at it now

parndt commented 11 years ago

@pat :shipit:

pat commented 11 years ago

@brain-geek 0.4.0 is now released :)

brain-geek commented 11 years ago

Thanks!