cavalle / steak

DISCONTINUED - The delicious combination of RSpec and Capybara for Acceptance BDD
MIT License
762 stars 30 forks source link

how to use autotest with steak? #34

Closed ZhangHanDong closed 13 years ago

ZhangHanDong commented 13 years ago

how to use autotest with steak?

jcxplorer commented 13 years ago

Please ask questions on the mailing list. This is reserved for bug reports.

To answer your question, if you want to run your steak specs on any change to a Rails app, your autotest/discover.rb file can be something like:

Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }

Autotest.add_hook :initialize do |at|
  at.add_mapping(/^spec\/acceptance\/.*_spec.rb$/) { |f| f }
end
ZhangHanDong commented 13 years ago

i got it, thank you!

ZhangHanDong commented 13 years ago

your config doesn't work!

it should be like the following:

Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }

Autotest.add_hook :initialize do |at|
  at.add_mapping(%r%^spec/acceptance/.*_spec.rb$%, true) { |filename, _|
    filename
  }

  at.add_mapping(%r%^app/(models|controllers|helpers|lib)/.*rb$%, true) {
    at.files_matching %r%^spec/acceptance/.*_spec.rb$%
  }

  at.add_mapping(%r%^app/views/(.*)$%, true) {
    at.files_matching %r%^spec/acceptance/.*_spec.rb$%
  }
end