Advertisement
Guest User

Untitled

a guest
Mar 15th, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.76 KB | None | 0 0
  1. describe User do
  2.  
  3.   before do
  4.     @user = User.new(name: "Bob Raily", email: "brailt@example.com",
  5.                    password: "foobar", password_confirmation: "foobar")
  6.   end
  7.  
  8.   subject { @user }
  9.  
  10.   it { should respond_to(:name) }
  11.   it { should respond_to(:email) }
  12.   it { should respond_to(:password_digest) }
  13.   it { should respond_to(:password) }
  14.   it { should respond_to(:password_confirmation) }
  15.   it { should respond_to(:authenticate) }
  16.  
  17.   it { should be_valid }
  18.  
  19.   describe "when name is not present" do
  20.     before { @user.name = " " }
  21.     it { should_not be_valid }
  22.   end
  23.  
  24.   describe "when email is not present" do
  25.     before { @user.email = " " }
  26.     it { should_not be_valid }
  27.   end
  28.  
  29. # там ниже еще дохуя, но не суть
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement