Вот контроллер comm_logs 'create'
def create
if has_create_right?
@customer = Customer.find(params[:customer_id])
@comm_log = @customer.comm_log.new(params[:comm_log], :as => :roles_new)
@comm_log.input_by_id = session[:user_id]
if @comm_log.save
#send out email
redirect_to URI.escape("/view_handler?index=0&msg=Log saved!")
else
flash.now[:error] = "can't save log!"
render 'new'
end
else
redirect_to URI.escape("/view_handler?index=0&msg=insufficient rights!")
end
end
Код rspec:
describe "'create'" do
it "should be successful for sales member" do
session[:sales] = true
session[:user_id] = 1
session[:member] = true
customer = Factory(:customer)
log = Factory(:comm_log, :customer_id => customer.id)
get 'create', :customer_id => customer.id, :comm_log => log
response.should redirect_to URI.escape("/view_handler?index=0&msg=Log saved!")
end
end
Вот ошибка rspec:
1) CommLogsController 'create' should be successful for sales member
Failure/Error: get 'create', :customer_id => customer.id, :comm_log => log
NoMethodError:
undefined method `stringify_keys' for "1":String
# c:in `build'
# ./app/controllers/comm_logs_controller.rb:30:in `create'
# ./spec/controllers/comm_logs_controller_spec.rb:79:in `block (3 levels) in <top (required)>'
Точно такой же код (контроллер и rspec) работал для другого аналогичного контроллера.
Есть мысли о проблеме? Спасибо.