[Ironruby-core] no such file to load -- spec/story (LoadError)

Tomas Matousek Tomas.Matousek at microsoft.com
Mon Nov 29 15:58:03 EST 2010

Do these problems manifest when using IronRuby 1.1.2? (master from github). Could you file a bug with details if so?


From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Mike Hatfield
Sent: Monday, November 29, 2010 11:16 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] no such file to load -- spec/story (LoadError)

It seems that Cucumber for IronRuby is a little broken at the moment.  There's an issue with Gherkin (the bdd language used by Cucumber and SpecFlow).

To get around this, I installed an older version of Cucumber that did not have this dependency.

I installed Cucumber 1.6.4 with the command:
igem install cucumber -v=1.6.4

It needed iron-term-ansicolor, I installed that with:
igem install iron-term-ansicolor

To get Cucumber to run with IronRuby, I created a batch file in the IronRuby bin folder called icucumber.bat.  My bat file looks like:
REM This is to tell IronRuby where to find gems.
SET GEM_PATH=C:\Users\mike.hatfield.NICOM\.pik\rubies\IronRuby-10v4\lib\ironruby\gems\1.8
@"C:\Users\mike.hatfield.NICOM\.pik\rubies\IronRuby-10v4\bin\ir.exe" "C:\Users\mike.hatfield.NICOM\.pik\rubies\IronRuby-10v4\bin\cucumber" %*

Your batch file's GEM_PATH and executable paths are probably different than mine, I'm running IronRuby with PIK (allows me to run multiple versions of Ruby).

I then started the feature from the MSDN article.  I had to change "Story:" to "Feature:".  My story is:
Feature: Pricing for New Product X
  As a sales administrator, I want to be able to view
  prices for product x so that I can provide customers
  with an accurate cost for their requirements.

  Scenario: Single User License for Product X without support
    Given Product X
    When user requests a 1 user license
    And this does not include support
    Then the price should be $250

I called this file story.feature and saved it in a folder called features.

If you run the following cucumber command, you should get the initial cucumber story run.
icucumber features

This gives you a list of steps (When clauses) that need to be implemented in your step definitions to make the story pass.

Inside the features folder I created another folder called step_definitons.  Inside the step_definitons folder, I created a file called product_steps.rb

Now, for the .NET class library.  I created three class files:
namespace Bdd.Store
  public class Product
    public string Name { get; set; }
    public double Price { get; set; }

namespace Bdd.Store
  public class Store
    public Product FindByProductName(string name)
      Product product = new Product { Name = name };
      return product;

namespace Bdd.Store
  public class Purchase
    public Product Product{ get; set; }
    public int Licenses { get; set; }
    public bool IncludesSupport { get; set; }
    public double GetTotalPurchasePrice()
      double price = Product.Price * Licenses;
      double supportFees = 0.0;
        supportFees = price * 0.10;

      return price + supportFees;

I then compiled these into an assembly called Product.dll using the CSharp compiler command (run from my Visual Studio Command window):
csc /out:Product.dll /target:library Product.cs Store.cs Purchase.cs

I then required my Product.dll into my step definitions file (product_steps.rb)
require File.dirname(__FILE__) + "/Product.dll"

Just as a convenience, I "include" my Bdd.Store namespace:
include Bdd::Store

I also require RSepc
require "rspec"

Lastly, I begin implementing my steps:
Given /^Product (.*)$/ do |product|
  @store = Store.new
  @product = @store.find_by_product_name(product)
  @product.price = 250;
  @product.name.should == product

and so on and so forth.  You can download my files from http://webcoding4fun.oakraven.net/downloads/BDD Example with CSharp.zip<http://webcoding4fun.oakraven.net/downloads/BDD%20Example%20with%20CSharp.zip> I hope this helps a little.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20101129/97161f65/attachment.html>

More information about the Ironruby-core mailing list