Before(:all) do
puts "HELLO ALL :D"
end
I have some problem with my code:
/spec/factories.rb
require 'faker'
FactoryGirl.define do
factory :booking_error do
booking_id { Faker::Number.number(3).to_i }
error_type_cd BookingError.error_types.values.shuffle.first
process_name Enums::FlightEnum::PROCESSES.keys.shuffle.first
description "DESCRIPTION"
old_value "OLD_STRING"
new_value "NEW_STRING"
end
end
/spec/models/booking_error_spec.rb
require 'spec_helper'
describe BookingError do
before(:all) do
@booking_error = FactoryGirl.build(:booking_error)
@booking_error_types = BookingError.error_types
end
it 'Validating BookingError save.' do
@booking_error.save.should be_true
end
end
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem 'mysql2' , '0.3.11'
gem 'devise' , '2.2.0.rc'
gem 'devise-encryptable' , '0.1.1'
gem 'unicorn' , '4.5.0'
gem 'kaminari' , '0.14.1'
gem 'memcache-client' , '1.8.5'
gem 'simple_enum' , '1.6.4'
gem 'resque' , '1.23.0' , :require => "resque/server"
gem 'resque-logger' , '0.1.0'
gem 'resque-workers-lock'
gem 'whenever' , '0.8.1' , :require => false
gem 'httparty' , '0.9.0'
gem 'newrelic_rpm' , '3.6.1.88'
gem 'cancan' , '1.6.8'
gem 'rolify' , '3.2.0'
gem 'json-schema' , '1.1.1'
gem 'faker' , '1.1.2'
gem 'ruby-enum' , '0.2.1'
gem 'mail' , '2.5.4'
gem 'daemons-rails'
group :develop, :test do
gem 'capistrano' , '2.13.5'
gem 'capistrano-unicorn' , '0.1.6' , :require => false
gem 'capistrano-resque' , '~> 0.1.0' , :require => false
gem 'rvm-capistrano' , '1.2.7'
gem 'capistrano-ext'
gem 'rspec-rails' , '2.12.0'
gem 'debugger' , '1.5.0'
gem 'thin' , '1.5.0'
gem 'annotate' , '2.5.0'
gem 'factory_girl_rails' , '4.1.0'
gem 'yard' , '0.8.5.2'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'therubyracer' , '0.10.2'
gem 'coffee-rails' , '3.2.2'
gem 'uglifier' , '1.3.0'
gem 'twitter-bootstrap-rails' , '2.1.9'
gem 'sass' , '3.2.4'
gem 'jquery-ui-rails' , '3.0.0'
gem 'less-rails' , '2.2.6'
end
gem 'jquery-rails' , '2.1.4'
When i run:
$ rspec spec/models/booking_error_spec.rb
I get the error that is in the title:
NameError: uninitialized constant Faker::Number
Number didn't exist in Faker at the version you are using (1.1.2). Update to version 1.2.0 and it will work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.