acts_rateable 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +15 -0
  2. data/lib/acts_rateable/acts_rateable.rb +14 -9
  3. data/lib/acts_rateable/count.rb +12 -18
  4. data/lib/acts_rateable/rate.rb +9 -7
  5. data/lib/acts_rateable/rating.rb +11 -17
  6. data/lib/acts_rateable/version.rb +1 -1
  7. metadata +13 -214
  8. data/test/acts_rateable_test.rb +0 -7
  9. data/test/dummy/README.rdoc +0 -261
  10. data/test/dummy/Rakefile +0 -7
  11. data/test/dummy/app/assets/javascripts/application.js +0 -15
  12. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  13. data/test/dummy/app/controllers/application_controller.rb +0 -3
  14. data/test/dummy/app/helpers/application_helper.rb +0 -2
  15. data/test/dummy/app/models/post.rb +0 -4
  16. data/test/dummy/app/models/user.rb +0 -4
  17. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  18. data/test/dummy/config.ru +0 -4
  19. data/test/dummy/config/application.rb +0 -59
  20. data/test/dummy/config/boot.rb +0 -10
  21. data/test/dummy/config/database.yml +0 -25
  22. data/test/dummy/config/environment.rb +0 -5
  23. data/test/dummy/config/environments/development.rb +0 -37
  24. data/test/dummy/config/environments/production.rb +0 -67
  25. data/test/dummy/config/environments/test.rb +0 -37
  26. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  27. data/test/dummy/config/initializers/inflections.rb +0 -15
  28. data/test/dummy/config/initializers/mime_types.rb +0 -5
  29. data/test/dummy/config/initializers/secret_token.rb +0 -7
  30. data/test/dummy/config/initializers/session_store.rb +0 -8
  31. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  32. data/test/dummy/config/locales/en.yml +0 -5
  33. data/test/dummy/config/routes.rb +0 -58
  34. data/test/dummy/coverage/assets/0.7.1/application.css +0 -1110
  35. data/test/dummy/coverage/assets/0.7.1/application.js +0 -626
  36. data/test/dummy/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  37. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  38. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  39. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  40. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  41. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  42. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  43. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  44. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  45. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  46. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  47. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  48. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  49. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  50. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  51. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  52. data/test/dummy/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  53. data/test/dummy/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  54. data/test/dummy/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  55. data/test/dummy/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  56. data/test/dummy/coverage/assets/0.7.1/favicon_green.png +0 -0
  57. data/test/dummy/coverage/assets/0.7.1/favicon_red.png +0 -0
  58. data/test/dummy/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  59. data/test/dummy/coverage/assets/0.7.1/loading.gif +0 -0
  60. data/test/dummy/coverage/assets/0.7.1/magnify.png +0 -0
  61. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  62. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  63. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  64. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  65. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  66. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  67. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  68. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  69. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  70. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  71. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  72. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  73. data/test/dummy/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  74. data/test/dummy/coverage/index.html +0 -294
  75. data/test/dummy/db/development.sqlite3 +0 -0
  76. data/test/dummy/db/migrate/20130520024319_create_posts.rb +0 -9
  77. data/test/dummy/db/migrate/20130520024332_create_users.rb +0 -9
  78. data/test/dummy/db/migrate/20130520163820_acts_rateable_migration.rb +0 -28
  79. data/test/dummy/db/schema.rb +0 -56
  80. data/test/dummy/db/test.sqlite3 +0 -0
  81. data/test/dummy/log/development.log +0 -606
  82. data/test/dummy/log/test.log +0 -3639
  83. data/test/dummy/public/404.html +0 -26
  84. data/test/dummy/public/422.html +0 -26
  85. data/test/dummy/public/500.html +0 -25
  86. data/test/dummy/public/favicon.ico +0 -0
  87. data/test/dummy/script/rails +0 -6
  88. data/test/dummy/spec/factories/post.rb +0 -5
  89. data/test/dummy/spec/factories/user.rb +0 -5
  90. data/test/dummy/spec/models/acts_rateable_spec.rb +0 -102
  91. data/test/dummy/spec/spec_helper.rb +0 -51
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- </div>
24
- </body>
25
- </html>
File without changes
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,5 +0,0 @@
1
- FactoryGirl.define do
2
- factory :post do
3
- name { Faker::Lorem.words(5).join(" ") }
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- FactoryGirl.define do
2
- factory :user do
3
- name { Faker::Name.first_name }
4
- end
5
- end
@@ -1,102 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActsRateable do
4
-
5
- describe "associations" do
6
-
7
- let(:post) { FactoryGirl.create(:post) }
8
- let(:user) { FactoryGirl.create(:user) }
9
-
10
- before(:each){
11
- user.rate( post, rand(1..5) )
12
- }
13
-
14
- describe "resource" do
15
- it "should respond to rates" do
16
- post.should respond_to(:rates)
17
- post.rates.should_not be_empty
18
- end
19
-
20
- it "should respond to ratings" do
21
- post.should respond_to(:ratings)
22
- post.ratings.should_not be_nil
23
- end
24
- end
25
-
26
- describe "author" do
27
- it "should respond to rated" do
28
- user.should respond_to(:rated)
29
- user.rated.should_not be_empty
30
- end
31
- end
32
- end
33
-
34
- describe "scope" do
35
-
36
- let(:post) { FactoryGirl.create(:post) }
37
-
38
- before(:each){
39
- rand(1..20).times do
40
- FactoryGirl.create(:user).rate( post, rand(1..5) )
41
- end
42
- }
43
-
44
- it { Post.should respond_to(:order_by) }
45
-
46
- it "order_by should not be empty" do
47
- Post.order_by(:estimate).should_not be_empty
48
- end
49
- end
50
-
51
- describe "instance methods" do
52
-
53
- let(:post) { FactoryGirl.create(:post) }
54
- let(:user) { FactoryGirl.create(:user) }
55
-
56
- describe "rate" do
57
-
58
- it "should respond to rate" do
59
- post.should respond_to(:rate)
60
- end
61
-
62
- it "should create rate when rated" do
63
- expect{
64
- post.rate(user,4)
65
- }.to change { ActsRateable::Rate.count }
66
- end
67
-
68
- it "should create rating when rated" do
69
- expect{
70
- post.rate(user,4)
71
- }.to change { ActsRateable::Rating.count }
72
- end
73
-
74
- it "should not duplicate rate when re-rated" do
75
- post.rate(user,4)
76
- expect{
77
- post.rate(user,4)
78
- }.to_not change { ActsRateable::Rating.count }
79
- end
80
- end
81
-
82
- describe "rated_by" do
83
- it "should respond to rated_by" do
84
- post.should respond_to(:rated_by?)
85
- end
86
-
87
- it "should respond to rated_by" do
88
- post.rated_by?(user).should_not be_false
89
- end
90
- end
91
-
92
- describe "has_rated" do
93
- it "should respond to has_rated" do
94
- user.should respond_to(:has_rated?)
95
- end
96
-
97
- it "should respond to has_rated" do
98
- user.rated_by?(post).should_not be_false
99
- end
100
- end
101
- end
102
- end
@@ -1,51 +0,0 @@
1
-
2
- ENV["RAILS_ENV"] ||= 'test'
3
- require File.expand_path("../../config/environment", __FILE__)
4
-
5
- require 'rspec/rails'
6
- require 'rspec/autorun'
7
- require 'rubygems'
8
- require 'bundler/setup'
9
-
10
- require 'acts_rateable'
11
-
12
- # Requires supporting ruby files with custom matchers and macros, etc,
13
- # in spec/support/ and its subdirectories.
14
- Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
15
-
16
- RSpec.configure do |config|
17
-
18
- config.include FactoryGirl::Syntax::Methods
19
-
20
- # ## Mock Framework
21
- #
22
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
23
- #
24
- # config.mock_with :mocha
25
- # config.mock_with :flexmock
26
- # config.mock_with :rr
27
-
28
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
29
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
30
-
31
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
32
- # examples within a transaction, remove the following line or assign false
33
- # instead of true.
34
- config.use_transactional_fixtures = false
35
-
36
- # If true, the base class of anonymous controllers will be inferred
37
- # automatically. This will be the default behavior in future versions of
38
- # rspec-rails.
39
- config.infer_base_class_for_anonymous_controllers = false
40
-
41
- # make the rails logger usable in the tests as logger.xxx "..."
42
- def logger
43
- Rails.logger
44
- end
45
-
46
- # Run specs in random order to surface order dependencies. If you find an
47
- # order dependency and want to debug it, you can fix the order by providing
48
- # the seed, which is printed after each run.
49
- # --seed 1234
50
- config.order = "random"
51
- end