0
爲什麼這個測試不通過?我使用設計進行身份驗證。設計rspec測試
user.rb
validates :username, presence: true, :length => { :minimum => 2 }
user_spec.rb
require 'spec_helper'
describe User do
before do
@user = User.new(username: "Example User", email: "[email protected]",
password: "foobar", password_confirmation: "foobar")
end
describe "name" do
before { @user.username="test" }
it { should be_valid }
end
end
[RSpec with devise]的可能重複(http://stackoverflow.com/questions/15209197/rspec-with-devise) – zetetic 2013-03-05 00:31:11