0
我正在使用Mongoid。我有一個對象:用mongoid製作 - 錯誤的參數數
class Employee
include Mongoid::Document
field :name_first, type: String
field :name_last, type: String
field :name_other, type: Array, default: []
field :title, type: String
field :education, type: Hash, default: {}
field :languages, type: Array, default: []
field :phone, type: Hash, default: {}
field :address, type: Hash, default: {}
field :email, type: Array, default: []
field :url, type: Array, default: []
field :history, type: Array, default: []
field :profile, type: String
field :social_media, type: Hash, default: {}
field :last_contact, type: Time
field :signed_up, type: Date
belongs_to :user
belongs_to :practice
end
而且,我正嘗試使用Fabrication,並遇到問題。寶石安裝得很好。在/spec/fabricators/employee_fabricator.rb我
Fabricator :employee do
end
而在my_controller_spec.rb我:
describe CasesController do
describe "viewing cases" do
before(:each) do
Fabricate(:employee)
end
it "allows viewing the cases index page" do
get 'index'
response.should_not be_success
end
end
end
當我運行在終端 '的RSpec規範',我得到:
Failures:
1) CasesController viewing cases allows viewing the cases index page
Failure/Error: Fabricate(:employee)
ArgumentError:
wrong number of arguments (2 for 1)
這是怎麼回事?我嘗試了各種排列,其中一些排除了其他錯誤,但沒有任何運行。沒有調用製造(:僱員)線,它按預期運行,但到目前爲止只有空測試...