[rspec-users] [Cucumber] call the (Treetop?) parser directly?

Phlip phlip2005 at gmail.com
Sat Apr 25 07:10:24 EDT 2009


Phlip wrote:
> aslak hellesoy wrote:
> 
>> Try this:
>>
>> require 'cucumber'
>>
>> Cucumber.load_language('en')
>> p = Cucumber::Parser::FeatureParser.new
>> f = p.parse_or_fail <<-EOF
>> Feature: Foo
>>   Scenario: Bar
>>     Given Zap
>> EOF
>>
>> Aslak
> 
> Nope! Exact same error. Should I get the bench version? (It's 0.3.0 now.)

That sample works in a standalone script, and does not work in a Rails unit test:

require File.dirname(__FILE__) + '/../test_helper'

class CukeFeatureParser < ActiveSupport::TestCase

   def test_parser

require 'cucumber'

Cucumber.load_language('en')
p = Cucumber::Parser::FeatureParser.new
f = p.parse_or_fail <<-EOF
Feature: Foo
   Scenario: Bar
     Given Zap
EOF

   end
end

-- 
   Phlip
   http://flea.sourceforge.net/resume.html



More information about the rspec-users mailing list