小编Pri*_*tel的帖子

测试在rails应用程序中销毁对象时销毁关联记录

我坚持在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)

rspec ruby-on-rails railstutorial.org

8
推荐指数
2
解决办法
7269
查看次数

标签 统计

railstutorial.org ×1

rspec ×1

ruby-on-rails ×1