Sha256: a45e911222b2c2f48ba284af6034bfd540660bbc4a4fe25c24f946da6927b57b
Contents?: true
Size: 1.83 KB
Versions: 3
Compression:
Stored size: 1.83 KB
Contents
require File.expand_path("../../test_helper", __FILE__) class UserTest < ActiveModel::TestCase # include ActiveModel::Lint::Tests def setup super @model = Fauna::User.new @attributes = {:name => "Gurgi", :email => email, :password => password, :pockets => "Piggy treats."} end def test_create user = Fauna::User.create(@attributes) assert_equal "Gurgi", user.name assert user.persisted? assert user.ref end def test_save user = Fauna::User.new(@attributes) user.save assert user.persisted? end def test_update user = Fauna::User.new(@attributes) user.save user.update(:pockets => "Nothing") assert_equal "Nothing", user.pockets end def test_changes user = Fauna::User.new(@attributes) user.save user.update(:pockets => "Nothing") assert_equal user.changes.page.events.length, 2 end def test_find user = Fauna::User.create(@attributes) user1 = Fauna::User.find(user.ref) assert_equal user.ref, user1.ref assert user1.persisted? assert_equal user1.pockets, user.pockets end def test_destroy user = Fauna::User.create(@attributes) user.destroy assert user.destroyed? end def test_find_by_email user = Fauna::User.create(@attributes.merge(:email => "test@example.com")) assert_equal [user], Fauna::User.find_by_email("test@example.com") end def test_find_by_name user = Fauna::User.create(@attributes.merge(:name => "Gwystyl")) assert_equal [user], Fauna::User.find_by_name("Gwystyl") end def test_user_settings user = Fauna::User.create(@attributes) assert_equal user.settings.ref, "#{user.ref}/settings" end # def test_find_by_external_id # user = Fauna::User.create(@attributes.merge(:external_id => "henwen")) # assert_equal [user], Fauna::User.find_by_external_id("henwen") # end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fauna-0.1.2 | test/model/user_test.rb |
fauna-0.1.1 | test/model/user_test.rb |
fauna-0.1 | test/model/user_test.rb |