我在使用 factorygirl 进行测试时遇到问题:
首先是一些代码:
customerr_spec.rb:
require 'spec_helper'
describe "customers" do
describe "signup" do
#FactoryGirl.find_definitions
user = FactoryGirl.create(:signup_customer)
it "has right data" do
visit signup_path
fill_in :id, :with => 2110001
fill_in :name, :with => "AVK POLSKA Sp. zo.o."
fill_in :email, :with => "my.email@provider.be"
fill_in :email_confirmation, :with => "my.email@provider.be"
click_button "Create account"
page.should have_content("Fireprotection")
end
end
工厂.rb
FactoryGirl.define do
factory :signup_customer, class: Customer do
id = 2110001
name = "AVK POLSKA Sp. zo.o."
email = ""
address_1 = "ul. Jakubowska 1"
address_2 = "Pniewy 62-045"
zipcode = 62
city = "Pniewy"
currency = "PLN"
country_id = "PL"
contact_person_id = "AZU"
reset_token = nil
reset_token_init = nil
end
end
这是我在运行该测试时遇到的错误:
Running tests with args ["--drb", "-f", "progress", "-r", "c:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-rspec-2.1.1/lib/guard/rspec/formatter.rb",
"-f", "Guard::RSpec::Formatter", "--out", "/dev/null", "--failure-exit-code", "2", "spec"]...
<-- take tuple(1); slave.run...
09:17:40 - ERROR - Guard::RSpec failed to achieve its <start>, exception was:
[#73C9383A03A6] DRb::DRbUnknownError: ActiveRecord:: [#73C9383A03A6] c:/Ruby193/lib/ruby/1.9.1/drb/drb.rb:1095:in
method_missing' [#73C9383A03A6] c:/Ruby193/lib/ruby/gems/1.9.1/gems/guard-rspec-2.1.1/lib/guard/rspec/runner.rb:124:in
run_via_drb'
我必须在某处提出要求吗?我在这里想念什么?