Created
October 1, 2010 08:54
-
-
Save yohfee/605945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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