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

Thanks,
Tomas

From: ironruby-core-boun...@rubyforge.org 
[mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Mike Hatfield
Sent: Monday, November 29, 2010 11:16 AM
To: ironruby-core@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:
@ECHO OFF
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:
Product.cs
namespace Bdd.Store
{
  public class Product
  {
    public string Name { get; set; }
    public double Price { get; set; }
  }
}

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

Purchase.cs
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;
      if(IncludesSupport)
      {
        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
end

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.

Mike


_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

Reply via email to