spec/models/user_spec.rb
require 'spec_helper' describe User do describe '#validate' do before :all do @user = FactoryGirl.build(:user) end it "正常に保存できる" do expect(@user.save).to be true end context 'login_name' do it '数字のみ' do @user.login_name = '11111' end it '英字のみ' do @user.login_name = 'ssss' end it '最初の文字は英字' do @user.login_name = '111aaa' end it '必須' do @user.login_name = '' end after :each do expect(@user.save).to be false end end after :all do User.delete_all end end end
( ̄(エ) ̄)彡☆
0 件のコメント:
コメントを投稿