Sha256: 780b272ad6891c1c848a90aa96079c92b2a172d44cd330f833c0f2d18d14756e

Contents?: true

Size: 717 Bytes

Versions: 6

Compression:

Stored size: 717 Bytes

Contents

require 'test_helper'

class UserTest < ActiveSupport::TestCase
  test_data do
    puts "Loading test data in #{self}"
    user = Factory.create(:user, :login => 'testuser')
    
    5.times do
      Factory.create(:post, :user => user)
    end
  end

  should have_many(:posts)

  should "create properly from Factory" do
    assert user = Factory.create(:user)
  end
  
  should "delete all" do
    User.delete_all
    assert_equal 0, User.count
  end
  
  should "have have only the posts that belong to user and 2 from fixtures" do
    assert_equal 7, Post.count
    assert_equal 5, User.find_by_login!('testuser').posts.count
  end
  
  should "have one User present" do
    assert_equal 1, User.count
  end
end

Version data entries

6 entries across 3 versions & 1 rubygems

Version Path
transactionata-0.3.0 test/rails2/test/unit/user_test.rb
transactionata-0.3.0 test/rails3/test/unit/user_test.rb
transactionata-0.2.0 test/rails2/test/unit/user_test.rb
transactionata-0.2.0 test/rails3/test/unit/user_test.rb
transactionata-0.1.0 test/rails2/test/unit/user_test.rb
transactionata-0.1.0 test/rails3/test/unit/user_test.rb