Answer the question
In order to leave comments, you need to log in
Problem with configuration gem 'factory_girl_rails' and 'rspec-rails' plz see what's wrong?
Connected two gems
gem 'factory_girl_rails'
gem 'rspec-rails'
According to
everydayrails.com/2012/03/19/testing-series-rspec-...
To spec/spec_helper.rb
Added
require 'factory_girl_rails'
#....
config.include FactoryGirl::Syntax::Methods
FactoryGirl.define do
factory :pool do |f|
f.name "Ivan"
end
end
require 'rails_helper'
RSpec.describe Pool, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
it "has a valid factory" do
FactoryGirl.create(:pool).should be_valid
end
end
1) Pool has a valid factory
Failure/Error: FactoryGirl.create(:pool).should be_valid
NoMethodError:
undefined method `name=' for #
Answer the question
In order to leave comments, you need to log in
Old guide. In general, for gems, in most cases, manuals are not needed: there is a repository on github, where everything is written. For example, here is the factory_girl repository - https://github.com/thoughtbot/factory_girl , here is the actual cheat sheet - https://github.com/brennovich/cheat-ruby-sheets/bl...
factory :pool do |f|
f.name "Ivan"
end
Do you have a Pool model with a method name=
?
In app/models/pool.rb
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question