Trying to get round generation and fill figured out TDD style

This commit is contained in:
Dan Buch
2012-03-10 21:13:03 -05:00
parent f177ecde2a
commit e1f1aa6038
6 changed files with 55 additions and 26 deletions

View File

@@ -2,12 +2,32 @@ require 'spec_helper'
describe MashTournament do
before(:each) do
@valid_attributes = {
:requester_id => 1
}
@valid_attributes = {:requester_id => 1}
end
it "should create a new instance given valid attributes" do
MashTournament.create!(@valid_attributes)
end
context 'creating rounds' do
before(:all) do
Map.destroy_all
8.times do
Map.make.save
end
@requester = Requester.make
@requester.save!
end
before(:each) do
subject.requester_id = @requester.id
subject.save!
subject.reload
end
it 'should create 3 rounds for 8 contenders' do
subject.create_rounds
subject.total_rounds.should == 3
end
end
end