When running the following test suite:
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
I get this error:
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)>'
Creating the user works in the console just fine and it responds to the methods.
You have a syntax error:
There should be no
.betweenUserand the opening parenthesis. Also you are missing the closing parenthesis. Try:If you wonder about the specific error message, in newer Ruby versions
.()works likecall: