Closed jeffkreeftmeijer closed 14 years ago
Makes a lot of sense. Actually I think Capybara should be the default. Thanks for the suggestion.
I agree on making Capybara the default. I'll dive into the generators and report back soon. :)
I've done some work on the generators (from the master branch, I haven't touched the rails3 branch yet). The steak generator now accepts the --webrat
and --capybara
options, like this:
script/generate steak --webrat # or --capybara
Also, I've made the generator default to capybara if no option is passed.
Thanks for the patch. It looks ok, implementation wise, although I think it'd be good to add a couple of specs (one for each driver). Something like this in steak_generator_spec.rb
would work:
scenario "Running generator for capybara by default" do
rails_app = create_rails_app(:setup_steak => false)
Dir.chdir rails_app do
`script/generate steak`
end
spec_file = create_spec :path => rails_app + "/spec/acceptance",
:content => <<-SPEC
require File.dirname(__FILE__) + "/acceptance_helper.rb"
feature "Capybara spec" do
scenario "First scenario" do
visit "/"
page.should have_content('No route matches')
end
end
SPEC
output = run_spec spec_file
output.should =~ /1 example, 0 failures/
end
Also, a quick mention to this new feature in the README would be nice.
Finally, if everything is packed as just one commit, then that'd perfect!
Ok, I've just applied a working patch by jeffkreeftmeijer which implements this in the master
branch (Rails 2.x) fd2cac76a4fb188033c3
I'll keep this issue open until it is also implemented in the rails3
branch
Got it working in my rails3
branch ( http://github.com/jeffkreeftmeijer/steak/tree/rails3 ). It works exactly the same as the patch I did in master
.
However, I had to jump through some hoops to get the specs running properly.
Capybara didn't work when I put Steak in the project as a plugin, so I put it in the Gemfile. Webrat didn't work when I put Steak in the Gemfile, so I had to add a :plugin
flag to create_rails_app
. <-- Eew!
If anyone knows a better way to fix this, let me know. :)
Thanks, Jeff. I'll check it out soon.
Actually I'm considering to not support webrat at all in rails3 branch. I have to think about it
Configure webrat in full rack mode and use as a gem (not plugin). Closed by 00e3639c1b260b8196d3813fd140f44a42572291
I merged Jeff's rails3 branch successfully. I had to fix a couple of things that made the specs to fail.
Besides that, I was able to make webrat work as a gem (not as a plugin) setting it up as described here for Sinatra (see “Modular style, with RSpec”) http://wiki.github.com/brynary/webrat/sinatra
I've released 0.4.0.a4 with those changes.
I'm not completely happy about a couple of things, though:
create_rails_app
helper does too many things and makes tests very slow. Not sure about the approach
Cucumber's generators allow you to pass if you want to use Webrat of Capybara, like this:
I think this would be a great one for Steak as well. What do you think? :)