Skip to content

Instantly share code, notes, and snippets.

@yohfee
Created October 1, 2010 08:54
Show Gist options
  • Save yohfee/605945 to your computer and use it in GitHub Desktop.
Save yohfee/605945 to your computer and use it in GitHub Desktop.
using System;
namespace RSpecExample
{
public class Sample
{
public Sample(params string[] words)
{
Words = words;
}
public string[] Words { get; private set; }
public string Greet()
{
return "Hello " + string.Join(",", Words);
}
public string Exec(Func<string[], string> block)
{
return block(Words);
}
}
}
require 'rubygems'
require 'spec'
require File.dirname(__FILE__) + '/../src/RSpecExample/bin/Debug/RSpecExample.dll'
include RSpecExample
describe Sample do
context "with args 'hoge', 'fuga' and 'piyo'" do
subject{ Sample.new('hoge', 'fuga', 'piyo') }
its(:Greet){ should == 'Hello hoge,fuga,piyo' }
it{ should have(3).Words }
it{ subject.Exec(lambda{|s| System::String.Join('-', s)}).should == 'hoge-fuga-piyo' }
it{ subject.Exec(lambda{|(a, b, c)| a[0] + b[0] + c[0]}).should == 'hfp' }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment