paper_trail_manager 0.1.4 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,16 +1,44 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
- gem "rails", "~> 3.0"
4
- gem "paper_trail", "~> 2.0"
5
- gem "will_paginate", "~> 3.0.pre2"
3
+ gem 'rake'
4
+ gem 'rails', '~> 3.0.0'
5
+ gem 'paper_trail', '~> 2.0'
6
+ gem 'will_paginate', '~> 3.0.pre2'
6
7
 
7
- group *[:development, :test] do
8
- gem "capybara", ">= 0.4.0"
9
- gem "factory_girl_rails", "~> 1.1.beta1"
10
- gem "jeweler", "~> 1.5.2"
11
- gem "rdoc"
12
- gem "rspec-rails", "~> 2.5.0"
13
- gem "ruby-debug"
14
- gem "spork", "~> 0.9.0.rc"
15
- gem "sqlite3-ruby", :require => "sqlite3"
8
+ group :development do
9
+ gem 'rdoc'
10
+ gem 'jeweler', '~> 1.8.4'
11
+ gem 'sqlite3-ruby', :require => 'sqlite3'
12
+
13
+ # Guard and plugins
14
+ gem 'guard'
15
+ gem 'guard-rspec'
16
+ gem 'guard-spork'
17
+
18
+ # Guard notifier
19
+ case RUBY_PLATFORM
20
+ when /-*darwin.*/ then gem 'growl'
21
+ when /-*linux.*/ then gem 'libnotify'
22
+ end
23
+
24
+ # OPTIONAL LIBRARIES: These libraries upset travis-ci and may cause Ruby or
25
+ # RVM to hang, so only use them when needed.
26
+ if ENV['DEBUGGER']
27
+ platform :mri_18 do
28
+ gem 'rcov', :require => false
29
+ gem 'ruby-debug'
30
+ end
31
+
32
+ platform :mri_19 do
33
+ gem 'simplecov', :require => false
34
+ gem 'debugger-ruby_core_source'
35
+ gem 'debugger'
36
+ end
37
+ end
38
+ end
39
+
40
+ group :test do
41
+ gem 'factory_girl_rails', '~> 1.7.0'
42
+ gem 'rspec-rails', '~> 2.11.0'
43
+ gem 'spork', '~> 0.9.2'
16
44
  end
data/Gemfile.lock CHANGED
@@ -2,144 +2,141 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  abstract (1.0.0)
5
- actionmailer (3.0.9)
6
- actionpack (= 3.0.9)
5
+ actionmailer (3.0.17)
6
+ actionpack (= 3.0.17)
7
7
  mail (~> 2.2.19)
8
- actionpack (3.0.9)
9
- activemodel (= 3.0.9)
10
- activesupport (= 3.0.9)
8
+ actionpack (3.0.17)
9
+ activemodel (= 3.0.17)
10
+ activesupport (= 3.0.17)
11
11
  builder (~> 2.1.2)
12
12
  erubis (~> 2.6.6)
13
13
  i18n (~> 0.5.0)
14
- rack (~> 1.2.1)
14
+ rack (~> 1.2.5)
15
15
  rack-mount (~> 0.6.14)
16
16
  rack-test (~> 0.5.7)
17
17
  tzinfo (~> 0.3.23)
18
- activemodel (3.0.9)
19
- activesupport (= 3.0.9)
18
+ activemodel (3.0.17)
19
+ activesupport (= 3.0.17)
20
20
  builder (~> 2.1.2)
21
21
  i18n (~> 0.5.0)
22
- activerecord (3.0.9)
23
- activemodel (= 3.0.9)
24
- activesupport (= 3.0.9)
22
+ activerecord (3.0.17)
23
+ activemodel (= 3.0.17)
24
+ activesupport (= 3.0.17)
25
25
  arel (~> 2.0.10)
26
26
  tzinfo (~> 0.3.23)
27
- activeresource (3.0.9)
28
- activemodel (= 3.0.9)
29
- activesupport (= 3.0.9)
30
- activesupport (3.0.9)
27
+ activeresource (3.0.17)
28
+ activemodel (= 3.0.17)
29
+ activesupport (= 3.0.17)
30
+ activesupport (3.0.17)
31
31
  arel (2.0.10)
32
32
  builder (2.1.2)
33
- capybara (0.4.1.2)
34
- celerity (>= 0.7.9)
35
- culerity (>= 0.2.4)
36
- mime-types (>= 1.16)
37
- nokogiri (>= 1.3.3)
38
- rack (>= 1.0.0)
39
- rack-test (>= 0.5.4)
40
- selenium-webdriver (>= 0.0.27)
41
- xpath (~> 0.1.3)
42
- celerity (0.8.8)
43
- childprocess (0.1.8)
44
- ffi (~> 1.0.6)
45
- columnize (0.3.2)
46
- culerity (0.2.15)
47
- diff-lcs (1.1.2)
33
+ diff-lcs (1.1.3)
48
34
  erubis (2.6.6)
49
35
  abstract (>= 1.0.0)
50
- factory_girl (2.0.0.beta2)
51
- factory_girl_rails (1.1.beta1)
52
- factory_girl (~> 2.0.0.beta)
53
- rails (>= 3.0.0)
54
- ffi (1.0.7)
55
- rake (>= 0.8.7)
36
+ factory_girl (2.6.4)
37
+ activesupport (>= 2.3.9)
38
+ factory_girl_rails (1.7.0)
39
+ factory_girl (~> 2.6.0)
40
+ railties (>= 3.0.0)
41
+ ffi (1.0.11)
56
42
  git (1.2.5)
43
+ guard (1.3.0)
44
+ listen (>= 0.4.2)
45
+ thor (>= 0.14.6)
46
+ guard-rspec (1.2.1)
47
+ guard (>= 1.1)
48
+ guard-spork (1.1.0)
49
+ guard (>= 1.1)
50
+ spork (>= 0.8.4)
57
51
  i18n (0.5.0)
58
- jeweler (1.5.2)
59
- bundler (~> 1.0.0)
52
+ jeweler (1.8.4)
53
+ bundler (~> 1.0)
60
54
  git (>= 1.2.5)
61
55
  rake
62
- json_pure (1.5.1)
63
- linecache (0.43)
56
+ rdoc
57
+ json (1.7.4)
58
+ libnotify (0.7.4)
59
+ ffi (~> 1.0.11)
60
+ listen (0.4.7)
61
+ rb-fchange (~> 0.0.5)
62
+ rb-fsevent (~> 0.9.1)
63
+ rb-inotify (~> 0.8.8)
64
64
  mail (2.2.19)
65
65
  activesupport (>= 2.3.6)
66
66
  i18n (>= 0.4.0)
67
67
  mime-types (~> 1.16)
68
68
  treetop (~> 1.4.8)
69
- mime-types (1.16)
70
- nokogiri (1.4.4)
71
- paper_trail (2.0.2)
72
- rails (~> 3)
73
- polyglot (0.3.1)
74
- rack (1.2.2)
69
+ mime-types (1.19)
70
+ paper_trail (2.6.3)
71
+ activerecord (~> 3.0)
72
+ railties (~> 3.0)
73
+ polyglot (0.3.3)
74
+ rack (1.2.5)
75
75
  rack-mount (0.6.14)
76
76
  rack (>= 1.0.0)
77
77
  rack-test (0.5.7)
78
78
  rack (>= 1.0)
79
- rails (3.0.9)
80
- actionmailer (= 3.0.9)
81
- actionpack (= 3.0.9)
82
- activerecord (= 3.0.9)
83
- activeresource (= 3.0.9)
84
- activesupport (= 3.0.9)
79
+ rails (3.0.17)
80
+ actionmailer (= 3.0.17)
81
+ actionpack (= 3.0.17)
82
+ activerecord (= 3.0.17)
83
+ activeresource (= 3.0.17)
84
+ activesupport (= 3.0.17)
85
85
  bundler (~> 1.0)
86
- railties (= 3.0.9)
87
- railties (3.0.9)
88
- actionpack (= 3.0.9)
89
- activesupport (= 3.0.9)
86
+ railties (= 3.0.17)
87
+ railties (3.0.17)
88
+ actionpack (= 3.0.17)
89
+ activesupport (= 3.0.17)
90
90
  rake (>= 0.8.7)
91
91
  rdoc (~> 3.4)
92
92
  thor (~> 0.14.4)
93
- rake (0.9.2)
94
- rdoc (3.7)
95
- rspec (2.5.0)
96
- rspec-core (~> 2.5.0)
97
- rspec-expectations (~> 2.5.0)
98
- rspec-mocks (~> 2.5.0)
99
- rspec-core (2.5.1)
100
- rspec-expectations (2.5.0)
101
- diff-lcs (~> 1.1.2)
102
- rspec-mocks (2.5.0)
103
- rspec-rails (2.5.0)
104
- actionpack (~> 3.0)
105
- activesupport (~> 3.0)
106
- railties (~> 3.0)
107
- rspec (~> 2.5.0)
108
- ruby-debug (0.10.4)
109
- columnize (>= 0.1)
110
- ruby-debug-base (~> 0.10.4.0)
111
- ruby-debug-base (0.10.4)
112
- linecache (>= 0.3)
113
- rubyzip (0.9.4)
114
- selenium-webdriver (0.1.4)
115
- childprocess (>= 0.1.7)
116
- ffi (>= 1.0.7)
117
- json_pure
118
- rubyzip
119
- spork (0.9.0.rc4)
120
- sqlite3 (1.3.3)
93
+ rake (0.9.2.2)
94
+ rb-fchange (0.0.5)
95
+ ffi
96
+ rb-fsevent (0.9.1)
97
+ rb-inotify (0.8.8)
98
+ ffi (>= 0.5.0)
99
+ rdoc (3.12)
100
+ json (~> 1.4)
101
+ rspec (2.11.0)
102
+ rspec-core (~> 2.11.0)
103
+ rspec-expectations (~> 2.11.0)
104
+ rspec-mocks (~> 2.11.0)
105
+ rspec-core (2.11.1)
106
+ rspec-expectations (2.11.2)
107
+ diff-lcs (~> 1.1.3)
108
+ rspec-mocks (2.11.1)
109
+ rspec-rails (2.11.0)
110
+ actionpack (>= 3.0)
111
+ activesupport (>= 3.0)
112
+ railties (>= 3.0)
113
+ rspec (~> 2.11.0)
114
+ spork (0.9.2)
115
+ sqlite3 (1.3.6)
121
116
  sqlite3-ruby (1.3.3)
122
117
  sqlite3 (>= 1.3.3)
123
118
  thor (0.14.6)
124
- treetop (1.4.9)
119
+ treetop (1.4.10)
120
+ polyglot
125
121
  polyglot (>= 0.3.1)
126
- tzinfo (0.3.29)
127
- will_paginate (3.0.pre2)
128
- xpath (0.1.3)
129
- nokogiri (~> 1.3)
122
+ tzinfo (0.3.33)
123
+ will_paginate (3.0.3)
130
124
 
131
125
  PLATFORMS
132
126
  ruby
133
127
 
134
128
  DEPENDENCIES
135
- capybara (>= 0.4.0)
136
- factory_girl_rails (~> 1.1.beta1)
137
- jeweler (~> 1.5.2)
129
+ factory_girl_rails (~> 1.7.0)
130
+ guard
131
+ guard-rspec
132
+ guard-spork
133
+ jeweler (~> 1.8.4)
134
+ libnotify
138
135
  paper_trail (~> 2.0)
139
- rails (~> 3.0)
136
+ rails (~> 3.0.0)
137
+ rake
140
138
  rdoc
141
- rspec-rails (~> 2.5.0)
142
- ruby-debug
143
- spork (~> 0.9.0.rc)
139
+ rspec-rails (~> 2.11.0)
140
+ spork (~> 0.9.2)
144
141
  sqlite3-ruby
145
142
  will_paginate (~> 3.0.pre2)
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
+ [![Build Status](https://secure.travis-ci.org/igal/paper_trail_manager.png)](http://travis-ci.org/igal/paper_trail_manager)
2
+
1
3
  PaperTrailManager
2
4
  ================
3
5
 
4
6
  Browse, subscribe, view and revert changes to records when using Ruby on Rails 3 and the `paper_trail` gem.
5
7
 
6
- **WARNING**: This is alpha-quality software. There are tests, it's useful, but it could use more work.
8
+ This software has been in use for a year at http://calagator.org and http://epdx.org. It works well. It has reasonable tests. However, it could definitely use more work.
7
9
 
8
10
  Installation
9
11
  ------------
@@ -11,8 +13,7 @@ Installation
11
13
  If you have a Ruby on Rails 3 application where you're using the `paper_trail` gem to track changes to your records, you can make use of this like:
12
14
 
13
15
  Add the following line to your `Gemfile`:
14
-
15
- gem 'paper_trail_manager', :git => 'https://github.com/igal/paper_trail_manager.git'
16
+ gem 'paper_trail_manager'
16
17
 
17
18
  Install the libary:
18
19
 
data/Rakefile CHANGED
@@ -1,4 +1,20 @@
1
1
  # encoding: UTF-8
2
+
3
+ =begin
4
+ RELEASE PROCESS
5
+ ---------------
6
+
7
+ * Update VERSION file
8
+ * % rm -f Gemfile.lock; bundle
9
+ * % bundle exec rake gemspec build spec
10
+ * % bundle exec rake install
11
+ * Commit any changes
12
+ * % git tag v`cat VERSION`
13
+ * % git push --tags
14
+ * % bundle exec rake release
15
+ * % gem push $GEM
16
+ =end
17
+
2
18
  require 'rubygems'
3
19
  begin
4
20
  require 'bundler/setup'
@@ -44,9 +60,3 @@ namespace :spork do
44
60
  exec "spork"
45
61
  end
46
62
  end
47
-
48
- desc "Freshen files like Gemfile.lock and .gemspec"
49
- task :freshen do
50
- sh "bundle check || bundle --local || bundle update --local || bundle update"
51
- Rake::Task['gemspec'].invoke
52
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.6
@@ -1,4 +1,7 @@
1
1
  class PaperTrailManager::ChangesController < ApplicationController
2
+ # Default number of changes to list on a pagenated index page.
3
+ PER_PAGE = 50
4
+
2
5
  # List changes
3
6
  def index
4
7
  unless change_index_allowed?
@@ -14,7 +17,11 @@ class PaperTrailManager::ChangesController < ApplicationController
14
17
  @versions = @versions.where(:item_id => params[:id])
15
18
  end
16
19
 
17
- @versions = @versions.paginate(:page => params[:page], :per_page => 50)
20
+ # Ensure pagination parameters have sensible values
21
+ @page = (v = params[:page].to_i; v == 0 ? nil : v)
22
+ @per_page = (v = params[:per_page].to_i; v == 0 ? PER_PAGE : v)
23
+
24
+ @versions = @versions.paginate(:page => @page, :per_page => @per_page)
18
25
 
19
26
  respond_to do |format|
20
27
  format.html # index.html.erb
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "paper_trail_manager"
8
- s.version = "0.1.4"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Igal Koshevoy"]
12
- s.date = "2011-10-14"
12
+ s.date = "2012-08-11"
13
13
  s.description = "A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications."
14
14
  s.email = "igal@pragmaticraft.com"
15
15
  s.extra_rdoc_files = [
@@ -112,97 +112,47 @@ Gem::Specification.new do |s|
112
112
  s.require_paths = ["lib"]
113
113
  s.rubygems_version = "1.8.11"
114
114
  s.summary = "A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications."
115
- s.test_files = [
116
- "spec/controllers/paper_trail_manager/changes_controller_spec.rb",
117
- "spec/dummy/app/controllers/application_controller.rb",
118
- "spec/dummy/app/controllers/entities_controller.rb",
119
- "spec/dummy/app/controllers/platforms_controller.rb",
120
- "spec/dummy/app/helpers/application_helper.rb",
121
- "spec/dummy/app/helpers/entities_helper.rb",
122
- "spec/dummy/app/helpers/platforms_helper.rb",
123
- "spec/dummy/app/models/entity.rb",
124
- "spec/dummy/app/models/platform.rb",
125
- "spec/dummy/config/application.rb",
126
- "spec/dummy/config/boot.rb",
127
- "spec/dummy/config/environment.rb",
128
- "spec/dummy/config/environments/development.rb",
129
- "spec/dummy/config/environments/production.rb",
130
- "spec/dummy/config/environments/test.rb",
131
- "spec/dummy/config/initializers/backtrace_silencers.rb",
132
- "spec/dummy/config/initializers/inflections.rb",
133
- "spec/dummy/config/initializers/mime_types.rb",
134
- "spec/dummy/config/initializers/secret_token.rb",
135
- "spec/dummy/config/initializers/session_store.rb",
136
- "spec/dummy/config/routes.rb",
137
- "spec/dummy/db/migrate/20110228091428_create_entities.rb",
138
- "spec/dummy/db/migrate/20110228093241_create_platforms.rb",
139
- "spec/dummy/db/migrate/20110228094444_create_versions.rb",
140
- "spec/dummy/db/schema.rb",
141
- "spec/dummy/spec/controllers/entities_controller_spec.rb",
142
- "spec/dummy/spec/controllers/platforms_controller_spec.rb",
143
- "spec/dummy/spec/helpers/entities_helper_spec.rb",
144
- "spec/dummy/spec/helpers/platforms_helper_spec.rb",
145
- "spec/dummy/spec/integration/navigation_spec.rb",
146
- "spec/dummy/spec/integration/paper_trail_manager_spec.rb",
147
- "spec/dummy/spec/models/entity_spec.rb",
148
- "spec/dummy/spec/models/platform_spec.rb",
149
- "spec/dummy/spec/requests/entities_spec.rb",
150
- "spec/dummy/spec/requests/platforms_spec.rb",
151
- "spec/dummy/spec/routing/entities_routing_spec.rb",
152
- "spec/dummy/spec/routing/platforms_routing_spec.rb",
153
- "spec/dummy/spec/views/entities/edit.html.erb_spec.rb",
154
- "spec/dummy/spec/views/entities/index.html.erb_spec.rb",
155
- "spec/dummy/spec/views/entities/new.html.erb_spec.rb",
156
- "spec/dummy/spec/views/entities/show.html.erb_spec.rb",
157
- "spec/dummy/spec/views/platforms/edit.html.erb_spec.rb",
158
- "spec/dummy/spec/views/platforms/index.html.erb_spec.rb",
159
- "spec/dummy/spec/views/platforms/new.html.erb_spec.rb",
160
- "spec/dummy/spec/views/platforms/show.html.erb_spec.rb",
161
- "spec/paper_trail_manager_spec.rb",
162
- "spec/spec_helper.rb",
163
- "spec/support/factories.rb"
164
- ]
165
115
 
166
116
  if s.respond_to? :specification_version then
167
117
  s.specification_version = 3
168
118
 
169
119
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
170
- s.add_runtime_dependency(%q<rails>, ["~> 3.0"])
120
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
121
+ s.add_runtime_dependency(%q<rails>, ["~> 3.0.0"])
171
122
  s.add_runtime_dependency(%q<paper_trail>, ["~> 2.0"])
172
123
  s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
173
- s.add_development_dependency(%q<capybara>, [">= 0.4.0"])
174
- s.add_development_dependency(%q<factory_girl_rails>, ["~> 1.1.beta1"])
175
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
176
124
  s.add_development_dependency(%q<rdoc>, [">= 0"])
177
- s.add_development_dependency(%q<rspec-rails>, ["~> 2.5.0"])
178
- s.add_development_dependency(%q<ruby-debug>, [">= 0"])
179
- s.add_development_dependency(%q<spork>, ["~> 0.9.0.rc"])
125
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
180
126
  s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
127
+ s.add_development_dependency(%q<guard>, [">= 0"])
128
+ s.add_development_dependency(%q<guard-rspec>, [">= 0"])
129
+ s.add_development_dependency(%q<guard-spork>, [">= 0"])
130
+ s.add_development_dependency(%q<libnotify>, [">= 0"])
181
131
  else
182
- s.add_dependency(%q<rails>, ["~> 3.0"])
132
+ s.add_dependency(%q<rake>, [">= 0"])
133
+ s.add_dependency(%q<rails>, ["~> 3.0.0"])
183
134
  s.add_dependency(%q<paper_trail>, ["~> 2.0"])
184
135
  s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
185
- s.add_dependency(%q<capybara>, [">= 0.4.0"])
186
- s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta1"])
187
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
188
136
  s.add_dependency(%q<rdoc>, [">= 0"])
189
- s.add_dependency(%q<rspec-rails>, ["~> 2.5.0"])
190
- s.add_dependency(%q<ruby-debug>, [">= 0"])
191
- s.add_dependency(%q<spork>, ["~> 0.9.0.rc"])
137
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
192
138
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
139
+ s.add_dependency(%q<guard>, [">= 0"])
140
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
141
+ s.add_dependency(%q<guard-spork>, [">= 0"])
142
+ s.add_dependency(%q<libnotify>, [">= 0"])
193
143
  end
194
144
  else
195
- s.add_dependency(%q<rails>, ["~> 3.0"])
145
+ s.add_dependency(%q<rake>, [">= 0"])
146
+ s.add_dependency(%q<rails>, ["~> 3.0.0"])
196
147
  s.add_dependency(%q<paper_trail>, ["~> 2.0"])
197
148
  s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
198
- s.add_dependency(%q<capybara>, [">= 0.4.0"])
199
- s.add_dependency(%q<factory_girl_rails>, ["~> 1.1.beta1"])
200
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
201
149
  s.add_dependency(%q<rdoc>, [">= 0"])
202
- s.add_dependency(%q<rspec-rails>, ["~> 2.5.0"])
203
- s.add_dependency(%q<ruby-debug>, [">= 0"])
204
- s.add_dependency(%q<spork>, ["~> 0.9.0.rc"])
150
+ s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
205
151
  s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
152
+ s.add_dependency(%q<guard>, [">= 0"])
153
+ s.add_dependency(%q<guard-rspec>, [">= 0"])
154
+ s.add_dependency(%q<guard-spork>, [">= 0"])
155
+ s.add_dependency(%q<libnotify>, [">= 0"])
206
156
  end
207
157
  end
208
158
 
@@ -1,8 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Navigation" do
4
- include Capybara
5
-
6
4
  it "should be a valid app" do
7
5
  ::Rails.application.should be_a(Dummy::Application)
8
6
  end
@@ -1,8 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe PaperTrailManager do
4
- include Capybara
5
-
6
4
  def version
7
5
  return assigns[:version]
8
6
  end
@@ -56,18 +54,51 @@ describe PaperTrailManager do
56
54
  context "index" do
57
55
  context "when getting all changes" do
58
56
  context "and authorized" do
59
- before(:all) { get changes_path }
57
+ context "and getting default index" do
58
+ before(:all) { get changes_path }
59
+
60
+ it "should have all changes" do
61
+ versions.size.should == 10
62
+ end
63
+
64
+ it "should have changes for all changed item types" do
65
+ item_types.should == ["Entity", "Platform"]
66
+ end
60
67
 
61
- it "should have all changes" do
62
- versions.size.should == 10
68
+ it "should order changes with newest and highest id at the top" do
69
+ versions.map(&:id).should == versions.sort_by { |o| [o.created_at, o.id] }.reverse.map(&:id)
70
+ end
63
71
  end
64
72
 
65
- it "should have changes for all changed item types" do
66
- item_types.should == ["Entity", "Platform"]
73
+ context "and getting paginated page" do
74
+ let(:page) { 2 }
75
+ let(:per_page) { 3 }
76
+
77
+ before(:all) { get changes_path(:page => page, :per_page => per_page) }
78
+
79
+ it "should set :page parameter" do
80
+ assigns[:page].should == page
81
+ end
82
+
83
+ it "should set :per_page parameter" do
84
+ assigns[:per_page].should == per_page
85
+ end
86
+
87
+ it "should retrieve only items for page" do
88
+ versions.size.should == per_page
89
+ end
67
90
  end
68
91
 
69
- it "should order changes with newest and highest id at the top" do
70
- versions.map(&:id).should == versions.sort_by { |o| [o.created_at, o.id] }.reverse.map(&:id)
92
+ context "and getting invalid pagination" do
93
+ before(:all) { get changes_path(:page => "Shanghai", :per_page => "Alice") }
94
+
95
+ it "should set default :page parameter" do
96
+ assigns[:page].should be_nil
97
+ end
98
+
99
+ it "should set default :per_page parameter" do
100
+ assigns[:per_page].should == PaperTrailManager::ChangesController::PER_PAGE
101
+ end
71
102
  end
72
103
  end
73
104
 
data/spec/spec_helper.rb CHANGED
@@ -58,11 +58,6 @@ ActionMailer::Base.default_url_options[:host] = "test.com"
58
58
 
59
59
  Rails.backtrace_cleaner.remove_silencers!
60
60
 
61
- # Configure capybara for integration testing
62
- require "capybara/rails"
63
- Capybara.default_driver = :rack_test
64
- Capybara.default_selector = :css
65
-
66
61
  # Run any available migration
67
62
  ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
68
63
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail_manager
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igal Koshevoy
@@ -15,10 +15,24 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-14 00:00:00 Z
18
+ date: 2012-08-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ name: rake
31
+ prerelease: false
32
+ type: :runtime
33
+ requirement: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
22
36
  none: false
23
37
  requirements:
24
38
  - - ~>
@@ -27,13 +41,14 @@ dependencies:
27
41
  segments:
28
42
  - 3
29
43
  - 0
30
- version: "3.0"
44
+ - 0
45
+ version: 3.0.0
31
46
  name: rails
32
47
  prerelease: false
33
48
  type: :runtime
34
- requirement: *id001
49
+ requirement: *id002
35
50
  - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
51
+ version_requirements: &id003 !ruby/object:Gem::Requirement
37
52
  none: false
38
53
  requirements:
39
54
  - - ~>
@@ -46,9 +61,9 @@ dependencies:
46
61
  name: paper_trail
47
62
  prerelease: false
48
63
  type: :runtime
49
- requirement: *id002
64
+ requirement: *id003
50
65
  - !ruby/object:Gem::Dependency
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
66
+ version_requirements: &id004 !ruby/object:Gem::Requirement
52
67
  none: false
53
68
  requirements:
54
69
  - - ~>
@@ -63,37 +78,18 @@ dependencies:
63
78
  name: will_paginate
64
79
  prerelease: false
65
80
  type: :runtime
66
- requirement: *id003
67
- - !ruby/object:Gem::Dependency
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 15
74
- segments:
75
- - 0
76
- - 4
77
- - 0
78
- version: 0.4.0
79
- name: capybara
80
- prerelease: false
81
- type: :development
82
81
  requirement: *id004
83
82
  - !ruby/object:Gem::Dependency
84
83
  version_requirements: &id005 !ruby/object:Gem::Requirement
85
84
  none: false
86
85
  requirements:
87
- - - ~>
86
+ - - ">="
88
87
  - !ruby/object:Gem::Version
89
- hash: 62196297
88
+ hash: 3
90
89
  segments:
91
- - 1
92
- - 1
93
- - beta
94
- - 1
95
- version: 1.1.beta1
96
- name: factory_girl_rails
90
+ - 0
91
+ version: "0"
92
+ name: rdoc
97
93
  prerelease: false
98
94
  type: :development
99
95
  requirement: *id005
@@ -103,12 +99,12 @@ dependencies:
103
99
  requirements:
104
100
  - - ~>
105
101
  - !ruby/object:Gem::Version
106
- hash: 7
102
+ hash: 63
107
103
  segments:
108
104
  - 1
109
- - 5
110
- - 2
111
- version: 1.5.2
105
+ - 8
106
+ - 4
107
+ version: 1.8.4
112
108
  name: jeweler
113
109
  prerelease: false
114
110
  type: :development
@@ -123,7 +119,7 @@ dependencies:
123
119
  segments:
124
120
  - 0
125
121
  version: "0"
126
- name: rdoc
122
+ name: sqlite3-ruby
127
123
  prerelease: false
128
124
  type: :development
129
125
  requirement: *id007
@@ -131,15 +127,13 @@ dependencies:
131
127
  version_requirements: &id008 !ruby/object:Gem::Requirement
132
128
  none: false
133
129
  requirements:
134
- - - ~>
130
+ - - ">="
135
131
  - !ruby/object:Gem::Version
136
- hash: 27
132
+ hash: 3
137
133
  segments:
138
- - 2
139
- - 5
140
134
  - 0
141
- version: 2.5.0
142
- name: rspec-rails
135
+ version: "0"
136
+ name: guard
143
137
  prerelease: false
144
138
  type: :development
145
139
  requirement: *id008
@@ -153,7 +147,7 @@ dependencies:
153
147
  segments:
154
148
  - 0
155
149
  version: "0"
156
- name: ruby-debug
150
+ name: guard-rspec
157
151
  prerelease: false
158
152
  type: :development
159
153
  requirement: *id009
@@ -161,16 +155,13 @@ dependencies:
161
155
  version_requirements: &id010 !ruby/object:Gem::Requirement
162
156
  none: false
163
157
  requirements:
164
- - - ~>
158
+ - - ">="
165
159
  - !ruby/object:Gem::Version
166
- hash: 7712082
160
+ hash: 3
167
161
  segments:
168
162
  - 0
169
- - 9
170
- - 0
171
- - rc
172
- version: 0.9.0.rc
173
- name: spork
163
+ version: "0"
164
+ name: guard-spork
174
165
  prerelease: false
175
166
  type: :development
176
167
  requirement: *id010
@@ -184,7 +175,7 @@ dependencies:
184
175
  segments:
185
176
  - 0
186
177
  version: "0"
187
- name: sqlite3-ruby
178
+ name: libnotify
188
179
  prerelease: false
189
180
  type: :development
190
181
  requirement: *id011
@@ -321,52 +312,5 @@ rubygems_version: 1.8.11
321
312
  signing_key:
322
313
  specification_version: 3
323
314
  summary: A user interface for `paper_trail` versioning data in Ruby on Rails 3 applications.
324
- test_files:
325
- - spec/controllers/paper_trail_manager/changes_controller_spec.rb
326
- - spec/dummy/app/controllers/application_controller.rb
327
- - spec/dummy/app/controllers/entities_controller.rb
328
- - spec/dummy/app/controllers/platforms_controller.rb
329
- - spec/dummy/app/helpers/application_helper.rb
330
- - spec/dummy/app/helpers/entities_helper.rb
331
- - spec/dummy/app/helpers/platforms_helper.rb
332
- - spec/dummy/app/models/entity.rb
333
- - spec/dummy/app/models/platform.rb
334
- - spec/dummy/config/application.rb
335
- - spec/dummy/config/boot.rb
336
- - spec/dummy/config/environment.rb
337
- - spec/dummy/config/environments/development.rb
338
- - spec/dummy/config/environments/production.rb
339
- - spec/dummy/config/environments/test.rb
340
- - spec/dummy/config/initializers/backtrace_silencers.rb
341
- - spec/dummy/config/initializers/inflections.rb
342
- - spec/dummy/config/initializers/mime_types.rb
343
- - spec/dummy/config/initializers/secret_token.rb
344
- - spec/dummy/config/initializers/session_store.rb
345
- - spec/dummy/config/routes.rb
346
- - spec/dummy/db/migrate/20110228091428_create_entities.rb
347
- - spec/dummy/db/migrate/20110228093241_create_platforms.rb
348
- - spec/dummy/db/migrate/20110228094444_create_versions.rb
349
- - spec/dummy/db/schema.rb
350
- - spec/dummy/spec/controllers/entities_controller_spec.rb
351
- - spec/dummy/spec/controllers/platforms_controller_spec.rb
352
- - spec/dummy/spec/helpers/entities_helper_spec.rb
353
- - spec/dummy/spec/helpers/platforms_helper_spec.rb
354
- - spec/dummy/spec/integration/navigation_spec.rb
355
- - spec/dummy/spec/integration/paper_trail_manager_spec.rb
356
- - spec/dummy/spec/models/entity_spec.rb
357
- - spec/dummy/spec/models/platform_spec.rb
358
- - spec/dummy/spec/requests/entities_spec.rb
359
- - spec/dummy/spec/requests/platforms_spec.rb
360
- - spec/dummy/spec/routing/entities_routing_spec.rb
361
- - spec/dummy/spec/routing/platforms_routing_spec.rb
362
- - spec/dummy/spec/views/entities/edit.html.erb_spec.rb
363
- - spec/dummy/spec/views/entities/index.html.erb_spec.rb
364
- - spec/dummy/spec/views/entities/new.html.erb_spec.rb
365
- - spec/dummy/spec/views/entities/show.html.erb_spec.rb
366
- - spec/dummy/spec/views/platforms/edit.html.erb_spec.rb
367
- - spec/dummy/spec/views/platforms/index.html.erb_spec.rb
368
- - spec/dummy/spec/views/platforms/new.html.erb_spec.rb
369
- - spec/dummy/spec/views/platforms/show.html.erb_spec.rb
370
- - spec/paper_trail_manager_spec.rb
371
- - spec/spec_helper.rb
372
- - spec/support/factories.rb
315
+ test_files: []
316
+