Sha256: 33c2b6bf38b1ef11d798deacf0731b983cdc91bf57c2a488b8cafe0e8384fd03

Contents?: true

Size: 1007 Bytes

Versions: 6

Compression:

Stored size: 1007 Bytes

Contents

require 'helper'

class TestDataMapper < Test::Unit::TestCase

  def setup
    load_fixture 'data_mapper'
  end

  context 'for datamapper functionality' do

    should 'override default new_record? deprecation' do
      assert Account.new.respond_to?(:new_record?)
    end

    should 'check required fields' do
      errors = Account.create.errors
      assert_equal [:email, :role, :password, :password_confirmation], errors.keys
    end

    should 'correctly create an account' do
      account = Account.create(:email => "jack@metal.org", :role => "some", :password => "some", :password_confirmation => "some")
      assert account.valid?
    end

    should 'correctly authenticate an account' do
      account = Account.create(:email => "auth@lipsia.org", :role => "some", :password => "some", :password_confirmation => "some")
      assert_equal "some", account.password_clean
      account_r = Account.authenticate("auth@lipsia.org", "some")
      assert_equal account_r, account
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
padrino-admin-0.6.3 test/test_data_mapper.rb
padrino-admin-0.6.2 test/test_data_mapper.rb
padrino-admin-0.6.1 test/test_data_mapper.rb
padrino-admin-0.5.0 test/test_data_mapper.rb
padrino-admin-0.4.6 test/test_data_mapper.rb
padrino-admin-0.4.5 test/test_data_mapper.rb