acts_rateable 0.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.
Files changed (95) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +140 -0
  3. data/Rakefile +38 -0
  4. data/lib/acts_rateable.rb +5 -0
  5. data/lib/acts_rateable/acts_rateable.rb +59 -0
  6. data/lib/acts_rateable/rate.rb +46 -0
  7. data/lib/acts_rateable/rating.rb +55 -0
  8. data/lib/acts_rateable/version.rb +3 -0
  9. data/lib/generators/acts_rateable/acts_rateable_generator.rb +22 -0
  10. data/lib/generators/acts_rateable/templates/migration.rb +28 -0
  11. data/test/acts_rateable_test.rb +7 -0
  12. data/test/dummy/README.rdoc +261 -0
  13. data/test/dummy/Rakefile +7 -0
  14. data/test/dummy/app/assets/javascripts/application.js +15 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/models/post.rb +4 -0
  19. data/test/dummy/app/models/user.rb +4 -0
  20. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  21. data/test/dummy/config.ru +4 -0
  22. data/test/dummy/config/application.rb +59 -0
  23. data/test/dummy/config/boot.rb +10 -0
  24. data/test/dummy/config/database.yml +25 -0
  25. data/test/dummy/config/environment.rb +5 -0
  26. data/test/dummy/config/environments/development.rb +37 -0
  27. data/test/dummy/config/environments/production.rb +67 -0
  28. data/test/dummy/config/environments/test.rb +37 -0
  29. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  30. data/test/dummy/config/initializers/inflections.rb +15 -0
  31. data/test/dummy/config/initializers/mime_types.rb +5 -0
  32. data/test/dummy/config/initializers/secret_token.rb +7 -0
  33. data/test/dummy/config/initializers/session_store.rb +8 -0
  34. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  35. data/test/dummy/config/locales/en.yml +5 -0
  36. data/test/dummy/config/routes.rb +58 -0
  37. data/test/dummy/coverage/assets/0.7.1/application.css +1110 -0
  38. data/test/dummy/coverage/assets/0.7.1/application.js +626 -0
  39. data/test/dummy/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  40. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  41. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  42. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  43. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  44. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  45. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  46. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  47. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  48. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  49. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  50. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  51. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  52. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  53. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  54. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  55. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  56. data/test/dummy/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  57. data/test/dummy/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  58. data/test/dummy/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  59. data/test/dummy/coverage/assets/0.7.1/favicon_green.png +0 -0
  60. data/test/dummy/coverage/assets/0.7.1/favicon_red.png +0 -0
  61. data/test/dummy/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  62. data/test/dummy/coverage/assets/0.7.1/loading.gif +0 -0
  63. data/test/dummy/coverage/assets/0.7.1/magnify.png +0 -0
  64. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  65. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  66. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  67. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  68. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  69. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  70. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  71. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  72. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  73. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  74. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  75. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  76. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  77. data/test/dummy/coverage/index.html +294 -0
  78. data/test/dummy/db/development.sqlite3 +0 -0
  79. data/test/dummy/db/migrate/20130520024319_create_posts.rb +9 -0
  80. data/test/dummy/db/migrate/20130520024332_create_users.rb +9 -0
  81. data/test/dummy/db/migrate/20130520163820_acts_rateable_migration.rb +28 -0
  82. data/test/dummy/db/schema.rb +56 -0
  83. data/test/dummy/db/test.sqlite3 +0 -0
  84. data/test/dummy/log/development.log +606 -0
  85. data/test/dummy/log/test.log +3639 -0
  86. data/test/dummy/public/404.html +26 -0
  87. data/test/dummy/public/422.html +26 -0
  88. data/test/dummy/public/500.html +25 -0
  89. data/test/dummy/public/favicon.ico +0 -0
  90. data/test/dummy/script/rails +6 -0
  91. data/test/dummy/spec/factories/post.rb +5 -0
  92. data/test/dummy/spec/factories/user.rb +5 -0
  93. data/test/dummy/spec/models/acts_rateable_spec.rb +102 -0
  94. data/test/dummy/spec/spec_helper.rb +51 -0
  95. metadata +257 -0
@@ -0,0 +1,294 @@
1
+ <!DOCTYPE html>
2
+ <html xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>Code coverage for Dummy</title>
5
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
+ <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
7
+ <link href='./assets/0.7.1/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
8
+ <link rel="shortcut icon" type="image/png" href="./assets/0.7.1/favicon_green.png" />
9
+ <link rel="icon" type="image/png" href="./assets/0.7.1/favicon.png" />
10
+ </head>
11
+
12
+ <body>
13
+ <div id="loading">
14
+ <img src="./assets/0.7.1/loading.gif" alt="loading"/>
15
+ </div>
16
+ <div id="wrapper" style="display:none;">
17
+ <div class="timestamp">Generated <abbr class="timeago" title="2013-05-20T09:18:37-07:00">2013-05-20T09:18:37-07:00</abbr></div>
18
+ <ul class="group_tabs"></ul>
19
+
20
+ <div id="content">
21
+ <div class="file_list_container" id="AllFiles">
22
+ <h2>
23
+ <span class="group_name">All Files</span>
24
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
25
+ covered at
26
+ <span class="covered_strength">
27
+ <span class="red">
28
+ 0.0
29
+ </span>
30
+ </span> hits/line)
31
+ </h2>
32
+ <a name="AllFiles"></a>
33
+ <div>
34
+ <b>0</b> files in total.
35
+ <b>0.0</b> relevant lines.
36
+ <span class="green"><b>0.0</b> lines covered</span> and
37
+ <span class="red"><b>0.0</b> lines missed </span>
38
+ </div>
39
+ <table class="file_list">
40
+ <thead>
41
+ <tr>
42
+ <th>File</th>
43
+ <th>% covered</th>
44
+ <th>Lines</th>
45
+ <th>Relevant Lines</th>
46
+ <th>Lines covered</th>
47
+ <th>Lines missed</th>
48
+ <th>Avg. Hits / Line</th>
49
+ </tr>
50
+ </thead>
51
+ <tbody>
52
+
53
+ </tbody>
54
+ </table>
55
+ </div>
56
+
57
+
58
+
59
+ <div class="file_list_container" id="Controllers">
60
+ <h2>
61
+ <span class="group_name">Controllers</span>
62
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
63
+ covered at
64
+ <span class="covered_strength">
65
+ <span class="red">
66
+ 0.0
67
+ </span>
68
+ </span> hits/line)
69
+ </h2>
70
+ <a name="Controllers"></a>
71
+ <div>
72
+ <b>0</b> files in total.
73
+ <b>0.0</b> relevant lines.
74
+ <span class="green"><b>0.0</b> lines covered</span> and
75
+ <span class="red"><b>0.0</b> lines missed </span>
76
+ </div>
77
+ <table class="file_list">
78
+ <thead>
79
+ <tr>
80
+ <th>File</th>
81
+ <th>% covered</th>
82
+ <th>Lines</th>
83
+ <th>Relevant Lines</th>
84
+ <th>Lines covered</th>
85
+ <th>Lines missed</th>
86
+ <th>Avg. Hits / Line</th>
87
+ </tr>
88
+ </thead>
89
+ <tbody>
90
+
91
+ </tbody>
92
+ </table>
93
+ </div>
94
+
95
+
96
+ <div class="file_list_container" id="Models">
97
+ <h2>
98
+ <span class="group_name">Models</span>
99
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
100
+ covered at
101
+ <span class="covered_strength">
102
+ <span class="red">
103
+ 0.0
104
+ </span>
105
+ </span> hits/line)
106
+ </h2>
107
+ <a name="Models"></a>
108
+ <div>
109
+ <b>0</b> files in total.
110
+ <b>0.0</b> relevant lines.
111
+ <span class="green"><b>0.0</b> lines covered</span> and
112
+ <span class="red"><b>0.0</b> lines missed </span>
113
+ </div>
114
+ <table class="file_list">
115
+ <thead>
116
+ <tr>
117
+ <th>File</th>
118
+ <th>% covered</th>
119
+ <th>Lines</th>
120
+ <th>Relevant Lines</th>
121
+ <th>Lines covered</th>
122
+ <th>Lines missed</th>
123
+ <th>Avg. Hits / Line</th>
124
+ </tr>
125
+ </thead>
126
+ <tbody>
127
+
128
+ </tbody>
129
+ </table>
130
+ </div>
131
+
132
+
133
+ <div class="file_list_container" id="Mailers">
134
+ <h2>
135
+ <span class="group_name">Mailers</span>
136
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
137
+ covered at
138
+ <span class="covered_strength">
139
+ <span class="red">
140
+ 0.0
141
+ </span>
142
+ </span> hits/line)
143
+ </h2>
144
+ <a name="Mailers"></a>
145
+ <div>
146
+ <b>0</b> files in total.
147
+ <b>0.0</b> relevant lines.
148
+ <span class="green"><b>0.0</b> lines covered</span> and
149
+ <span class="red"><b>0.0</b> lines missed </span>
150
+ </div>
151
+ <table class="file_list">
152
+ <thead>
153
+ <tr>
154
+ <th>File</th>
155
+ <th>% covered</th>
156
+ <th>Lines</th>
157
+ <th>Relevant Lines</th>
158
+ <th>Lines covered</th>
159
+ <th>Lines missed</th>
160
+ <th>Avg. Hits / Line</th>
161
+ </tr>
162
+ </thead>
163
+ <tbody>
164
+
165
+ </tbody>
166
+ </table>
167
+ </div>
168
+
169
+
170
+ <div class="file_list_container" id="Helpers">
171
+ <h2>
172
+ <span class="group_name">Helpers</span>
173
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
174
+ covered at
175
+ <span class="covered_strength">
176
+ <span class="red">
177
+ 0.0
178
+ </span>
179
+ </span> hits/line)
180
+ </h2>
181
+ <a name="Helpers"></a>
182
+ <div>
183
+ <b>0</b> files in total.
184
+ <b>0.0</b> relevant lines.
185
+ <span class="green"><b>0.0</b> lines covered</span> and
186
+ <span class="red"><b>0.0</b> lines missed </span>
187
+ </div>
188
+ <table class="file_list">
189
+ <thead>
190
+ <tr>
191
+ <th>File</th>
192
+ <th>% covered</th>
193
+ <th>Lines</th>
194
+ <th>Relevant Lines</th>
195
+ <th>Lines covered</th>
196
+ <th>Lines missed</th>
197
+ <th>Avg. Hits / Line</th>
198
+ </tr>
199
+ </thead>
200
+ <tbody>
201
+
202
+ </tbody>
203
+ </table>
204
+ </div>
205
+
206
+
207
+ <div class="file_list_container" id="Libraries">
208
+ <h2>
209
+ <span class="group_name">Libraries</span>
210
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
211
+ covered at
212
+ <span class="covered_strength">
213
+ <span class="red">
214
+ 0.0
215
+ </span>
216
+ </span> hits/line)
217
+ </h2>
218
+ <a name="Libraries"></a>
219
+ <div>
220
+ <b>0</b> files in total.
221
+ <b>0.0</b> relevant lines.
222
+ <span class="green"><b>0.0</b> lines covered</span> and
223
+ <span class="red"><b>0.0</b> lines missed </span>
224
+ </div>
225
+ <table class="file_list">
226
+ <thead>
227
+ <tr>
228
+ <th>File</th>
229
+ <th>% covered</th>
230
+ <th>Lines</th>
231
+ <th>Relevant Lines</th>
232
+ <th>Lines covered</th>
233
+ <th>Lines missed</th>
234
+ <th>Avg. Hits / Line</th>
235
+ </tr>
236
+ </thead>
237
+ <tbody>
238
+
239
+ </tbody>
240
+ </table>
241
+ </div>
242
+
243
+
244
+ <div class="file_list_container" id="Plugins">
245
+ <h2>
246
+ <span class="group_name">Plugins</span>
247
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
248
+ covered at
249
+ <span class="covered_strength">
250
+ <span class="red">
251
+ 0.0
252
+ </span>
253
+ </span> hits/line)
254
+ </h2>
255
+ <a name="Plugins"></a>
256
+ <div>
257
+ <b>0</b> files in total.
258
+ <b>0.0</b> relevant lines.
259
+ <span class="green"><b>0.0</b> lines covered</span> and
260
+ <span class="red"><b>0.0</b> lines missed </span>
261
+ </div>
262
+ <table class="file_list">
263
+ <thead>
264
+ <tr>
265
+ <th>File</th>
266
+ <th>% covered</th>
267
+ <th>Lines</th>
268
+ <th>Relevant Lines</th>
269
+ <th>Lines covered</th>
270
+ <th>Lines missed</th>
271
+ <th>Avg. Hits / Line</th>
272
+ </tr>
273
+ </thead>
274
+ <tbody>
275
+
276
+ </tbody>
277
+ </table>
278
+ </div>
279
+
280
+
281
+ </div>
282
+
283
+ <div id="footer">
284
+ Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
285
+ and simplecov-html v0.7.1<br/>
286
+ using RSpec
287
+ </div>
288
+
289
+ <div class="source_files">
290
+
291
+ </div>
292
+ </div>
293
+ </body>
294
+ </html>
Binary file
@@ -0,0 +1,9 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :name
5
+ t.integer :value
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.integer :value
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ class ActsRateableMigration < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ create_table :ar_rates do |t|
5
+ t.references :resource, :polymorphic => true, :null => false
6
+ t.references :author, :polymorphic => true, :null => false
7
+ t.integer :value, :default => 0
8
+ t.timestamps
9
+ end
10
+ add_index :ar_rates, [:resource_id, :resource_type]
11
+ add_index :ar_rates, [:author_id, :author_type]
12
+
13
+ create_table :ar_ratings do |t|
14
+ t.references :resource, :polymorphic => true, :null => false
15
+ t.integer :total, :default => 0
16
+ t.integer :sum, :default => 0
17
+ t.decimal :average, :default => 0
18
+ t.decimal :estimate, :default => 0
19
+ t.timestamps
20
+ end
21
+ add_index :ar_ratings, [:resource_id, :resource_type]
22
+ end
23
+
24
+ def self.down
25
+ drop_table :ar_rates
26
+ drop_table :ar_ratings
27
+ end
28
+ end
@@ -0,0 +1,56 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130520163820) do
15
+
16
+ create_table "ar_rates", :force => true do |t|
17
+ t.integer "resource_id", :null => false
18
+ t.string "resource_type", :null => false
19
+ t.integer "author_id", :null => false
20
+ t.string "author_type", :null => false
21
+ t.integer "value", :default => 0
22
+ t.datetime "created_at", :null => false
23
+ t.datetime "updated_at", :null => false
24
+ end
25
+
26
+ add_index "ar_rates", ["author_id", "author_type"], :name => "index_ar_rates_on_author_id_and_author_type"
27
+ add_index "ar_rates", ["resource_id", "resource_type"], :name => "index_ar_rates_on_resource_id_and_resource_type"
28
+
29
+ create_table "ar_ratings", :force => true do |t|
30
+ t.integer "resource_id", :null => false
31
+ t.string "resource_type", :null => false
32
+ t.integer "total", :default => 0
33
+ t.integer "sum", :default => 0
34
+ t.decimal "average", :default => 0.0
35
+ t.decimal "estimate", :default => 0.0
36
+ t.datetime "created_at", :null => false
37
+ t.datetime "updated_at", :null => false
38
+ end
39
+
40
+ add_index "ar_ratings", ["resource_id", "resource_type"], :name => "index_ar_ratings_on_resource_id_and_resource_type"
41
+
42
+ create_table "posts", :force => true do |t|
43
+ t.string "name"
44
+ t.integer "value"
45
+ t.datetime "created_at", :null => false
46
+ t.datetime "updated_at", :null => false
47
+ end
48
+
49
+ create_table "users", :force => true do |t|
50
+ t.string "name"
51
+ t.integer "value"
52
+ t.datetime "created_at", :null => false
53
+ t.datetime "updated_at", :null => false
54
+ end
55
+
56
+ end