Sha256: 59350d5274020c57bcd829138a6f3afff35c84bcfe9f5bb7a18bbfae8f2c0d77

Contents?: true

Size: 913 Bytes

Versions: 11

Compression:

Stored size: 913 Bytes

Contents

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

class AuditsController < ActionController::Base
  def audit
    @company = Company.create
    render :nothing => true
  end
  
  def update_user
    current_user.update_attributes({:password => 'foo'})
    render :nothing => true
  end
  
private
  attr_accessor :current_user
end
AuditsController.view_paths = [File.dirname(__FILE__)]
ActionController::Routing::Routes.draw {|m| m.connect ':controller/:action/:id' }

class AuditsControllerTest < ActionController::TestCase
  should "audit user" do
    user = @controller.send(:current_user=, create_user)
    lambda { post :audit }.should change { Audit.count }
    assigns(:company).audits.last.user.should == user
  end
  
  should "not save blank audits" do
    user = @controller.send(:current_user=, create_user)
    lambda { post :update_user }.should_not change { Audit.count }
  end
end

Version data entries

11 entries across 11 versions & 5 rubygems

Version Path
acts_as_audited_customized-1.3.2 test/audit_sweeper_test.rb
acts_as_audited_customized-1.3.1 test/audit_sweeper_test.rb
acts_as_audited_customized-1.2.2 test/audit_sweeper_test.rb
acts_as_audited_customized-1.2.1 test/audit_sweeper_test.rb
acts_as_audited_rails3-1.1.2 test/audit_sweeper_test.rb
acts_as_audited_rails3-1.1.1.5 test/audit_sweeper_test.rb
acts_as_audited_rails3-1.1.1.4 test/audit_sweeper_test.rb
ericperko-acts_as_audited-1.1.2 test/audit_sweeper_test.rb
htanata-acts_as_audited-1.1.1 test/audit_sweeper_test.rb
acts_as_audited-1.1.1 test/audit_sweeper_test.rb
acts_as_audited-1.1.0 test/audit_sweeper_test.rb