-
-
Save itspriddle/6009d955f7a4c6372ef6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/auditor (master) > rake | |
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+) | |
/Users/priddle/.rvm/rubies/ruby-1.8.7-p352/bin/ruby -S bundle exec rspec -fs --color ./spec/audit_spec.rb ./spec/auditable_spec.rb ./spec/config_spec.rb ./spec/recorder_spec.rb ./spec/status_spec.rb ./spec/user_spec.rb | |
-- create_table(:users, {:force=>true}) | |
-> 0.0103s | |
-- create_table(:models, {:force=>true}) | |
-> 0.0029s | |
-- create_table(:audits, {:force=>true}) | |
-> 0.0081s | |
-- add_index(:audits, [:auditable_id, :auditable_type], {:name=>"auditable_index"}) | |
-> 0.0030s | |
-- add_index(:audits, [:user_id, :user_type], {:name=>"user_index"}) | |
-> 0.0026s | |
-- add_index(:audits, :created_at) | |
-> 0.0021s | |
Audit | |
should set the version number on save | |
should provide access to the audited model object | |
should provide access to the user associated with the audit | |
should create a snapshot of the audited objects attributes at the time of the audit | |
modifying scope | |
should return all audit records that were a result of modifying the audited object attributes (FAILED - 1) | |
predecessors scope | |
should return all previous audit records for the same auditable | |
Auditor::Auditable | |
should audit find | |
should audit create | |
should audit update | |
should audit destroy | |
should allow multiple actions to be specified with one audit statment | |
should record the comment returned from a comment block | |
should provide the model object and user as parameters to the comment block | |
should provide a snapshot of the object attributes at a given date or time | |
should not save an update record that does not have any audited changes | |
Auditor::Config | |
Configuration | |
should parse actions and options from a config array | |
should parse actions and options from a config array when options are absent | |
should parse actions | |
Configuration Validation | |
should raise a Auditor::Error if no action is specified | |
should raise a Auditor::Error if an invalid action is specified | |
Auditor::Recorder | |
should create an audit record for create actions | |
should create an audit record for find actions | |
should create an audit record for update actions | |
should create an audit record for destroy actions | |
should set comment details to nil if they are not given | |
should not save change details for excepted attributes | |
should only save change details for onlyed attributes | |
should associate audit records with an owner | |
should pass the model, user, and action to any supplied block | |
Auditor::Status | |
should be enabled if set to enabled | |
should be disabled if set to disabled | |
should allow auditing as a specified user for a block of code | |
should allow a block of code to be executed with auditing disabled | |
should allow a block of code to be executed with auditing enabled | |
Auditor::User | |
should return the same user that's set on the same thread | |
should not return the same user from a different thread | |
Failures: | |
1) Audit modifying scope should return all audit records that were a result of modifying the audited object attributes | |
Failure/Error: Audit.modifying.should_not include(audit3) | |
expected [#<Audit id: 1, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "create", audited_changes: {"name"=>[nil, "n0"]}, version: 1, comment: nil, created_at: "2011-09-20 09:30:48">, #<Audit id: 2, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "update", audited_changes: {"name"=>["n0", "n1"], "value"=>[nil, "v1"]}, version: 2, comment: nil, created_at: "2011-09-20 09:30:48">, #<Audit id: 3, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "find", audited_changes: nil, version: 2, comment: nil, created_at: "2011-09-20 09:30:48">, #<Audit id: 4, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "update", audited_changes: {"value"=>[nil, "v2"]}, version: 3, comment: nil, created_at: "2011-09-20 09:30:48">] not to include #<Audit id: 3, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: :find, audited_changes: nil, version: 2, comment: nil, created_at: "2011-09-20 09:30:48"> | |
Diff: | |
@@ -1,2 +1,2 @@ | |
-#<Audit id: 3, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: :find, audited_changes: nil, version: 2, comment: nil, created_at: "2011-09-20 09:30:48"> | |
+[#<Audit id: 1, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "create", audited_changes: {"name"=>[nil, "n0"]}, version: 1, comment: nil, created_at: "2011-09-20 09:30:48">, #<Audit id: 2, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "update", audited_changes: {"name"=>["n0", "n1"], "value"=>[nil, "v1"]}, version: 2, comment: nil, created_at: "2011-09-20 09:30:48">, #<Audit id: 3, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "find", audited_changes: nil, version: 2, comment: nil, created_at: "2011-09-20 09:30:48">, #<Audit id: 4, auditable_id: 1, auditable_type: "Model", owner_id: 1, owner_type: "Model", user_id: 1, user_type: "User", action: "update", audited_changes: {"value"=>[nil, "v2"]}, version: 3, comment: nil, created_at: "2011-09-20 09:30:48">] | |
# ./spec/audit_spec.rb:44 | |
# ./spec/support/transactional_specs.rb:8:in `call' | |
# ./spec/support/transactional_specs.rb:8:in `included' | |
# ./spec/support/transactional_specs.rb:6:in `included' | |
# ./spec/support/transactional_specs.rb:8:in `call' | |
# ./spec/support/transactional_specs.rb:8:in `included' | |
# ./spec/support/transactional_specs.rb:6:in `included' | |
Finished in 0.76417 seconds | |
36 examples, 1 failure | |
rake aborted! | |
ruby -S bundle exec rspec -fs --color ./spec/audit_spec.rb ./spec/auditable_spec.rb ./spec/config_spec.rb ./spec/recorder_spec.rb ./spec/status_spec.rb ./spec/user_spec.rb failed | |
Tasks: TOP => default => spec | |
(See full trace by running task with --trace) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment