Hi,
I am trying to get Cucumber to work with IronRuby and .NET class. For
some
reason it does not like the describe keyword from spec and before
keyword.
Here is the feature file:
Feature: Addition
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
Scenario Outline: Add two numbers
Given I have entered <input_1> into the calculator
And I have entered <input_2> into the calculator
When I press add
Then the result should be on the screen
Examples:
| input_1 | input_2 | output |
| 20 | 30 | 50 |
| 2 | 5 | 7 |
| 0 | 40 | 40 |
Here is the step file:
require ‘rubygems’
require ‘spec/expectations’
require File.expand_path(“bin/Debug/BusinessObjects.dll”)
include BusinessObjects
@cal = Calculator.new
Given “I have entered $n into the calculator” do |n|
@cal.Push n.to_i
end
When /I press add/ do
@result = @cal.Add
end
Then /the result should be (.*) on the screen/ do |result|
@result.should == result.to_i
end
I need to initialize @cal before each test but I cannot use before for
some
reason!
undefined method Push' for nil:NilClass (NoMethodError) ./features/step_definitons/calculator_steps.rb:18 C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA CTED\Builtins\KernelOps.cs:648:in
instance_exec’
C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA
CTED\Extensions\IListOps.cs:810:in each' C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA CTED\Builtins\Enumerable.cs:150:in
b__9’
C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA
CTED\Extensions\IListOps.cs:810:in `each’
C:\DevTools\IronRuby\ironruby\Merlin\Main\Languages\Ruby\Libraries.LCA
Mohammad A.
MVP (Microsoft Valuable Professional)
www.highoncoding.com