Spree with cucumber + factory girl + pickle

91 views
Skip to first unread message

roadburn

unread,
Aug 28, 2010, 7:41:07 AM8/28/10
to Spree
Hi there,

Has anyone had any success setting up spree with cucumber + factory
girl + pickle?

So far, I've managed to get cucumber running by copying over the files
from features/step_definitions & features/support another rails app
into the directory my extension is in. Is this the right way to do
things?

But now strangely the
"When I go to xxx page"
steps pass before I create the routes and views, when they shouldn't.

Would really appreciate if someone could share their experience
setting up spree with cucumber

Erik Ostrom

unread,
Aug 30, 2010, 6:39:46 PM8/30/10
to Spree
I didn't run into that problem, but I'd start by looking at the
"catchall route for "static" content" at the bottom of routes.rb. That
might be producing a result that Cucumber thinks is okay.

Since you asked about sharing experience, here's something that may be
useful: I wrote a little file features/support/factories.rb that loads
factories from Spree and any installed extensions, and pulls in
factory_girl's Cucumber steps as well. (This was based on Spree
0.10.2, so things may have changed by now.) It looks like this:

require 'faker'
require 'factory_girl'

[ File.join(SPREE_ROOT, 'test', 'factories', '*.rb'),
File.join(RAILS_ROOT, 'vendor', 'extensions', '*',
'{test,spec}', 'factories', '*.rb')
].each do |path|
Dir.glob(path).each { |factory| require factory }
end

require 'factory_girl/step_definitions'

roadburn

unread,
Sep 4, 2010, 9:28:20 AM9/4/10
to Spree
Thanks for the tips Erik they were really helpful!

Ok I finally got Spree 0.11.0 running with spork, cucumber and
autotest

Wrote out the steps here to save anyone else the trouble to trying to
figure it out
http://www.skatercoder.com/2010/09/04/testing-spree-with-cucumber-spork-autotest-pickle/

i found that the 'factory_girl/step_definitions' was throwing
"ambiguous match" errors because of pickle_steps, so i left out the
factory_girl/step_definitions
Reply all
Reply to author
Forward
0 new messages