Stuck on Capybara setup: undefined method `visit' for #<Spinach::Features:...

274 views
Skip to first unread message

Ringo De Smet

unread,
Mar 28, 2013, 11:35:19 AM3/28/13
to spina...@googlegroups.com
Hello,

I'm stuck on trying Spinach with Capybara for an out-of-process (Selenium!) test scenario. Here are the contents of a few of my files:

Gemfile:
source :rubygems
group :test do
  gem "spinach", "~> 0.8.0"
  gem "capybara", "~> 2.0.3"
end

features/support/env.rb:
require 'spinach/capybara'
Capybara.run_server = false
Capybara.default_driver = :selenium
Capybara.default_selector = :css
Capybara.default_wait_time = 20

I also added this to the top of my steps file features/steps/ftp_user_management.rb:
require 'spinach/capybara'

and use the visit method as the first line of the first feature step, but still get the following in my output when running spinach:

        undefined method `visit' for #<Spinach::Features::FtpUserManagement:0x007fcffab76b60>
        /Users/me/Projects/Acceptance/features/steps/ftp_user_management.rb:3:in `block in <class:FtpUserManagement>'

Any input that can get me in the right direction?

Tnx,

Ringo

Josep Jaume Rey Peroy

unread,
Mar 28, 2013, 11:54:17 AM3/28/13
to spina...@googlegroups.com

Hi! You'll probably missing injecting the capybara DSL into Spinach::FeatureSteps

Spinach is a general purpose library that doesn't come with spinach support out-of-the-box.

You can check a working example for sinatra at http://github.com/codegram/spinach-sinatra-demo or on the http://github.com/codegram/spinach-rails gem.

I'm on mobile right now but if you need some more help I'll be available in a few hours :)

--
You received this message because you are subscribed to the Google Groups "Spinach" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spinach_bdd...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ringo De Smet

unread,
Mar 28, 2013, 12:03:28 PM3/28/13
to spina...@googlegroups.com
Josep,

On 28 March 2013 16:54, Josep Jaume Rey Peroy <josep...@gmail.com> wrote:

Hi! You'll probably missing injecting the capybara DSL into Spinach::FeatureSteps

Spinach is a general purpose library that doesn't come with spinach support out-of-the-box.

You can check a working example for sinatra at http://github.com/codegram/spinach-sinatra-demo or on the http://github.com/codegram/spinach-rails gem.

From the spinach-sinatra-demo, I copied this line to my env.rb file:

Spinach::FeatureSteps.send(:include, Spinach::FeatureSteps::Capybara) 

Then, it seemed to work. Can this be added to the documentation? Currently, it only reads this:

# Spinach already integrates with Capybara if you add
# `require spinach/capybara` in `features/support/env.rb`.
Nevertheless, thank you for the info.

Ringo

Josep Jaume

unread,
Mar 28, 2013, 2:51:15 PM3/28/13
to spina...@googlegroups.com
Hi Ringo,

It turns out it was our mistake. I've just released a new release that fixes this bug without having to explicitly include the module :)

Thanks for reporting it!

Josep Jaume

unread,
Mar 28, 2013, 2:51:55 PM3/28/13
to spina...@googlegroups.com
For the record, it's version 0.8.1

Ringo De Smet

unread,
Mar 29, 2013, 7:58:44 AM3/29/13
to spina...@googlegroups.com
On 28 March 2013 19:51, Josep Jaume <josep...@gmail.com> wrote:
For the record, it's version 0.8.1


Thanks a lot! This new version works as documented (so without the explicit injection in env.rb).

Ringo 
Reply all
Reply to author
Forward
0 new messages