Guest User

Untitled

a guest
May 31st, 2018
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
  2.  
  3. describe Account do
  4. describe Account, "create" do
  5. before(:each) do
  6. Account.destroy_all
  7. end
  8. it "should be able to get created with username and password" do
  9. user = Account.create(:username => "seivan", :password => "asdasd")
  10. user.should be_valid
  11. end
  12. it "should be able to get created with email and password" do
  13. user = Account.create(:email => "seivan@kth.se", :password => "asdasd")
  14. user.should be_valid
  15. end
  16. end
  17. describe Account, "authentication" do
  18. before(:each) do
  19. Factory.create(:Account)
  20. end
  21. it "should be able to login with username and password" do
  22. user = Account.authenticate("seivan", "asdasd")
  23. user.should_not == nil
  24. end
  25. it "should be able to login with email and password" do
  26. user = Account.authenticate("seivan@kth.se", "asdasd")
  27. user.should_not == nil
  28. end
  29.  
  30. end
  31. end
Add Comment
Please, Sign In to add comment