Skip to content

Instantly share code, notes, and snippets.

@ohta-rh
Created February 23, 2013 06:17
Show Gist options
  • Save ohta-rh/5018680 to your computer and use it in GitHub Desktop.
Save ohta-rh/5018680 to your computer and use it in GitHub Desktop.
#coding: utf-8
require "rubygems"
require "rspec"
require "./step1"
describe Hoge do
describe :initialize do
subject { Hoge.new( 100, 1000) }
it "インスタンス変数aに100が代入されること" do
subject.a.should == 100
end
it "インスタンス変数bに1000が代入されること" do
subject.b.should == 1000
end
end
describe :calc do
context "aが50でbが72の場合" do
subject { Hoge.new(50,72) }
it "計算結果が122になること" do
subject.calc.should == 122
end
end
context "aが100でbが32の場合" do
subject { Hoge.new( 100, 32 ) }
it "計算結果が132になること" do
subject.calc.should == 132
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment