Error When Trying To Activate FactoryGirl Syntax

12 views
Skip to first unread message

Diego Dillenburg Bueno

unread,
Aug 5, 2014, 10:38:34 AM8/5/14
to rubyonra...@googlegroups.com
Hello all,

I'm still learning rails and trying to dive into TDD as early as possible, but I got a problem which I couldn't solve. The deal is that I'm trying to activate the FactoryGirl Syntax and getting an "unitialized constant FactoryGirl (NameError)" when attempting to run my specs.

Would appreciate any help given!

Ps.: I'm reading Aaron Sumner's Everyday Rails Specs book, but it uses an older version of the gems, I don't know if the new RSpec has something to do with it, as now I got 2 files(rails_helper and spec_helper) differente from the old structure.

For more information here is the repository link if you need more specific information about gemfile/spec configurations and such:


Thanks in advance!
Diego Dillenburg Bueno

Colin Law

unread,
Aug 5, 2014, 10:49:26 AM8/5/14
to rubyonra...@googlegroups.com
On 5 August 2014 15:38, Diego Dillenburg Bueno
I don't see Gemfile there. What is in that file?

Have a look at railstutorial.org (which is free to use online). It
uses factorygirl and is up to date.

Colin

Diego Dillenburg Bueno

unread,
Aug 5, 2014, 10:51:26 AM8/5/14
to rubyonra...@googlegroups.com
Here is my gemfile, it's also located there on the main directory:


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development

# custom gems
gem 'devise'

group :development, :test do
  gem 'rspec-rails', '~> 3.0.0'
  gem 'factory_girl_rails', "~> 4.0"
  gem 'guard-rspec', require: false
end

group :test do
  gem 'shoulda-matchers', require: false
end



Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLv7Ndq3yZpvm9_LFa0zp25F%3DdOXPKR%2BkXoHfstCf3%3D5HQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Colin Law

unread,
Aug 5, 2014, 2:06:09 PM8/5/14
to rubyonra...@googlegroups.com
On 5 August 2014 15:38, Diego Dillenburg Bueno
<diegodi...@gmail.com> wrote:
> Hello all,
>
> I'm still learning rails and trying to dive into TDD as early as possible,
> but I got a problem which I couldn't solve. The deal is that I'm trying to
> activate the FactoryGirl Syntax and getting an "unitialized constant
> FactoryGirl (NameError)" when attempting to run my specs.

Have you done all the things in
https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#configure-your-test-suite

Colin

Diego Dillenburg Bueno

unread,
Aug 5, 2014, 2:37:26 PM8/5/14
to rubyonra...@googlegroups.com
Yeah, well I was re-reading their github documentation and realized that I was saving my configs in the wrong place, the new factory_girl requires that you save your definitions onto support/factory_girl.rb as it seems, and I was having them located at spec_helper.rb.

Anyway, thanks for the help.

Regards,
Diego Dillenburg Bueno



Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages