运行以下测试套件时:
require 'spec_helper'
describe User do
before { @user = User.(name: "Example User", email: "user@example.com" }
subject { @user }
it { should respond_to(:name) }
it { should respond_to(:email) }
end
我收到此错误:
Failure/Error: before { @user = User.(name: "Example User", email: "user@example.com") }
NoMethodError:
undefined method `call' for #<Class:0x007fdfd5dd8008>
# ./spec/models/user_spec.rb:15:in `block (2 levels) in <top (required)>'
创建用户在控制台中工作得很好,它响应方法。