# Cucumber Problems with IronRuby

**URL:** <https://www.ruby-forum.com/t/cucumber-problems-with-ironruby/175970>\
**Category:** IronRuby\
**Created:** [September 23, 2009, 6:13am UTC](https://www.ruby-forum.com/t/cucumber-problems-with-ironruby/175970 "2009-09-23T06:13:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [September 23, 2009, 6:13am UTC](https://www.ruby-forum.com/t/cucumber-problems-with-ironruby/175970/1 "2009-09-23T06:13:43Z")

</div>

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](http://www.highoncoding.com)

> **[AzamSharp](https://azamsharp.com/)**
>
> Blog about iOS development and musings on technology

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [September 24, 2009, 2:30am UTC](https://www.ruby-forum.com/t/cucumber-problems-with-ironruby/175970/2 "2009-09-24T02:30:20Z")

</div>

Mohammed - if you’re looking for an example of the calculator problem,  
i’ve got one on GitHub you could try out. It works on IronRuby no  
problems.

> **[GitHub - xerxesb/calcdotnet: ironruby calculator demo](https://github.com/xerxesb/calcdotnet)**
>
> ironruby calculator demo . Contribute to xerxesb/calcdotnet development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![metanoize](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9fc29f/32.png) [@metanoize](https://www.ruby-forum.com/u/metanoize)\
**Post date:** [September 24, 2009, 2:30am UTC](https://www.ruby-forum.com/t/cucumber-problems-with-ironruby/175970/3 "2009-09-24T02:30:56Z")

</div>

Hi,  
Thanks! Actually I got it to work yesterday!

Thanks,  
Azam
