Skip to content
Snippets Groups Projects
fib_list_question_spec.rb 875 B
Newer Older
require 'spec_helper'
require 'extreme_startup/question_factory'
require 'extreme_startup/player'

module ExtremeStartup
  describe FibonacciListQuestion do
    let(:question) { FibonacciListQuestion.new(Player.new, 17) }

    it "converts to a string" do
      question.as_text.should =~ /what are the 18 first numbers of the Fibonacci sequence/i
    end

    context "when the numbers are known" do
      let(:question) { FibonacciListQuestion.new(Player.new, 5) }

      it "converts to the right string" do
        question.as_text.should =~ /what are the 6 first numbers of the Fibonacci sequence/i
      end

      it "identifies a correct answer" do
        question.answered_correctly?("1,1,2,3,5,8").should be_true
      end

      it "identifies an incorrect answer" do
        question.answered_correctly?("1,1,2,3,5").should be_false
      end
    end

  end
end