Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bundle exec to kick off cucumber #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pedz
Copy link

@pedz pedz commented Dec 5, 2012

This prompted the addition of flatten to the processing
of the command and its arguments

This prompted the addition of flatten to the processing
of the command and its arguments
@purcell
Copy link
Collaborator

purcell commented Dec 5, 2012

Taking a cue from ruby-compilation, wouldn't it be easier to leave cucumber-compilation-executable as a string, so that you could set it to bundle exec cucumber, and then have cucumber-compilation-run split it as follows?

(defun cucumber-compilation-run (cmd)
  "Run a cucumber process, dumping output to a compilation buffer."
  (interactive)
  (let* ((name (file-name-nondirectory (car (split-string cmd))))
         (profile-name (cucumber-compilation-profile-name))
         (cmdlist (append (split-string-and-unquote cucumber-compilation-executable)
                          (list "-p" profile-name
                                (expand-file-name cmd)))))
    (pop-to-buffer (cucumber-compilation-do name cmdlist))))

In general, I don't think it's advisable to change the default command to use bundle, but I agree that that case should be handled better.

@pedz
Copy link
Author

pedz commented Dec 5, 2012

I didn't know how to change it really. The "split string" fails if you need an argument with a space (yea... so what? you might ask). Sometimes a package has the command string and then a list of arguments that can be added. I Googled looking for an emacs idiom for this but didn't find anything.

As far as bundle, rake, etc... I can't claim any expertise here. My situation is that for some reason, running cucumber on the command line fails because selenium-webdriver is not on my system but running it via bundler works. The rubygems require tries to load all the dependencies of a gem so when capybara is loaded, it sees the dependency on selenium-webdriver, tries to load it, and fails. I assume bundle puts in its own method for require (like rubygems does) but does not load the dependencies.

As far as what is preferred or recommended, I don't know for sure. I would assume the test wants to be as close to production as possible and in production, bundle is used to actually kick off the application (at least in the version of rails I'm running 3.2.8). Sprinkle liberally with disclaimers... I don't really know for sure about any of this.

I posted a question on the mailing list and didn't get a reply so I tried hacking it myself.

I hope this helps...

@dgutov
Copy link

dgutov commented Dec 6, 2012

Maybe go the more user-friendly way and do what rspec-mode does? It has variable rspec-use-bundler-when-possible, and when it's t and one of the parent directories contains Gemfile, it prepends the command with "bundle exec".

I don't use cucumber though, so feel free to disregard.

@pedz
Copy link
Author

pedz commented Dec 14, 2012

I posted a question on "cukes" (the google group for Cucumber). The short answer is, set up your environment properly and then just use "cucumber" (not via rake and not via bundle exec). I'm in the process of setting up my environment so that will work.

@purcell
Copy link
Collaborator

purcell commented Dec 14, 2012

Thanks for the update. Maybe comment again when you've got it working. Sounds like we can close this issue if you succeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants