audit_rails 2.0.0 → 2.0.1

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.
@@ -50,7 +50,7 @@ describe AuditRails::Audit do
50
50
  end
51
51
  end
52
52
 
53
- describe ".analysis_by_page_views" do
53
+ describe ".analysis_by_page_views" do
54
54
  it "returns controller-action and count for all audits in the system" do
55
55
  john = "John Smith"
56
56
  fake = "Fake User"
@@ -63,4 +63,48 @@ describe AuditRails::Audit do
63
63
  end
64
64
  end
65
65
 
66
+ describe ".analysis_per_user_by_page_views" do
67
+ it "returns counts by each page for all audited users in the system" do
68
+ john = "John Smith"
69
+ fake = "Fake User"
70
+ audit = 3.times{
71
+ AuditRails::Audit.create!(:action => action = "visit", :user_name => john, :controller => 'home')
72
+ AuditRails::Audit.create!(:action => action = "visit", :user_name => john, :controller => 'session')
73
+ AuditRails::Audit.create!(:action => action = "login", :user_name => fake, :controller => 'session')
74
+ }
75
+
76
+ AuditRails::Audit.analysis_per_user_by_page_views.should == "{\"Fake User\":[{\"page\":\"session/login\",\"count\":3}],"+
77
+ "\"John Smith\":[{\"page\":\"home/visit\",\"count\":3},"+
78
+ "{\"page\":\"session/visit\",\"count\":3}]}"
79
+ end
80
+ end
81
+
82
+ describe ".unique_visitor_count" do
83
+ it "returns unique visitor count in the system by ip address" do
84
+ john = "John Smith"
85
+ fake = "Fake User"
86
+ audit = 3.times{
87
+ AuditRails::Audit.create!(:action => action = "visit", :user_name => john, :controller => 'home', :ip_address =>'127.0.0.1')
88
+ AuditRails::Audit.create!(:action => action = "visit", :user_name => john, :controller => 'session', :ip_address =>'127.0.0.2')
89
+ AuditRails::Audit.create!(:action => action = "login", :user_name => fake, :controller => 'session', :ip_address =>'127.0.0.3')
90
+ }
91
+
92
+ AuditRails::Audit.unique_visitor_count.should == 3
93
+ end
94
+ end
95
+
96
+ describe ".visitor_count" do
97
+ it "returns total visitor count in the system" do
98
+ john = "John Smith"
99
+ fake = "Fake User"
100
+ audit = 3.times{
101
+ AuditRails::Audit.create!(:action => action = "visit", :user_name => john, :controller => 'home', :ip_address =>'127.0.0.1')
102
+ AuditRails::Audit.create!(:action => action = "visit", :user_name => john, :controller => 'session', :ip_address =>'127.0.0.2')
103
+ AuditRails::Audit.create!(:action => action = "login", :user_name => fake, :controller => 'session', :ip_address =>'127.0.0.3')
104
+ }
105
+
106
+ AuditRails::Audit.visitor_count.should == 9
107
+ end
108
+ end
109
+
66
110
  end
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: 2.0.0
4
+ version: 2.0.1
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-11-21 00:00:00.000000000 Z
11
+ date: 2013-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -232,6 +232,8 @@ files:
232
232
  - app/assets/javascripts/audit_rails/d3/d3.v3.js
233
233
  - app/assets/javascripts/audit_rails/date-picker.js
234
234
  - app/assets/javascripts/audit_rails/jquery-ui.js
235
+ - app/assets/javascripts/audit_rails/page-view-user-contribution.js
236
+ - app/assets/javascripts/audit_rails/page-views-for-user.js
235
237
  - app/assets/javascripts/audit_rails/page-views.js
236
238
  - app/assets/javascripts/audit_rails/user-counts.js
237
239
  - app/assets/stylesheets/audit_rails/application.css
@@ -251,6 +253,9 @@ files:
251
253
  - app/views/audit_rails/audits/_list.html.erb
252
254
  - app/views/audit_rails/audits/_no_audits_available.html.erb
253
255
  - app/views/audit_rails/audits/_page_views.html.erb
256
+ - app/views/audit_rails/audits/_page_views_by_user_bar.html.erb
257
+ - app/views/audit_rails/audits/_page_views_by_user_pie.html.erb
258
+ - app/views/audit_rails/audits/_sub_menu.html.erb
254
259
  - app/views/audit_rails/audits/_user_clicks.html.erb
255
260
  - app/views/audit_rails/audits/analytics.html.erb
256
261
  - app/views/audit_rails/audits/index.html.erb