Sha256: 6bcccf03229f74b9f3a270392f52091fc6df8a1b459c6c87fd1c09508d2a9231

Contents?: true

Size: 1001 Bytes

Versions: 8

Compression:

Stored size: 1001 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class UserActionObserverTest < Test::Unit::TestCase
  fixtures :users, :pages, :layouts, :snippets
  test_helper :users, :pages, :layouts, :snippets
  
  def setup
    @user = users(:existing)
    UserActionObserver.current_user = @user
    @page_title = 'User Action Test Page'
    destroy_test_user
    destroy_test_page
    destroy_test_layout
    destroy_test_snippet
  end
  
  def test_create
    [
      create_test_user,
      create_test_page,
      create_test_layout,
      create_test_snippet
    ].each do |model|
      assert_equal @user, model.created_by
    end
  end
  
  def test_update
    [
      users(:existing),
      pages(:homepage),
      layouts(:main),
      snippets(:first)
    ].each do |model|
      model.attributes = model.attributes.dup
      assert model.save, "Errors: #{model.errors.inspect}, Model: #{model.class.name}"
      assert_equal @user, model.updated_by, "Model: #{model.class.name}"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
radiant-0.5.1 test/unit/user_action_observer_test.rb
radiant-0.5.0 test/unit/user_action_observer_test.rb
radiant-0.6.0 test/unit/user_action_observer_test.rb
radiant-0.6.1 test/unit/user_action_observer_test.rb
radiant-0.5.2 test/unit/user_action_observer_test.rb
radiant-0.6.3 test/unit/user_action_observer_test.rb
radiant-0.6.2 test/unit/user_action_observer_test.rb
radiant-0.6.4 test/unit/user_action_observer_test.rb