Forum: RSpec Problems running features with Textmate Cucumber bundle

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-04-26 21:49
(Received via mailing list)
I finally plunked down for the beta RSpec bundle and I'm working
through the initial example.  Although I'm a fairly experienced RSpec
user, I'm stlll learning new tricks.

Anyway,  I'm going though the mastermind example, and everything is
going well, except that I decided to also try out the Textmate bundle
for Cucumber.  I decided to use Ben Mabey's fork on github since it
seems to be the most evolved.

When I try to run a feature with cmd-R, instead of actually running I
see something like:

Running: cucumber
/Users/rick/mastermind/features/codebreaker_starts_game.feature
--format=html
false

Cucumber runs fine from bash.

Am I missing some setup?

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-04-27 05:59
(Received via mailing list)
Rick DeNatale wrote:
> see something like:
>
> Running: cucumber
> /Users/rick/mastermind/features/codebreaker_starts_game.feature --format=html
> false
>
> Cucumber runs fine from bash.
>
> Am I missing some setup?
>
>
Hmm.. that is odd. What version of Cucumber are you using?  When you run
that exact command from the shell does it output the HTML report?

-Ben
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-04-27 15:58
(Received via mailing list)
On Sun, Apr 26, 2009 at 11:38 PM, Ben Mabey <ben@benmabey.com> wrote:
>>
>> Am I missing some setup?
>>
>>
>
> Hmm.. that is odd. What version of Cucumber are you using?  When you run
> that exact command from the shell does it output the HTML report?

I was runing 0.3.0 upgrading to 0.3.1 has the same result BUT

If I run that exact command

$ /Users/rick/mastermind/features/codebreaker_starts_game.feature
--format=html
-bash: /Users/rick/mastermind/features/codebreaker_starts_game.feature:
Permission denied


It's trying to run the feature as an executable directly it's not
running the cucumber executable!

Why it be doin dat?

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-04-27 16:00
(Received via mailing list)
On Mon, Apr 27, 2009 at 8:13 AM, Rick DeNatale <rick.denatale@gmail.com>
wrote:
>>> seems to be the most evolved.
>>>
>
> $ /Users/rick/mastermind/features/codebreaker_starts_game.feature --format=html
> -bash: /Users/rick/mastermind/features/codebreaker_starts_game.feature:
> Permission denied
>
>
> It's trying to run the feature as an executable directly it's not
> running the cucumber executable!
>
> Why it be doin dat?


Actually, I was misreading the output in the run window, which was
wrapping.

$  cucumber
/Users/rick/mastermind/features/codebreaker_starts_game.feature
--format=html false
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/step_mother.rb:125:in
`Given': Multiple step definitions have the same Regexp:
(Cucumber::Redundant)

features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'
features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'

  from
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/step_mother.rb:124:in
`each'
  from
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/step_mother.rb:124:in
`Given'
  from ./features/step_definitions/mastermind.rb:13
  from
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
  from
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`polyglot_original_require'
  from
/opt/local/lib/ruby/gems/1.8/gems/polyglot-0.2.5/lib/polyglot.rb:54:in
`require'
  from
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:79:in
`require_files'
  from
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:77:in
`each'
  from
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:77:in
`require_files'
  from
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:34:in
`execute!'
  from
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:20:in
`execute'
  from /Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/cucumber:6
  from /opt/local/bin/cucumber:19:in `load'
  from /opt/local/bin/cucumber:19

If I do this from the project directory:

 $ cucumber features/codebreaker_starts_game.feature
Feature: Codebreaker starts game
  As a Codebreaker
  I want to start a game
  So that I can break the code

  Scenario: Start game                                #
features/codebreaker_starts_game.feature:5
    Given I am not yet playing                        #
features/step_definitions/mastermind.rb:13
    When I start a new game                           #
features/step_definitions/mastermind.rb:24
    Then the game should say "Welcome to Mastermind!" #
features/step_definitions/mastermind.rb:28
    And the game should say "Enter guess:"            #
features/step_definitions/mastermind.rb:28

1 scenario
4 passed steps


Running under textmate, cucumber seems to be somehow convincing itself
that
features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'

Duplicates itself?!?

--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 Aslak Hellesøy (aslakhellesoy)
on 2009-04-27 16:08
(Received via mailing list)
On Mon, Apr 27, 2009 at 3:47 PM, Rick DeNatale
<rick.denatale@gmail.com>wrote:

> >>> going well, except that I decided to also try out the Textmate bundle
> >>>
> >
> >
> `Given': Multiple step definitions have the same Regexp:
> `Given'
>        from
> `execute!'
> Feature: Codebreaker starts game
>    Then the game should say "Welcome to Mastermind!" #
>
> Duplicates itself?!?
>

What's happening is that the file containing step defs is being loaded
twice, and therefore you get dupe step defs. Not sure why that's
happening
though...

Aslak
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-04-27 17:14
(Received via mailing list)
On Mon, Apr 27, 2009 at 10:07 AM, aslak hellesoy
<aslak.hellesoy@gmail.com> wrote:
>> >>> I finally plunked down for the beta RSpec bundle and I'm working
>> >>>
>> >>
>> > -bash: /Users/rick/mastermind/features/codebreaker_starts_game.feature:
>> wrapping.
>> features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'
>> `gem_original_require'
>> /Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:77:in
>>        from /Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/cucumber:6
>>
>>
> What's happening is that the file containing step defs is being loaded
> twice, and therefore you get dupe step defs. Not sure why that's happening
> though...

Yes, I figured it was somehing like that. On a little more trial and
error, it appears that the bundle is adding false to the end of the
command string which is causing that steps def to be required
initially:

$ cucumber
/Users/rick/mastermind/features/codebreaker_starts_game.feature
--format=html false -v
Ruby files required:
  * /Users/rick/mastermind/features/support/env.rb
  * ./features/support/env.rb
  * ./lib/mastermind/game.rb
  * /Users/rick/mastermind/features/step_definitions/mastermind.rb
/Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/step_mother.rb:125:in
`Given': Multiple step definitions have the same Regexp:
(Cucumber::Redundant)

features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'
features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'

Haven't yet figured out where that false is coming from, somewhere in
runner.rb in the bundle



--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-04-27 17:26
(Received via mailing list)
Rick DeNatale wrote:
>>>>
>>>>>>
>>>>>> Am I missing some setup?
>>>>
>>>>
>>>
>>>        from
>>> `require_files'
>>> /Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:20:in
>>>  I want to start a game
>>>    And the game should say "Enter guess:"            #
>>> Duplicates itself?!?
>
>
> features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'
> features/step_definitions/mastermind.rb:13:in `/^I am not yet playing$/'
>
> Haven't yet figured out where that false is coming from, somewhere in
> runner.rb in the bundle
>
>
>
>
I don't think the 'false' is part of the command.  That is the exit code
of the cucumber I think (well, the boolean representation of it).  I'll
take a look at it though.

-Ben
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-04-27 17:43
(Received via mailing list)
Rick DeNatale wrote:
>>>>
>>>>>>
>>>>>> Am I missing some setup?
>>>>
>>>>
>>>
>>>        from
>>> `require_files'
>>> /Users/rick/.gem/ruby/1.8/gems/cucumber-0.3.1/bin/../lib/cucumber/cli/main.rb:20:in
>>>  I want to start a game
>>>    And the game should say "Enter guess:"            #
>>> Duplicates itself?!?
>
>
Do you happen to be explicitly requiring any of your step definitions
from your env.rb or other files?  What does your env.rb look like?

-Ben
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2009-04-27 19:41
(Received via mailing list)
On Mon, Apr 27, 2009 at 11:42 AM, Ben Mabey <ben@benmabey.com> wrote:
>
> Do you happen to be explicitly requiring any of your step definitions from
> your env.rb or other files?  What does your env.rb look like?
>

Yes, env.rb is right out of the RSpec book B4.0 'printing' p 43

$: << File.join(File.dirname(__FILE__), "/../../lib" )
require 'spec/expectations'
require 'mastermind'

You are right that the false is being output by running the command,
not the command line.  I hacked the runner.rb file in the bundle to
insert a <br\> between outputting and running the command.

The mystery is why the same command running in Textmate reloads the
spec definition, but not when invoked by bash?  And when I add false
to the end of the command in bash it does.

Having just typed that I realize that I wasn't really sure that the
reload WAS the problem running under textmate. So I hacked the run
method in runner.rb in the bundle to show stderr as well as stdout:

        in_project_dir do
          @output << %Q{Running: #{full_command = "bash \"2>&1
#{command} #{@file.rake_task} #{argv.join(' ')}\""} \n}
          @output << "<br\>"
          @output << Kernel.system(full_command)
        end

And this outputs:

Running: bash "2>&1 cucumber
/Users/rick/mastermind/features/codebreaker_starts_game.feature
--format=html"
bash: 2>&1 cucumber
/Users/rick/mastermind/features/codebreaker_starts_game.feature
--format=html: No such file or directory false

I'm guessing that the file it isn't finding is cucumber?  Is there an
environment variable I need to set in textmate?



--
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-04-27 20:42
(Received via mailing list)
Rick DeNatale wrote:
> require 'spec/expectations'
> Having just typed that I realize that I wasn't really sure that the
> And this outputs:
>
>
>
>

Ahh, I've had similar issues with RSpec's bundle before.  Basically,
your PATH is not being used for all of your OSX applications. From the
rspec site[1]:

You may need to adjust the PATH in your ~/.MacOSX/environment.plist file
to point to the directory
where your ruby and spec executables live. For example:

<key>PATH</key>
<string>/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/usr/local/mysql/bin</string>



I will also add a TM_CUCUMBER_BIN constant option so if that is set it
will use that instead of assuming 'cucumber' is in your path.  I'll let
you know when that is done.

-Ben



1.http://rspec.info/documentation/tools/extensions/e...
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-04-27 21:21
(Received via mailing list)
Ben Mabey wrote:
>>
>> to the end of the command in bash it does.
>>         end
>> I'm guessing that the file it isn't finding is cucumber?  Is there an
> You may need to adjust the PATH in your ~/.MacOSX/environment.plist
> will use that instead of assuming 'cucumber' is in your path.  I'll
> let you know when that is done.
http://github.com/bmabey/cucumber-tmbundle/commit/...

Try updating the bundle and defining a TM_CUCUMBER_BIN in Textmate
(Textmate -> Preferences -> Advanced -> Shell Variables).

Let me know how it goes.

Thanks,
Ben
This topic is locked and can not be replied to.