Skip to content

Instantly share code, notes, and snippets.

@johnwook
Last active June 21, 2018 07:20
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save johnwook/784af45124cfc841f8a2 to your computer and use it in GitHub Desktop.
Spree test environment setting with rspec, factory_girl_rails and spring

Environment

  • rspec-rails (3.3.3)
  • factory_girl_rails (4.5.0)
  • spring (1.4.0)
  • spring-commands-rspec (1.0.4)

Problem

  • spring rspec generates errors with spree-generated-factories when it is used the way like require 'spree/testing_support/factories')

Solution

  • There is already a solution by @derekprior (spree/spree#6534)
  • Use load instead of require
...
require 'spec_helper'
require 'rspec/rails'
require 'ffaker' # important. spree-generated-factories require this.
...
load 'spree/testing_support/factories.rb'
@yeonhoyoon
Copy link

@sunkibaek 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment