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