admin_data 1.1.13 → 1.1.14

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.
@@ -1,185 +1,201 @@
1
- === 2010-12-07
1
+ == 1.1.13
2
+
3
+ * 24-June-2011
4
+ * Analytics feature
5
+ * Remove failing and not useful test
6
+ * Better sorting for advance search
7
+ * Better sorting for quick search
8
+
9
+ == 2010-12-07
10
+
2
11
  * new router api
3
12
  * new configuration api. It is not backward compatible. However the error message is nice.
4
13
  * cucumber tests are inside the repo
5
14
  * support for column_headers
6
15
  * support for column_settings
7
16
 
8
- === 2010-11-08 v1.0.20
17
+ == 2010-11-08 v1.0.20
18
+
9
19
  * support for habtm
10
20
  * do not get the list of nested models. It breaks routing. Comprehensive nested models fix coming soon.
11
21
 
12
- === 2010-11-08 v1.0.19
22
+ == 2010-11-08 v1.0.19
23
+
13
24
  * used unscoped on the model to have basic search result always in the order user wants
14
25
  * remove inline css
15
26
 
16
- === 2010-11-08 v1.0.18
27
+ == 2010-11-08 v1.0.18
28
+
17
29
  * disable the columns not being used
18
30
  * use parseJSON instead of eval
19
31
  * javascript variable declaration refactoring
20
32
 
21
- === 2010-10-12 v1.0.17
33
+ == 2010-10-12 v1.0.17
34
+
22
35
  * use image for advance search add and remove link
23
36
  * fix bug regarding "Destroy All"
24
37
  * layout change
25
38
  * have only one drop down in the homepage
26
39
 
27
- === 2010-09-22 v1.0.11
28
40
 
29
- === 2010-10-12 v1.0.14
41
+ == 2010-09-22 v1.0.11
42
+
43
+ == 2010-10-12 v1.0.14
44
+
30
45
  * use the new way of routing. remove deprecation
31
46
 
32
- === 2010-09-22 v1.0.11
47
+ == 2010-09-22 v1.0.11
48
+
33
49
  * fix for pagination not working in chrome
34
50
  * css cleanup
35
51
  * JavaScript cleanup
36
52
  * bumped up jQuery from 1.4.1 to jQuery 1.4.2
37
53
 
38
- === 2010-09-09 v1.0.10
54
+ == 2010-09-09 v1.0.10
55
+
39
56
  * fix for delete and destroy link
40
57
 
41
- === 2010-08-17 v1.0.8
58
+ == 2010-08-17 v1.0.8
59
+
42
60
  * fix for deprecation warning in routes
43
61
 
44
- === 2010-08-17 v1.0.5
62
+ == 2010-08-17 v1.0.5
63
+
45
64
  * fix for options defined in ~/config/initializers/admin_data_settings.rb not taking effect
46
65
 
47
- === 2010-08-17 v1.0.3
66
+ == 2010-08-17 v1.0.3
67
+
48
68
  * added more tests
49
69
  * fixed a bug related to :is_allowed_to_view_klass
50
70
 
71
+ == 2010-08-16
51
72
 
52
- === 2010-08-16
53
73
  * released as a gem
54
74
  * version 1.0.2
55
75
  * only works with rails3
56
76
 
57
- === 2010-04-14
77
+ == 2010-04-14
58
78
 
59
79
  * JavaScript code refactoring
60
80
  * More JavaScript code test
61
81
  * Moved functionalities from layout to helper
62
82
 
63
- === 0.0.37 2010-01-28
83
+ == 0.0.37 2010-01-28
64
84
 
65
85
  * refactored the code to take inline style out to style section
66
86
  * moves a lot of ruby code from view to helpers and controllers
67
87
  * better indentation
68
88
 
69
- === 0.0.36 2010-01-05
89
+ == 0.0.36 2010-01-05
70
90
 
71
91
  * Fixing the online validation of models that have primary key not id
72
92
 
73
- === 0.0.35 2010-01-05
93
+ == 0.0.35 2010-01-05
74
94
 
75
95
  * If invalid children value is passed in apply rescue
76
96
 
77
- === 0.0.34 2010-01-04
97
+ == 0.0.34 2010-01-04
78
98
 
79
99
  * updated README
80
100
 
81
- === 0.0.33 2009-12-27
101
+ == 0.0.33 2009-12-27
82
102
 
83
103
  * added authentication for feed
84
104
 
85
- === 0.0.32 2009-12-23
105
+ == 0.0.32 2009-12-23
86
106
 
87
107
  * the default search result for advance search should be primary key des
88
108
  * changed the layout for quick search
89
109
 
90
- === 0.0.31 2009-12-15
110
+ == 0.0.31 2009-12-15
91
111
 
92
112
  * association information is rescued so that show method works even if association info throws error
93
113
  * association info is displayed with belongs_to or has_many name instead of class name
94
114
  * debugging variable $debug_admin_data
95
115
 
96
- === 0.0.30 2009-12-02
116
+ == 0.0.30 2009-12-02
97
117
 
98
118
  * RSS feed for all the models
99
119
 
100
- === 0.0.29 2009-11-18
120
+ == 0.0.29 2009-11-18
101
121
 
102
122
  * rake task to validate all the models
103
123
  * ability to validate all the models using browser
104
124
  * increased the font size of overall app
105
125
 
106
- === 0.0.28 2009-11-12
126
+ == 0.0.28 2009-11-12
107
127
 
108
128
  * has_many association_info were too close to each other
109
129
  * fixing the issue where a class is used as a hash key. It breaks in development
110
130
 
111
- === 0.0.28 2009-11-11
131
+ == 0.0.28 2009-11-11
112
132
 
113
133
  * better link color
114
134
 
115
- === 0.0.28 2009-11-11
135
+ == 0.0.28 2009-11-11
116
136
 
117
137
  * refactored the way advance search JavaScript code
118
138
  * for pretty urls like /42-SEO-friendly-title the show method should pickup 42 as id
119
139
 
120
- === 0.0.27 2009-11-04
140
+ == 0.0.27 2009-11-04
121
141
 
122
142
  * test for has_one association
123
143
 
124
- === 0.0.26 2009-11-04
144
+ == 0.0.26 2009-11-04
125
145
 
126
146
  * cleaning up History.txt file
127
147
 
128
- === 0.0.25 2009-11-03
148
+ == 0.0.25 2009-11-03
129
149
 
130
150
  * fix for issue #14 so that not like will also include records which are null
131
151
 
132
- === 0.0.24 2009-11-03
152
+ == 0.0.24 2009-11-03
133
153
 
134
154
  * advance search refactoring
135
155
 
136
- === 0.0.23 2009-10-29
156
+ == 0.0.23 2009-10-29
137
157
 
138
158
  * advance search bug fix
139
159
 
140
- === 0.0.22 2009-10-26
160
+ == 0.0.22 2009-10-26
141
161
 
142
162
  * fixed adding rows on advanced search
143
163
  * consistenly use model_id for search and association parent objects
144
164
  * datetime/date/time fixes on edit and advanced search pages
145
165
  * added configuration to not use admin_data layout and use application one instead
146
166
 
147
- === 0.0.21 2009-10-26
167
+ == 0.0.21 2009-10-26
148
168
 
149
169
  * fixed the formatting issue while displaying missing index in diagnostic section
150
- * by passing additional parameter called 'attr' editing of a record would display
151
- only one field to avoid any accidental change.
170
+ * by passing additional parameter called 'attr' editing of a record would display only one field to avoid any accidental change.
152
171
 
153
- === 0.0.20 2009-10-22
172
+ == 0.0.20 2009-10-22
154
173
 
155
174
  * warning message if JavaScript is disabled
156
175
 
157
- === 0.0.19 2009-10-20
176
+ == 0.0.19 2009-10-20
158
177
 
159
- * ability to pass :find_conditions to settings so that models with to_param method could
160
- override the sql that is built by admin_data
178
+ * ability to pass :find_conditions to settings so that models with to_param method could override the sql that is built by admin_data
161
179
 
162
- === 0.0.18 2009-10-16
180
+ == 0.0.18 2009-10-16
163
181
 
164
- * changed theme from warehouse to dark because the association info on the right
165
- hand side was not appearing correctly
182
+ * changed theme from warehouse to dark because the association info on the right hand side was not appearing correctly
166
183
  * homepage should have main tab selected
167
184
  * changed urls to support models that override to_param to other than id
168
- * fixed the sorting order. model a, model B and model A/Q was being sorted
169
- as A,Q,B instead of A,B,Q.
185
+ * fixed the sorting order. model a, model B and model A/Q was being sorted as A,Q,B instead of A,B,Q.
170
186
 
171
- === 0.0.17 2009-10-08
187
+ == 0.0.17 2009-10-08
172
188
 
173
189
  * drop down of klasses is now available at the center of home page
174
190
  * current model will be selected in the drop down
175
191
 
176
- === 0.0.16 2009-10-07
192
+ == 0.0.16 2009-10-07
177
193
 
178
194
  * form UI foreign keys are dropdown (display name attribute if it exists and id otherwise)
179
195
  * form UI date fields use date_select (with free text year since we cannot guess a good range)
180
196
  * form UI refactored to use form_for instead of form_tag and hadcoded html
181
197
 
182
- === 0.0.15 2009-10-06
198
+ == 0.0.15 2009-10-06
183
199
 
184
200
  * cache the list of models
185
201
  * advance search refactoring
@@ -187,20 +203,20 @@ as A,Q,B instead of A,B,Q.
187
203
  * advance search now shows validation error for integer and date fields
188
204
  * log.js for easy logging in JavaScript
189
205
 
190
- === 0.0.14 2009-10-05
206
+ == 0.0.14 2009-10-05
191
207
 
192
208
  * while editing match was being done for hard coded value id. Now it looks for klass.primary_key
193
209
 
194
- === 0.0.13 2009-10-04
210
+ == 0.0.13 2009-10-04
195
211
 
196
212
  * fixed IE7 bug
197
213
 
198
- === 0.0.12 2009-10-04
214
+ == 0.0.12 2009-10-04
199
215
 
200
216
  * fixed bug regarding integer values not appearning in listing
201
217
  * better indentation
202
218
 
203
- === 0.0.11 2009-10-01
219
+ == 0.0.11 2009-10-01
204
220
 
205
221
  * Major contribution in this release by Alex Rothenberg. http://github.com/alexrothenberg
206
222
  * this plugin now treats each model as a restful resource.
@@ -208,70 +224,61 @@ as A,Q,B instead of A,B,Q.
208
224
  * commented out offending code for has_one relationship
209
225
  * has_one and habtm relationships along with test would be taken up in next release
210
226
 
211
- === 0.0.11 2009-09-28
227
+ == 0.0.11 2009-09-28
212
228
 
213
229
  * renamed quick search to search
214
230
  * using jQuery theme to make drop down boxes jazzier
215
231
  * more tests
216
232
  * moved some inline css to external css file
217
233
 
218
- === 0.0.10 2009-09-18
234
+ == 0.0.10 2009-09-18
219
235
 
220
236
  * fixed listing and has_many association info for namespaced model
221
237
 
222
- === 0.0.9 2009-09-18
238
+ == 0.0.9 2009-09-18
223
239
 
224
240
  * fixed security issue
225
241
 
226
- === 0.0.8 2009-09-18
242
+ == 0.0.8 2009-09-18
227
243
 
228
244
  * do not assume that primary key is 'id' . Respect the primary key set by model.
229
-
230
245
  * test for alternate primary key
231
246
 
232
- === 0.0.7 2009-09-17
247
+ == 0.0.7 2009-09-17
233
248
 
234
249
  * fixed test for Vehicle::Car
235
250
 
236
- === 0.0.6 2009-09-09
251
+ == 0.0.6 2009-09-09
237
252
 
238
253
  * more tests for the plugin. Now 151 tests and 229 assertions
239
-
240
254
  * support for name spaced models like Vehicle::Car and Vehicle::Engine
241
-
242
255
  * fixed a bug related to advance search
243
-
244
256
  * refactored JavaScript code for advance search
245
257
 
246
- === 0.0.5 2009-09-04
258
+ == 0.0.5 2009-09-04
247
259
 
248
260
  * tests for the plugin
249
-
250
261
  * changed the way security configiruation is passed to the plugin
251
-
252
262
  * users can configure number of records in a page. Default is 50
253
-
254
263
  * fixed bug associated with advance search
255
-
256
264
  * added link to report bug in footer
257
-
258
265
  * fixed bug in date parsing
259
266
 
260
- === 0.0.4 2009-08-28
267
+ == 0.0.4 2009-08-28
261
268
 
262
269
  * storing serialized array in string causing problem in truncate method. more at
263
- http://github.com/neerajdotname/admin_data/issues#issue/3.
270
+ * http://github.com/neerajdotname/admin_data/issues#issue/3
264
271
 
265
- === 0.0.3 2009-08-10
272
+ == 0.0.3 2009-08-10
266
273
 
267
274
  * not requiring rubygems
268
275
  * if will_paginate is missing then not raising exception
269
276
 
270
- === 0.0.2 2009-07-06
277
+ == 0.0.2 2009-07-06
271
278
 
272
279
  * ability to sort records
273
280
  * better visual clue that search is in progress
274
281
 
275
- === 0.0.1 2009-05-01
282
+ == 0.0.1 2009-05-01
276
283
 
277
284
  * Initial release
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- admin_data (1.1.13)
5
- will_paginate (= 3.0.pre2)
4
+ admin_data (1.1.14)
5
+ will_paginate (>= 3.0.0)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
10
  rake (0.8.7)
11
- will_paginate (3.0.pre2)
11
+ will_paginate (3.0.1)
12
12
 
13
13
  PLATFORMS
14
14
  ruby
@@ -16,4 +16,3 @@ PLATFORMS
16
16
  DEPENDENCIES
17
17
  admin_data!
18
18
  rake (= 0.8.7)
19
- will_paginate (= 3.0.pre2)
data/README.md CHANGED
@@ -1,17 +1,12 @@
1
- # admin_data works with both Rails 2.3.x and Rails 3. #
1
+ admin_data
2
2
 
3
- # [Documentation](http://github.com/neerajdotname/admin_data/wiki) #
4
3
 
5
- # [Installing in a Rails3 application](https://github.com/neerajdotname/admin_data/wiki/Installation-and-Usage-information-for-a-Rails-3-application) #
6
- # [Installing in a Rails 2.3.x application](https://github.com/neerajdotname/admin_data/wiki/Installation-and-Usage-information-for-a-Rails-2.3.x-application) #
4
+ * Live demo is available at http://admin-data-demo.heroku.com/admin_data (read only version)
7
5
 
8
- # [Live Demo](http://admin-data-demo.heroku.com/admin_data) #
6
+ * admin_data works with both Rails 2.3.x and Rails 3
9
7
 
8
+ * Documentation is available at https://github.com/bigbinary/admin_data/wiki
10
9
 
11
- #Test#
10
+ * To execute tests for this gem <tt>cd test/rails_root</tt> and read the instructions mentioned at README.md there.
12
11
 
13
- <tt>cd test/rails_root</tt> and read the instructions mentioned at README.md there.
14
-
15
-
16
-
17
- [MIT](http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) License
12
+ * Released under [MIT](http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) License
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency("will_paginate", "=3.0.pre2")
22
+ s.add_dependency("will_paginate", ">= 3.0.0")
23
23
  end
@@ -45,7 +45,7 @@ module AdminData
45
45
  if @model.update_attributes(model_attrs)
46
46
  format.html do
47
47
  flash[:success] = "Record was updated"
48
- redirect_to admin_data_path(:id => @model, :klass => @klass.name.underscore)
48
+ redirect_to admin_data_path(:id => @model.id, :klass => @klass.name.underscore)
49
49
  end
50
50
  format.js { render :json => {:success => true}}
51
51
  else
@@ -67,7 +67,7 @@ module AdminData
67
67
  else
68
68
  format.html do
69
69
  flash[:success] = "Record was created"
70
- redirect_to admin_data_path(:id => @model, :klass => @klass.name.underscore)
70
+ redirect_to admin_data_path(:id => @model.id, :klass => @klass.name.underscore)
71
71
  end
72
72
  format.js { render :json => {} }
73
73
  end
@@ -12,7 +12,7 @@
12
12
 
13
13
  <div class="content rounded">
14
14
  <div class="inner umbrella">
15
- <% url = admin_data_path(:klass => @klass.name, :id => @model)
15
+ <% url = admin_data_path(:klass => @klass.name, :id => @model.id)
16
16
  html_options = {:class => 'form', :method => :put} %>
17
17
  <%= form_for @model, :as => @klass.name.underscore.to_sym, :url => url, :html=> html_options do |f| %>
18
18
  <%= render 'admin_data/shared/flash_message', :model => @model %>
@@ -3,14 +3,14 @@
3
3
  <h3>Modify Record</h3>
4
4
  <div style='padding-left:15px'>
5
5
  <p>
6
- <%= link_to 'Edit', admin_data_edit_path(:klass => klass.name.underscore, :id => model) %>
6
+ <%= link_to 'Edit', admin_data_edit_path(:klass => klass.name.underscore, :id => model.id) %>
7
7
  </p>
8
8
  <p>
9
- <%= link_to 'Delete', admin_data_del_path(:klass => klass.name.underscore, :id => model) ,
9
+ <%= link_to 'Delete', admin_data_del_path(:klass => klass.name.underscore, :id => model.id) ,
10
10
  { :confirm => ' You are deleting (not destroying) a record. Are you sure?', :method => :delete} %>
11
11
  </p>
12
12
  <p>
13
- <%= link_to "Destroy", admin_data_path(:klass => klass.name.underscore, :id => model),
13
+ <%= link_to "Destroy", admin_data_path(:klass => klass.name.underscore, :id => model.id),
14
14
  { :confirm => 'You are destroying a record. Are you sure?', :method => :delete} %>
15
15
  </p>
16
16
  </div>
@@ -3,7 +3,7 @@
3
3
  :total_num_of_children => @total_num_of_children } %>
4
4
 
5
5
  <div class="pagination">
6
- <%= will_paginate @records, :container => false, :params => {:klass => klass.name} %>
6
+ <%= will_paginate @records, :container => false, :params => {:klass => klass.name.underscore} %>
7
7
  </div>
8
8
  <div class='clear'></div>
9
9
 
@@ -12,7 +12,7 @@
12
12
  <thead>
13
13
  <tr class='thead'>
14
14
  <% columns_order(klass).each do |column| %>
15
- <th class='<%=get_sort_class(column)%>' data-sortby='<%=get_sort_order(column)%>'>
15
+ <th class='<%=get_sort_class(column)%>' data-sortby='<%=get_sort_order(column)%>'>
16
16
  <%= get_sort_title_with_url(column, klass) %>
17
17
  </th>
18
18
  <% end %>
@@ -25,7 +25,8 @@
25
25
  <% columns_order(klass).each do |column| %>
26
26
  <td>
27
27
  <% if (column == klass.primary_key) %>
28
- <%= link_to(record.to_param.to_s, admin_data_path(:klass => klass.name.underscore, :id => record_id(record))) %>
28
+ <%#= link_to(record.to_param.to_s, admin_data_path(:klass => klass.name.underscore, :id => record_id(record))) %>
29
+ <%= link_to(record.send(column), admin_data_path(:klass => klass.name.underscore, :id => record_id(record))) %>
29
30
  <% else %>
30
31
  <%=h get_value_for_column(column_native(klass, column), record) %>
31
32
  <% end %>
@@ -22,11 +22,13 @@ Rails.application.routes.draw do
22
22
  match '/table_structure/:klass' => "table_structure#index", :as => :table_structure
23
23
 
24
24
  match '/quick_search/:klass' => "search#quick_search", :as => :search
25
+ match '/quick_search' => "search#quick_search"
25
26
 
26
27
  match '/advance_search/:klass' => "search#advance_search", :as => :advance_search
28
+ match '/advance_search' => "search#advance_search"
27
29
 
28
30
  match '/analytics/daily/:klass' => "analytics#daily", :as => :daily_analytics
29
- match '/analytics/monthly/:klass' => "analytics#monthly", :as => :monthly_analytics
31
+ match '/analytics/monthly/:klass' => "analytics#monthly", :as => :monthly_analytics
30
32
 
31
33
  match '/feed/:klasss' => "feed#index", :defaults => { :format =>'rss' }, :as => :feed
32
34
 
@@ -1,3 +1,3 @@
1
1
  module AdminData
2
- VERSION = '1.1.13'
2
+ VERSION = '1.1.14'
3
3
  end
@@ -15,6 +15,8 @@ gem 'ruby-debug'
15
15
 
16
16
  gem 'faker'
17
17
 
18
+ gem 'timecop'
19
+
18
20
 
19
21
  gem 'factory_girl_rails'
20
22
  gem 'database_cleaner'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: /Users/nsingh/dev/personal/admin_data
3
3
  specs:
4
- admin_data (1.1.12)
4
+ admin_data (1.1.13)
5
5
  will_paginate (= 3.0.pre2)
6
6
 
7
7
  GEM
@@ -135,6 +135,7 @@ GEM
135
135
  sqlite3-ruby (1.3.2)
136
136
  term-ansicolor (1.0.5)
137
137
  thor (0.14.4)
138
+ timecop (0.3.5)
138
139
  treetop (1.4.9)
139
140
  polyglot (>= 0.3.1)
140
141
  tzinfo (0.3.23)
@@ -161,3 +162,4 @@ DEPENDENCIES
161
162
  ruby-debug
162
163
  shoulda
163
164
  sqlite3-ruby
165
+ timecop
@@ -12,23 +12,24 @@ Feature: homepage
12
12
  Then I should see "Select from the drop down menu above"
13
13
  When I follow "admin_data" within "#subnav"
14
14
  Then I should see "Select from the drop down menu above"
15
+ Then show me the page
15
16
  Then I should see dropdown with css_selector ".drop_down_value_klass" with following options:
16
17
  | text | value | position | value_match_type |
17
- | city | /admin_data/quick_search/city | 2 | regex |
18
- | club | /admin_data/quick_search/club | 3 | regex |
19
- | newspaper | /admin_data/quick_search/newspaper | 4 | regex |
20
- | phone_number | /admin_data/quick_search/phone_number | 5 | regex |
21
- | user | /admin_data/quick_search/user | 6 | regex |
22
- | website | /admin_data/quick_search/website | 7 | regex |
18
+ | city | /admin_data/quick_search/city | 3 | regex |
19
+ | club | /admin_data/quick_search/club | 4 | regex |
20
+ | newspaper | /admin_data/quick_search/newspaper | 5 | regex |
21
+ | phone_number | /admin_data/quick_search/phone_number | 6 | regex |
22
+ | user | /admin_data/quick_search/user | 7 | regex |
23
+ | website | /admin_data/quick_search/website | 8 | regex |
23
24
 
24
25
  Then I should see dropdown with css_selector "#drop_down_klasses" with following options:
25
26
  | text | value | position | value_match_type |
26
- | city | /admin_data/quick_search/city | 2 | regex |
27
- | club | /admin_data/quick_search/club | 3 | regex |
28
- | newspaper | /admin_data/quick_search/newspaper | 4 | regex |
29
- | phone_number | /admin_data/quick_search/phone_number | 5 | regex |
30
- | user | /admin_data/quick_search/user | 6 | regex |
31
- | website | /admin_data/quick_search/website | 7 | regex |
27
+ | city | /admin_data/quick_search/city | 3 | regex |
28
+ | club | /admin_data/quick_search/club | 4 | regex |
29
+ | newspaper | /admin_data/quick_search/newspaper | 5 | regex |
30
+ | phone_number | /admin_data/quick_search/phone_number | 6 | regex |
31
+ | user | /admin_data/quick_search/user | 7 | regex |
32
+ | website | /admin_data/quick_search/website | 8 | regex |
32
33
  When I select "user" from "drop_down_klasses"
33
34
  Then first id of table should be of "Trisha"
34
35
 
@@ -77,11 +77,10 @@ def handy_has_select?(css_selector, select_options)
77
77
  selects = page.find(:xpath, "//select[#{attribute}]")
78
78
 
79
79
  select_options.each do |h|
80
- selects.find(:xpath, "./option[#{h[:position]}]", :text => h[:text])
81
80
  if h[:value_match_type] == 'regex'
82
- selects.find(:xpath, "./option[#{h[:position]}]").value.should match Regexp.new(h[:value])
81
+ selects.find(:xpath, "option[#{h[:position]}]").value.should match Regexp.new(h[:value])
83
82
  else
84
- selects.find(:xpath, "./option[#{h[:position]}]", :text => h[:value])
83
+ selects.find(:xpath, "option[#{h[:position]}]", :text => h[:value])
85
84
  end
86
85
  end
87
86
  end
@@ -3,11 +3,5 @@ require File.expand_path('../../config/environment', __FILE__)
3
3
  require 'rails/test_help'
4
4
 
5
5
  class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
6
  # Add more helper methods to be used by all tests here...
13
7
  end
@@ -11,6 +11,8 @@ class CarTest < MiniTest::Unit::TestCase
11
11
 
12
12
  def setup
13
13
  Car.delete_all
14
+ new_time = Time.local(2011, 6, 23, 12, 0, 0)
15
+ Timecop.freeze(new_time)
14
16
  end
15
17
 
16
18
  def test_by_default_all_values_are_zero
@@ -0,0 +1,45 @@
1
+ require "test_helper"
2
+ require "minitest/autorun"
3
+
4
+ class UserPhoneTest < MiniTest::Unit::TestCase
5
+
6
+ def setup
7
+ User.delete_all
8
+ PhoneNumber.delete_all
9
+ end
10
+
11
+ def count_of_main_klass_records_not_in_hm_klass(main_klass, hm_klass, hm_relationship_name)
12
+ foreign_key = main_klass.reflections[hm_relationship_name].instance_variable_get('@active_record').name.foreign_key
13
+ raise 'foreign_key is nil' unless foreign_key
14
+
15
+ sql = %Q{
16
+
17
+ select count(*) as count_data
18
+ from #{main_klass.table_name}
19
+ where users.id NOT IN (
20
+ select #{hm_klass.table_name}.#{foreign_key}
21
+ from #{hm_klass.table_name}
22
+ )
23
+
24
+ }
25
+ record = main_klass.find_by_sql(sql).first
26
+ record['count_data'].to_i
27
+ end
28
+
29
+ def test_pie_chart_for_user_with_phones_vs_users_without_phones
30
+ 5.times { Factory(:user) }
31
+ 3.times do
32
+ user = Factory(:user)
33
+ Factory(:phone_number, :user => user)
34
+ end
35
+ assert_equal 8, User.count
36
+ assert_equal 3, PhoneNumber.count
37
+
38
+ main_klass = User
39
+ hm_klass = PhoneNumber
40
+ hm_relationship = :phone_numbers
41
+
42
+ assert_equal 5, count_of_main_klass_records_not_in_hm_klass(User, PhoneNumber, :phone_numbers)
43
+ end
44
+ end
45
+
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_data
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 13
10
- version: 1.1.13
4
+ prerelease:
5
+ version: 1.1.14
11
6
  platform: ruby
12
7
  authors:
13
8
  - Neeraj Singh
@@ -15,24 +10,19 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-06-24 00:00:00 -04:00
13
+ date: 2011-10-10 00:00:00 -04:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
17
+ name: will_paginate
22
18
  requirement: &id001 !ruby/object:Gem::Requirement
23
19
  none: false
24
20
  requirements:
25
- - - "="
21
+ - - ">="
26
22
  - !ruby/object:Gem::Version
27
- hash: -1876988247
28
- segments:
29
- - 3
30
- - 0
31
- - pre2
32
- version: 3.0.pre2
33
- name: will_paginate
34
- prerelease: false
23
+ version: 3.0.0
35
24
  type: :runtime
25
+ prerelease: false
36
26
  version_requirements: *id001
37
27
  description: Manage data as if you own it
38
28
  email:
@@ -45,9 +35,9 @@ extra_rdoc_files: []
45
35
 
46
36
  files:
47
37
  - .gitignore
38
+ - CHANGELOG.rdoc
48
39
  - Gemfile
49
40
  - Gemfile.lock
50
- - History.txt
51
41
  - README.md
52
42
  - Rakefile
53
43
  - admin_data.gemspec
@@ -217,6 +207,7 @@ files:
217
207
  - test/rails_root/test/factories.rb
218
208
  - test/rails_root/test/test_helper.rb
219
209
  - test/rails_root/test/unit/car_test.rb
210
+ - test/rails_root/test/unit/user_phone_test.rb
220
211
  has_rdoc: true
221
212
  homepage: ""
222
213
  licenses: []
@@ -231,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
222
  requirements:
232
223
  - - ">="
233
224
  - !ruby/object:Gem::Version
234
- hash: 3
225
+ hash: 2368908511276204323
235
226
  segments:
236
227
  - 0
237
228
  version: "0"
@@ -240,14 +231,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
231
  requirements:
241
232
  - - ">="
242
233
  - !ruby/object:Gem::Version
243
- hash: 3
234
+ hash: 2368908511276204323
244
235
  segments:
245
236
  - 0
246
237
  version: "0"
247
238
  requirements: []
248
239
 
249
240
  rubyforge_project: admin_data
250
- rubygems_version: 1.3.7
241
+ rubygems_version: 1.6.2
251
242
  signing_key:
252
243
  specification_version: 3
253
244
  summary: Manage data as if you own it
@@ -327,3 +318,4 @@ test_files:
327
318
  - test/rails_root/test/factories.rb
328
319
  - test/rails_root/test/test_helper.rb
329
320
  - test/rails_root/test/unit/car_test.rb
321
+ - test/rails_root/test/unit/user_phone_test.rb