- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我无法加载 gem factory_girl_rails 以正确运行我的测试。我检查了每个地方,但我无法解决。这是我运行 spec
时的错误:
/Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'factory_girl_rails'. (Bundler::GemRequireError)
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /Users/qcherifi/Documents/perso/wan/wannatalk.io/config/application.rb:7:in `<top (required)>'
from /Users/qcherifi/Documents/perso/wan/wannatalk.io/config/environment.rb:2:in `require'
from /Users/qcherifi/Documents/perso/wan/wannatalk.io/config/environment.rb:2:in `<top (required)>'
from /Users/qcherifi/Documents/perso/wan/wannatalk.io/spec/spec_helper.rb:2:in `require'
from /Users/qcherifi/Documents/perso/wan/wannatalk.io/spec/spec_helper.rb:2:in `<top (required)>'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration.rb:1295:in `require'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration.rb:1295:in `block in requires='
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration.rb:1295:in `each'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration.rb:1295:in `requires='
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration_options.rb:109:in `block in process_options_into'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration_options.rb:108:in `each'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration_options.rb:108:in `process_options_into'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/configuration_options.rb:21:in `configure'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:105:in `setup'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:92:in `run'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:78:in `run'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.3/exe/rspec:4:in `<top (required)>'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `load'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/bin/rspec:23:in `<main>'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/qcherifi/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Bundle 安装没问题,这是我在/gemfile 中的 gem
group :development, :test do
gem 'sqlite3'
gem 'pry-byebug'
gem 'binding_of_caller'
gem 'better_errors'
gem 'web-console', '~> 2.0'
gem 'spring'
gem 'capybara'
gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails'
gem 'database_cleaner'
end
/spec/models/participant_spec.rb
require 'spec_helper'
RSpec.describe Participant, type: :model do
it "has a valid factory"
Factory.create(:participant).should be_valid
it "is invalid without a name"
it "returns a participant's full name as a string"
end
/spec/factories/participants.rb 需要'伪造者'
FactoryGirl.define do
factory :participant do |f|
f.name {Faker::Name.name}
f.email {Faker::Internet.email}
f.password {Faker::Internet.password(8)}
end
end
最佳答案
我之前遇到过这个问题,这个错误有3种可能的原因:
关于ruby-on-rails - 尝试加载 gem 'factory_girl_rails' 时出错。 ( bundler ::GemRequireError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35697460/
我正在使用 factory_girl_rails而不是固定装置。这是我的模型: class User :user end 在测试中,我这样做: user = Factory.create :user
如何格式化日期以将其放入 factory_girl_rails 工厂,例如: Factory.define(:profile) do |t| t.length 110 t.shipdate 1
根据factory_girl_rails文档:这里是 factory_girl build() 和 create() 方法之间的区别: # Returns a User instance that's
The factory_girl_rails documentation 陈述如下: factory_girl_rails provides integration between factory_g
我有一个网络服务,可以向几个不同的客户提供广告。广告的结构因客户端而异,因此,我通过客户端名称为我的模型和 Controller 使用命名空间来区分广告。从高层看,它是这样的: 'app/models
以下是运行 rspec spec 的错误消息: /factory_girl-2.1.0/lib/factory_girl/registry.rb:38:in `add_as': 已定义:用户 (Fac
我一直在关注 Rails 教程(http://railstutorial.org/chapters/beginning,Rails 3 版本),并且在使用 Factory Girl 和 Rspec 时
我无法加载 gem factory_girl_rails 以正确运行我的测试。我检查了每个地方,但我无法解决。这是我运行 spec 时的错误: /Users/qcherifi/.rvm/gems/ru
我正在使用 mongoid odm 构建一个安装在 Rails 4 上的应用程序。一切正常,但 rspec 测试无法正常工作。当我运行 bundle exec rspec 时出现错误: Factory
我是一名优秀的程序员,十分优秀!