Sha256: 2be805f2da17ed78f3fdacf144130a55e98fa6b58b01b028cc995b182b59ebd3

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

ENV['RAILS_ENV'] ||= 'test'

require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails'
require 'factory_girl_rails'
require "database_cleaner"

Rails.backtrace_cleaner.remove_silencers!

Rails.configuration.total_answers_by_question = 4

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|

  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  config.include FactoryGirl::Syntax::Methods
  config.profile_examples = 10
  config.order = :random

  config.before(:suite) do
    DatabaseCleaner.clean_with :truncation
  end

  config.before(:each) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end

  def create_questions_in_sequence(quantity)
    (1..quantity).each do |q|
      question = create(:question, text: "Question text #{q}")
      create(:answer, text: "Answer - 1", question: question, correct: true)
      create(:answer, text: "Answer - 2", question: question, correct: false)
      create(:answer, text: "Answer - 3", question: question, correct: false)
      create(:answer, text: "Answer - 4", question: question, correct: false)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quizzes-0.1.1 spec/spec_helper.rb
quizzes-0.1.0 spec/spec_helper.rb