使用rspec的几个注意事项( tips using rspec in rails4 )
访问量: 3236
1. 务必使用 $ rails generate rspec:install, 会生成 一个 spec_helper 和一个 rails_helper, 不要改动他们
2. 务必修改 rails帮你生成好的 rspec文件。 把第一行的 spec_helper 改成 rails_helper
# require 'spec_helper' require 'rails_helper‘
否则在运行时会报错,找不到rails相关的东西
3. 如果使用了 devise, 务必要保证 users表有 email列。 不能使用 attr_accessible 等东西。
绕了个弯子,昨天耗费了将近2个小时。 记录下来。