Sha256: b1d2dfcfa10bf7c781619cba4b6ea9605f67c7af770172f0b1a39f59ea6af132

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

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

require 'config/application'
require 'rails/test_help'

require "database_cleaner"
DatabaseCleaner.strategy = :truncation

# There is no support of fixtures in Mongoid
require "factory_girl"
FactoryGirl.find_definitions

# Allows you to focus on a few tests with ease without having to use
# command-line arguments
require 'minitest/focus'

# Color output
require "minitest/reporters"
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
# Minitest::Reporters.use! Minitest::Reporters::DefaultReporter.new

class ActiveSupport::TestCase
  # ...

  #
  # Helper methods to be used by all tests
  #

  def json_response
    ActiveSupport::JSON.decode @response.body
  end

  def reset_instance_variables(class_obj)
    class_obj.instance_variables.each do |var|
      class_obj.instance_variable_set var, nil
    end
  end
end

class Product
  include Mongoid::Document
  include Mongoid::Timestamps

  field :title
  field :published, type: Boolean, default: true

  validates :title, length: { maximum: 6 }
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
character-1.0.6 test/test_helper.rb
character-1.0.5 test/test_helper.rb
character-1.0.4 test/test_helper.rb
character-1.0.3 test/test_helper.rb
character-1.0.2 test/test_helper.rb
character-1.0.1 test/test_helper.rb
character-1.0.0 test/test_helper.rb