Sha256: 51885f1205b4eab15b78ab5d203bbd13195b31af0112d341a720d402869c9a47
Contents?: true
Size: 875 Bytes
Versions: 2
Compression:
Stored size: 875 Bytes
Contents
require 'rails_helper' module Quizzes RSpec.describe GameQuestionFactory, type: :model do before(:each) do create_questions_in_sequence(20) @game = create(:game) @questions = Question.limit(10) end it "needs a game and a set of questions to build a set of game questions" do expect { GameQuestionFactory.new({ game: @game }) }.to raise_error("It needs a game and a set of questions") expect { GameQuestionFactory.new({ questions: @questions }) }.to raise_error("It needs a game and a set of questions") end it "builds a set of questions" do game_questions = GameQuestionFactory.new({ game: @game, questions: @questions }).generate expect(game_questions.size).to eq(10) game_question = game_questions.first expect(game_question.game).to eq(@game) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
quizzes-0.1.1 | spec/models/quizzes/game_question_factory_spec.rb |
quizzes-0.1.0 | spec/models/quizzes/game_question_factory_spec.rb |