audit_rails 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -6
- data/app/assets/javascripts/audit_rails/application.js +4 -0
- data/app/assets/javascripts/audit_rails/date-picker.js +20 -0
- data/app/assets/javascripts/audit_rails/jquery-ui.js +15003 -0
- data/app/assets/stylesheets/audit_rails/application.css +2 -0
- data/app/assets/stylesheets/audit_rails/audit_rails.css +3 -0
- data/app/assets/stylesheets/audit_rails/date-picker.css +3 -0
- data/app/assets/stylesheets/audit_rails/jquery-ui.css +1177 -0
- data/app/controllers/audit_rails/audits_controller.rb +5 -3
- data/app/models/audit_rails/audit.rb +8 -0
- data/app/views/audit_rails/audits/analytics.html.erb +24 -12
- data/config/routes.rb +1 -1
- data/lib/audit_rails/version.rb +1 -1
- data/spec/controllers/audit_rails/audits_controller_spec.rb +6 -5
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +30 -0
- data/spec/dummy/log/test.log +4001 -0
- data/spec/models/audit_rails/audit_spec.rb +25 -0
- data/spec/spec_helper.rb +0 -2
- metadata +8 -20
- data/app/assets/stylesheets/audit_rails/scaffold.css +0 -56
- data/spec/factories/audits.rb +0 -10
@@ -12,6 +12,31 @@ describe AuditRails::Audit do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
describe ".in_range" do
|
16
|
+
# Not testing ActiveRecord, but need to make sure in_range is present and implemented correctly
|
17
|
+
before(:each) do
|
18
|
+
audit_1 = AuditRails::Audit.create!(:action => action = "login", :user_name => user = "John Smith")
|
19
|
+
audit_2 = AuditRails::Audit.create!(:action => action = "login", :user_name => user = "John Smith")
|
20
|
+
audit_3 = AuditRails::Audit.create!(:action => action = "login", :user_name => user = "John Smith")
|
21
|
+
|
22
|
+
audit_1.update_attribute('created_at', 2.days.ago)
|
23
|
+
audit_2.update_attribute('created_at', 3.days.ago)
|
24
|
+
audit_3.update_attribute('created_at', 5.days.ago)
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'returns audits created in a given date range in string format' do
|
28
|
+
AuditRails::Audit.in_range(4.days.ago.strftime('%Y-%m-%d'), 1.days.ago.strftime('%Y-%m-%d')).count.should == 2
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'returns audits created in a given date range in date format' do
|
32
|
+
AuditRails::Audit.in_range(4.days.ago, 1.days.ago).count.should == 2
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns all audits when range is nil' do
|
36
|
+
AuditRails::Audit.in_range(nil, nil).count.should == 3
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
15
40
|
describe ".analysis_by_user_name" do
|
16
41
|
it "returns users and count for all audits in the system" do
|
17
42
|
john = "John Smith"
|
data/spec/spec_helper.rb
CHANGED
@@ -17,8 +17,6 @@ ENV["RAILS_ENV"] ||= 'test'
|
|
17
17
|
require File.expand_path("../../spec/dummy/config/environment", __FILE__)
|
18
18
|
require 'rspec/rails'
|
19
19
|
require 'rspec/autorun'
|
20
|
-
require 'factory_girl'
|
21
|
-
require 'factory_girl_rails'
|
22
20
|
|
23
21
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
24
22
|
# in spec/support/ and its subdirectories.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audit_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gourav Tiwari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09
|
11
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -100,20 +100,6 @@ dependencies:
|
|
100
100
|
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
|
-
- !ruby/object:Gem::Dependency
|
104
|
-
name: factory_girl_rails
|
105
|
-
requirement: !ruby/object:Gem::Requirement
|
106
|
-
requirements:
|
107
|
-
- - '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
type: :development
|
111
|
-
prerelease: false
|
112
|
-
version_requirements: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - '>='
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
103
|
- !ruby/object:Gem::Dependency
|
118
104
|
name: spork
|
119
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,8 +209,12 @@ files:
|
|
223
209
|
- app/assets/javascripts/audit_rails/application.js
|
224
210
|
- app/assets/javascripts/audit_rails/audit.js
|
225
211
|
- app/assets/javascripts/audit_rails/Chart.min.js
|
212
|
+
- app/assets/javascripts/audit_rails/date-picker.js
|
213
|
+
- app/assets/javascripts/audit_rails/jquery-ui.js
|
226
214
|
- app/assets/stylesheets/audit_rails/application.css
|
227
|
-
- app/assets/stylesheets/audit_rails/
|
215
|
+
- app/assets/stylesheets/audit_rails/audit_rails.css
|
216
|
+
- app/assets/stylesheets/audit_rails/date-picker.css
|
217
|
+
- app/assets/stylesheets/audit_rails/jquery-ui.css
|
228
218
|
- app/controllers/audit_rails/application_controller.rb
|
229
219
|
- app/controllers/audit_rails/audits_controller.rb
|
230
220
|
- app/helpers/audit_rails/application_helper.rb
|
@@ -279,7 +269,6 @@ files:
|
|
279
269
|
- spec/dummy/Rakefile
|
280
270
|
- spec/dummy/README.rdoc
|
281
271
|
- spec/dummy/script/rails
|
282
|
-
- spec/factories/audits.rb
|
283
272
|
- spec/models/audit_rails/audit_spec.rb
|
284
273
|
- spec/spec_helper.rb
|
285
274
|
homepage: https://github.com/gouravtiwari/audit_rails
|
@@ -301,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
290
|
- !ruby/object:Gem::Version
|
302
291
|
version: '0'
|
303
292
|
requirements: []
|
304
|
-
rubyforge_project:
|
293
|
+
rubyforge_project: arails
|
305
294
|
rubygems_version: 2.0.6
|
306
295
|
signing_key:
|
307
296
|
specification_version: 4
|
@@ -342,6 +331,5 @@ test_files:
|
|
342
331
|
- spec/dummy/Rakefile
|
343
332
|
- spec/dummy/README.rdoc
|
344
333
|
- spec/dummy/script/rails
|
345
|
-
- spec/factories/audits.rb
|
346
334
|
- spec/models/audit_rails/audit_spec.rb
|
347
335
|
- spec/spec_helper.rb
|
@@ -1,56 +0,0 @@
|
|
1
|
-
body { background-color: #fff; color: #333; }
|
2
|
-
|
3
|
-
body, p, ol, ul, td {
|
4
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
5
|
-
font-size: 13px;
|
6
|
-
line-height: 18px;
|
7
|
-
}
|
8
|
-
|
9
|
-
pre {
|
10
|
-
background-color: #eee;
|
11
|
-
padding: 10px;
|
12
|
-
font-size: 11px;
|
13
|
-
}
|
14
|
-
|
15
|
-
a { color: #000; }
|
16
|
-
a:visited { color: #666; }
|
17
|
-
a:hover { color: #fff; background-color:#000; }
|
18
|
-
|
19
|
-
div.field, div.actions {
|
20
|
-
margin-bottom: 10px;
|
21
|
-
}
|
22
|
-
|
23
|
-
#notice {
|
24
|
-
color: green;
|
25
|
-
}
|
26
|
-
|
27
|
-
.field_with_errors {
|
28
|
-
padding: 2px;
|
29
|
-
background-color: red;
|
30
|
-
display: table;
|
31
|
-
}
|
32
|
-
|
33
|
-
#error_explanation {
|
34
|
-
width: 450px;
|
35
|
-
border: 2px solid red;
|
36
|
-
padding: 7px;
|
37
|
-
padding-bottom: 0;
|
38
|
-
margin-bottom: 20px;
|
39
|
-
background-color: #f0f0f0;
|
40
|
-
}
|
41
|
-
|
42
|
-
#error_explanation h2 {
|
43
|
-
text-align: left;
|
44
|
-
font-weight: bold;
|
45
|
-
padding: 5px 5px 5px 15px;
|
46
|
-
font-size: 12px;
|
47
|
-
margin: -7px;
|
48
|
-
margin-bottom: 0px;
|
49
|
-
background-color: #c00;
|
50
|
-
color: #fff;
|
51
|
-
}
|
52
|
-
|
53
|
-
#error_explanation ul li {
|
54
|
-
font-size: 12px;
|
55
|
-
list-style: square;
|
56
|
-
}
|
data/spec/factories/audits.rb
DELETED