我坚持在Michael Hartls ruby on rails教程(http://ruby.railstutorial.org/chapters/user-microposts#code-micropost_dependency_test)的10.15列表中进行测试.我的user_spec.rb如下
require 'spec_helper'
describe User do
before { @user = User.new(name: "Example User", email: "user@example.com",password: "foobar", password_confirmation: "foobar") }
subject { @user }
it { should respond_to(:name) }
it { should respond_to(:email) }
it { should respond_to(:password_digest) }
it { should respond_to(:password) }
it { should respond_to(:password_confirmation) }
it { should respond_to(:remember_token) }
it { should respond_to(:admin) }
it { should respond_to(:authenticate) }
it { should respond_to(:microposts) }
it { should be_valid }
it …Run Code Online (Sandbox Code Playgroud)