Newer
Older
require 'spec_helper'
require 'extreme_startup/question_factory'
require 'extreme_startup/player'
module ExtremeStartup
describe SumListQuestion do
let(:question) { SumListQuestion.new(Player.new) }
it "converts to a string" do
question.as_text.should =~ /give the sum of elements in: \(\d+(, \d+)*\)/i
end
context "when the numbers are known" do
let(:question) { SumListQuestion.new(Player.new, 1, 2, 3) }
it "converts to the right string" do
question.as_text.should =~ /give the sum of elements in: \(1, 2, 3\)/i
end
it "identifies a correct answer" do
question.answered_correctly?("6").should be_true
end
it "identifies an incorrect answer" do
question.answered_correctly?("42").should be_false
end
end
end
end