mordor-auditing 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mordor-auditing (0.0.4)
5
- mordor (= 0.2.1)
4
+ mordor-auditing (0.0.5)
5
+ mordor (= 0.2.2)
6
6
 
7
7
  GEM
8
8
  specs:
@@ -13,7 +13,7 @@ GEM
13
13
  json (1.6.1)
14
14
  mongo (1.4.0)
15
15
  bson (= 1.4.0)
16
- mordor (0.2.1)
16
+ mordor (0.2.2)
17
17
  bson_ext
18
18
  extlib
19
19
  json
@@ -32,7 +32,7 @@ PLATFORMS
32
32
  ruby
33
33
 
34
34
  DEPENDENCIES
35
- mordor (= 0.2.1)
35
+ mordor (= 0.2.2)
36
36
  mordor-auditing!
37
37
  rake
38
38
  rspec (~> 2.0)
data/auditing.gemspec CHANGED
@@ -2,8 +2,8 @@ Gem::Specification.new do |s|
2
2
  s.name = "mordor-auditing"
3
3
 
4
4
  # Do not set the version and date field manually, this is done by the release script
5
- s.version = "0.0.5"
6
- s.date = "2011-12-27"
5
+ s.version = "0.0.6"
6
+ s.date = "2011-12-28"
7
7
 
8
8
  s.summary = "mordor-auditing"
9
9
  s.description = <<-eos
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
13
13
  s.add_development_dependency('rake')
14
14
  s.add_development_dependency('rspec', '~> 2.0')
15
15
 
16
- s.add_development_dependency('mordor', '0.2.1')
16
+ s.add_development_dependency('mordor', '0.2.2')
17
17
 
18
- s.add_runtime_dependency('mordor', '0.2.1')
18
+ s.add_runtime_dependency('mordor', '0.2.2')
19
19
 
20
20
  s.authors = ['Jan-Willem Koelewijn', 'Dirkjan Bussink']
21
21
  s.email = ['janwillem.koelewijn@nedap.com', 'dirkjan.bussink@nedap.com']
@@ -8,6 +8,7 @@ module Auditing
8
8
  attribute :changes
9
9
  attribute :action
10
10
  attribute :at, :index => true
11
+ attribute :timestamp, :timestamp => true, :index => true
11
12
 
12
13
  def request_id=(id)
13
14
  if id.is_a?(String) && id != ""
@@ -42,7 +43,8 @@ module Auditing
42
43
  :object_id => object_id,
43
44
  :changes => changes,
44
45
  :action => action,
45
- :at => at
46
+ :at => at,
47
+ :timestamp => timestamp
46
48
  }
47
49
  end
48
50
 
@@ -9,6 +9,7 @@ module Auditing
9
9
  attribute :user_id, :finder_method => :find_by_user, :index => true
10
10
  attribute :real_user_id, :index => true
11
11
  attribute :at, :index => true
12
+ attribute :timestamp, :timestamp => true, :index => true
12
13
 
13
14
  def to_hash
14
15
  {
@@ -18,7 +19,8 @@ module Auditing
18
19
  :url => url,
19
20
  :url_parts => url_parts,
20
21
  :method => method,
21
- :at => at
22
+ :at => at,
23
+ :timestamp => timestamp
22
24
  }
23
25
  end
24
26
 
@@ -55,6 +55,24 @@ describe "with respect to modifications" do
55
55
  end
56
56
  end
57
57
 
58
+ it "should have a timestamp attribute" do
59
+ Auditing::Request.timestamped_attribute.should_not be_nil
60
+ end
61
+
62
+ it "should add a timestamp value after creation" do
63
+ options = {
64
+ :object_type => 'String',
65
+ :object_id => 2,
66
+ :changes => {:length => [2, 4]},
67
+ :action => 'put',
68
+ :at => DateTime.now.to_time
69
+ }
70
+
71
+ mod = Auditing::Modification.create(options)
72
+ mod.timestamp.should_not be_nil
73
+ mod.timestamp.should_not == BSON::Timestamp.new(0,0)
74
+ end
75
+
58
76
  context "with respect to saving and retrieving" do
59
77
  it "should correctly save the modification" do
60
78
  options = {
@@ -78,6 +78,19 @@ describe "with respect to auditing requests" do
78
78
  end
79
79
  end
80
80
 
81
+ it "should have a timestamp attribute" do
82
+ Auditing::Request.timestamped_attribute.should_not be_nil
83
+ end
84
+
85
+ it "should add a timestamp value after creation" do
86
+ options = {
87
+ :params => {:first => Date.today}
88
+ }
89
+ request = Auditing::Request.create(options)
90
+ request.timestamp.should_not be_nil
91
+ request.timestamp.should_not == BSON::Timestamp.new(0,0)
92
+ end
93
+
81
94
  it "should correctly replace Date params with Times" do
82
95
  options = {
83
96
  :params => {:first => Date.today}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mordor-auditing
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jan-Willem Koelewijn
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-12-27 00:00:00 +01:00
19
+ date: 2011-12-28 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -56,12 +56,12 @@ dependencies:
56
56
  requirements:
57
57
  - - "="
58
58
  - !ruby/object:Gem::Version
59
- hash: 21
59
+ hash: 19
60
60
  segments:
61
61
  - 0
62
62
  - 2
63
- - 1
64
- version: 0.2.1
63
+ - 2
64
+ version: 0.2.2
65
65
  type: :development
66
66
  version_requirements: *id003
67
67
  - !ruby/object:Gem::Dependency
@@ -72,12 +72,12 @@ dependencies:
72
72
  requirements:
73
73
  - - "="
74
74
  - !ruby/object:Gem::Version
75
- hash: 21
75
+ hash: 19
76
76
  segments:
77
77
  - 0
78
78
  - 2
79
- - 1
80
- version: 0.2.1
79
+ - 2
80
+ version: 0.2.2
81
81
  type: :runtime
82
82
  version_requirements: *id004
83
83
  description: " Auditing classes based on the Mordor gem, used to audit requests and modifications on objects\n"