spree_reviews 0.30.0

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 (70) hide show
  1. data/README.markdown +43 -0
  2. data/Rakefile +120 -0
  3. data/TODO +8 -0
  4. data/app/controllers/admin/feedback_reviews_controller.rb +16 -0
  5. data/app/controllers/admin/review_settings_controller.rb +13 -0
  6. data/app/controllers/admin/reviews_controller.rb +36 -0
  7. data/app/controllers/feedback_reviews_controller.rb +17 -0
  8. data/app/controllers/reviews_controller.rb +30 -0
  9. data/app/helpers/admin/feedback_reviews_helper.rb +2 -0
  10. data/app/helpers/feedback_reviews_helper.rb +2 -0
  11. data/app/helpers/reviews_helper.rb +17 -0
  12. data/app/models/feedback_review.rb +10 -0
  13. data/app/models/product_decorator.rb +14 -0
  14. data/app/models/rating.rb +20 -0
  15. data/app/models/review.rb +20 -0
  16. data/app/models/reviews_configuration.rb +7 -0
  17. data/app/views/admin/feedback_reviews/index.html.erb +21 -0
  18. data/app/views/admin/review_settings/edit.html.erb +18 -0
  19. data/app/views/admin/review_settings/show.html.erb +18 -0
  20. data/app/views/admin/reviews/_form.html.erb +10 -0
  21. data/app/views/admin/reviews/edit.html.erb +17 -0
  22. data/app/views/admin/reviews/index.html.erb +45 -0
  23. data/app/views/feedback_reviews/_form.html.erb +14 -0
  24. data/app/views/feedback_reviews/_summary.html.erb +6 -0
  25. data/app/views/feedback_reviews/create.js.erb +7 -0
  26. data/app/views/reviews/_fine_print.html.erb +7 -0
  27. data/app/views/reviews/_stars.html.erb +21 -0
  28. data/app/views/reviews/_stars0.html.erb +1 -0
  29. data/app/views/reviews/_stars1.html.erb +1 -0
  30. data/app/views/reviews/_stars2.html.erb +1 -0
  31. data/app/views/reviews/_stars3.html.erb +1 -0
  32. data/app/views/reviews/_stars4.html.erb +1 -0
  33. data/app/views/reviews/_stars5.html.erb +1 -0
  34. data/app/views/reviews/index.html.erb +2 -0
  35. data/app/views/reviews/new.html.erb +47 -0
  36. data/app/views/reviews/submissionguidelines.html.erb +6 -0
  37. data/app/views/reviews/terms.html.erb +6 -0
  38. data/app/views/shared/_rating.html.erb +16 -0
  39. data/app/views/shared/_review.html.erb +14 -0
  40. data/app/views/shared/_review_summary.html.erb +13 -0
  41. data/app/views/shared/_reviews.html.erb +9 -0
  42. data/app/views/shared/_shortrating.html.erb +11 -0
  43. data/config/locales/de.yml +40 -0
  44. data/config/locales/en-GB.yml +23 -0
  45. data/config/locales/en.yml +53 -0
  46. data/config/locales/fr-FR.yml +19 -0
  47. data/config/locales/ru.yml +47 -0
  48. data/config/routes.rb +22 -0
  49. data/db/migrate/20081020220700_create_ratings.rb +14 -0
  50. data/db/migrate/20081020220724_create_reviews.rb +18 -0
  51. data/db/migrate/20101222083309_create_feedback_reviews.rb +17 -0
  52. data/db/sample/ratings.yml +16 -0
  53. data/db/sample/reviews.yml +59 -0
  54. data/lib/spree/reviews/config.rb +11 -0
  55. data/lib/spree_reviews.rb +17 -0
  56. data/lib/spree_reviews_hook.rb +17 -0
  57. data/lib/tasks/reviews_extension_tasks.rake +25 -0
  58. data/public/images/delete.gif +0 -0
  59. data/public/images/star.gif +0 -0
  60. data/public/javascripts/jquery.rating.js +11 -0
  61. data/public/stylesheets/reviews.css +44 -0
  62. data/spec/controllers/reviews_controller_spec.rb +15 -0
  63. data/spec/helpers/reviews_helper_spec.rb +11 -0
  64. data/spec/models/ratings_spec.rb +11 -0
  65. data/spec/models/reviews_spec.rb +11 -0
  66. data/spec/spec.opts +6 -0
  67. data/spec/spec_helper.rb +37 -0
  68. data/spec/views/reviews/submit_view_spec.rb +12 -0
  69. data/spree_reviews.gemspec +22 -0
  70. metadata +145 -0
@@ -0,0 +1,19 @@
1
+ fr-FR:
2
+ write_your_own_review: "Ecrivez un commentaire"
3
+ review_management: "Gestion des commentaires"
4
+ review_management_description: "Gestion des commentaires envoyés par les utilisateurs"
5
+ back_reviews: "Revenir aux commentaires"
6
+ are_you_sure_review: "Êtes-vous sûr de vouloir supprimer ce commentaire ?"
7
+ info_approve_review: "Commentaire approuvé"
8
+ error_approve_review: "Erreur lors de la validation du commentaire"
9
+ approve: "Approuvé"
10
+ leave_us_a_review: "Donnez votre avis sur "
11
+ review_successfully_sumbitted: "Avis soumis à modération"
12
+ rating: "Note"
13
+ submit_your_review: "Valider votre commentaire"
14
+ reviews:
15
+ review_settings: Review Settings
16
+ manage_review_settings: Control the display of reviews
17
+ preview_size: Size of the review snippets
18
+ include_unapproved: Include unapproved reviews in listings
19
+
@@ -0,0 +1,47 @@
1
+ ru:
2
+ write_your_own_review: Оставьте свой отзыв
3
+ review_management: Управление отзывами
4
+ review_management_description: Управляйте отзывами покупателей
5
+ back_reviews: Назад к отзывам
6
+ are_you_sure_review: Вы уверены, что хотите удалить отзыв?
7
+ info_approve_review: Отзыв одобрен
8
+ error_approve_review: Ошибка при одобрении отзыва
9
+ approve: Одобрить
10
+ leave_us_a_review_for: Пожалуйста, оставьте отзыв и оценку для
11
+ review_successfully_submitted: Ваш отзыв был успешно отправлен
12
+ rating: Оценка
13
+ submit_your_review: Оставить отзыв
14
+ review_content: Содержание
15
+ review_title: Заголовок
16
+ reviews:
17
+ review_settings: Настройки отзывов покупателей
18
+ manage_review_settings: Control the display of reviews
19
+ preview_size: Size of the review snippets
20
+ include_unapproved: Включать неодобренные пока отзывы в список
21
+ your_name: Ваше имя
22
+ your_location: Город
23
+ average_customer_rating: Average rating
24
+ the_fine_print: The fine print
25
+ terms_text: All opinions must comply with our terms and conditions
26
+ approved_text: Unlocked comments will be published within 1-2 business days.
27
+ guideline_text: We reserve the right not to post opinions unrelated to your product
28
+ "terms and conditions": Terms & Conditions
29
+ "review guidelines": Review Guidelines
30
+ date_: Date
31
+ for: for
32
+ Unapproved_reviews: Unapproved
33
+ Approved_reviews: Approved
34
+ from: from
35
+ by: by
36
+ submitted_on: Submitted on
37
+ based_upon: "на основе"
38
+ review:
39
+ zero: "0 озывов"
40
+ one: "1 отзыв"
41
+ few: "%{count} отзыва"
42
+ other: "%{count} отзывов"
43
+
44
+ feedback: Feedback
45
+ stars: Stars
46
+ feedback_review_for: "Review: '%{review}'"
47
+
data/config/routes.rb ADDED
@@ -0,0 +1,22 @@
1
+ Rails.application.routes.draw do
2
+ namespace :admin do
3
+ resources :feedback_reviews
4
+ resources :reviews do
5
+ member do
6
+ get :approve
7
+ end
8
+ resources :feedback_reviews
9
+ end
10
+ resource :review_settings
11
+ end
12
+
13
+ resources :products do
14
+ resources :reviews do
15
+ collection do
16
+ get :terms
17
+ get "submissionguidelines"
18
+ end
19
+ end
20
+ end
21
+ match "/reviews/:review_id/feedback(.:format)" => "feedback_reviews#create", :via => :post, :as => "feedback_review"
22
+ end
@@ -0,0 +1,14 @@
1
+ class CreateRatings < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :ratings do |t|
4
+ t.integer :product_id
5
+ t.decimal :value
6
+ t.integer :count
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :ratings
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ class CreateReviews < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :reviews do |t|
4
+ t.integer :product_id
5
+ t.string :name
6
+ t.string :location
7
+ t.integer :rating
8
+ t.text :title
9
+ t.text :review
10
+ t.boolean :approved, :default => false
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def self.down
16
+ drop_table :reviews
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ class CreateFeedbackReviews < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :feedback_reviews do |t|
4
+ t.integer :user_id
5
+ t.integer :review_id, :null => false
6
+ t.integer :rating, :default => 0
7
+ t.text :comment
8
+ t.timestamps
9
+ end
10
+ add_index :feedback_reviews, :review_id
11
+ add_index :feedback_reviews, :user_id
12
+ end
13
+
14
+ def self.down
15
+ drop_table :feedback_reviews
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ t1:
2
+ product: ror_jr_spaghetti
3
+ value: 3.56
4
+ count: 20
5
+ t2:
6
+ product: ror_bag
7
+ value: 2.56
8
+ count: 30
9
+ t3:
10
+ product: ror_tote
11
+ value: 3.94
12
+ count: 10
13
+ t4:
14
+ product: apache_baseball_jersey
15
+ value: 1.49
16
+ count: 6
@@ -0,0 +1,59 @@
1
+ <%
2
+ require 'faker'
3
+ %>
4
+ r1:
5
+ product: ror_tote
6
+ name: <%= Faker::Name.first_name %> <%= Faker::Name.last_name %>
7
+ location: here
8
+ rating: 4
9
+ title: "more uses for this item"
10
+ review: <%= Faker::Lorem.paragraph %>
11
+ approved: true
12
+ r2:
13
+ product: ror_tote
14
+ name: <%= Faker::Name.first_name %> <%= Faker::Name.last_name %>
15
+ location: here
16
+ rating: 3
17
+ title: "further comments"
18
+ review: <%= Faker::Lorem.paragraph %>
19
+ approved: false
20
+ r3:
21
+ product: ror_ringer
22
+ name: <%= Faker::Name.first_name %> <%= Faker::Name.last_name %>
23
+ location: here
24
+ rating: 4
25
+ title: "essential wear"
26
+ review: <%= Faker::Lorem.paragraph %>
27
+ approved: false
28
+ r4:
29
+ product: apache_baseball_jersey
30
+ name: <%= Faker::Name.first_name %> <%= Faker::Name.last_name %>
31
+ location: here
32
+ rating: 2
33
+ title: "not impressed"
34
+ review: <%= Faker::Lorem.paragraph %>
35
+ approved: true
36
+ r5:
37
+ product: ror_ringer
38
+ name: <%= Faker::Name.first_name %> <%= Faker::Name.last_name %>
39
+ location: an office
40
+ rating: 5
41
+ title: "I have one for every day of the week"
42
+ review: <%= Faker::Lorem.paragraph %>
43
+ approved: true
44
+ r6:
45
+ product: ror_ringer
46
+ name: <%= Faker::Name.first_name %> <%= Faker::Name.last_name %>
47
+ location: here
48
+ rating: 4
49
+ title: "cooler than my toga"
50
+ review: <%= Faker::Lorem.paragraph %>
51
+ approved: true
52
+ r7:
53
+ product: ror_ringer
54
+ name: <%= Faker::Name.first_name %> <%= Faker::Name.last_name %>
55
+ location: emerald city
56
+ rating: 2
57
+ title: "my other half didn't like it"
58
+ review: <%= Faker::Lorem.paragraph %>
59
+ approved: false
@@ -0,0 +1,11 @@
1
+ module Spree::Reviews
2
+ class Config < Spree::Config
3
+ class << self
4
+ def instance
5
+ return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
6
+ ReviewsConfiguration.find_or_create_by_name("Reviews configuration")
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,17 @@
1
+ require 'spree_core'
2
+ require 'spree_reviews_hook'
3
+
4
+ module SpreeReviews
5
+ class Engine < Rails::Engine
6
+
7
+ config.autoload_paths += %W(#{config.root}/lib)
8
+
9
+ def self.activate
10
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
11
+ Rails.env.production? ? require(c) : load(c)
12
+ end
13
+ end
14
+
15
+ config.to_prepare &method(:activate).to_proc
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ class SpreeReviewsHooks < Spree::ThemeSupport::HookListener
2
+ insert_after :product_properties, 'shared/reviews'
3
+ insert_after :inside_head do
4
+ %(<%= stylesheet_link_tag('reviews.css') %>)
5
+ end
6
+
7
+ insert_after :admin_product_sub_tabs do
8
+ %(
9
+ <%= tab(:reviews, :label => 'review_management') %>
10
+ )
11
+ end
12
+
13
+ insert_after :admin_configurations_menu do
14
+ %(<%= configurations_menu_item(t('reviews.review_settings'), admin_review_settings_path, t('reviews.manage_review_settings')) %>)
15
+ end
16
+
17
+ end
@@ -0,0 +1,25 @@
1
+ namespace :spree_reviews do
2
+ desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
3
+ task :install do
4
+ Rake::Task['spree_reviews:install:migrations'].invoke
5
+ Rake::Task['spree_reviews:install:assets'].invoke
6
+ end
7
+
8
+ namespace :install do
9
+ desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
10
+ task :migrations do
11
+ source = File.join(File.dirname(__FILE__), '..', '..', 'db')
12
+ destination = File.join(Rails.root, 'db')
13
+ puts "INFO: Mirroring assets from #{source} to #{destination}"
14
+ Spree::FileUtilz.mirror_files(source, destination)
15
+ end
16
+
17
+ desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
18
+ task :assets do
19
+ source = File.join(File.dirname(__FILE__), '..', '..', 'public')
20
+ destination = File.join(Rails.root, 'public')
21
+ puts "INFO: Mirroring assets from #{source} to #{destination}"
22
+ Spree::FileUtilz.mirror_files(source, destination)
23
+ end
24
+ end
25
+ end
Binary file
Binary file
@@ -0,0 +1,11 @@
1
+ /*
2
+ ### jQuery Star Rating Plugin v3.12 - 2009-04-16 ###
3
+ * Home: http://www.fyneworks.com/jquery/star-rating/
4
+ * Code: http://code.google.com/p/jquery-star-rating-plugin/
5
+ *
6
+ * Dual licensed under the MIT and GPL licenses:
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ * http://www.gnu.org/licenses/gpl.html
9
+ ###
10
+ */
11
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';5(1O.1t)(7($){5($.29.1x)1I{1m.23("1u",P,z)}1F(e){}$.p.4=7(j){5(3.K==0)l 3;5(E J[0]==\'1j\'){5(3.K>1){8 k=J;l 3.W(7(){$.p.4.H($(3),k)})};$.p.4[J[0]].H(3,$.1T(J).21(1)||[]);l 3};8 j=$.10({},$.p.4.18,j||{});3.1v(\'.9-4-1l\').n(\'9-4-1l\').W(7(){8 a=(3.1J||\'1K-4\').1L(/\\[|\\]+/g,"1S");8 b=$(3.1U||1m.1X);8 c=$(3);8 d=b.6(\'4\')||{y:0};8 e=d[a];8 f;5(e)f=e.6(\'4\');5(e&&f){f.y++}B{f=$.10({},j||{},($.1k?c.1k():($.1H?c.6():s))||{},{y:0,C:[],u:[]});f.t=d.y++;e=$(\'<1M 12="9-4-1Q"/>\');c.1R(e);e.n(\'4-T-13-S\');5(c.R(\'Q\'))f.m=z;e.1a(f.A=$(\'<O 12="4-A"><a 14="\'+f.A+\'">\'+f.15+\'</a></O>\').1d(7(){$(3).4(\'N\');$(3).n(\'9-4-M\')}).1b(7(){$(3).4(\'v\');$(3).D(\'9-4-M\')}).1h(7(){$(3).4(\'w\')}).6(\'4\',f))};8 g=$(\'<O 12="9-4 q-\'+f.t+\'"><a 14="\'+(3.14||3.1p)+\'">\'+3.1p+\'</a></O>\');e.1a(g);5(3.U)g.R(\'U\',3.U);5(3.17)g.n(3.17);5(f.1V)f.x=2;5(E f.x==\'19\'&&f.x>0){8 h=($.p.11?g.11():0)||f.1c;8 i=(f.y%f.x),V=1y.1z(h/f.x);g.11(V).1A(\'a\').1B({\'1C-1D\':\'-\'+(i*V)+\'1E\'})};5(f.m)g.n(\'9-4-1e\');B g.n(\'9-4-1G\').1d(7(){$(3).4(\'1f\');$(3).4(\'G\')}).1b(7(){$(3).4(\'v\');$(3).4(\'F\')}).1h(7(){$(3).4(\'w\')});5(3.L)f.o=g;c.1i();c.1N(7(){$(3).4(\'w\')});g.6(\'4.r\',c.6(\'4.9\',g));f.C[f.C.K]=g[0];f.u[f.u.K]=c[0];f.q=d[a]=e;f.1P=b;c.6(\'4\',f);e.6(\'4\',f);g.6(\'4\',f);b.6(\'4\',d)});$(\'.4-T-13-S\').4(\'v\').D(\'4-T-13-S\');l 3};$.10($.p.4,{G:7(){8 a=3.6(\'4\');5(!a)l 3;5(!a.G)l 3;8 b=$(3).6(\'4.r\')||$(3.Z==\'X\'?3:s);5(a.G)a.G.H(b[0],[b.I(),$(\'a\',b.6(\'4.9\'))[0]])},F:7(){8 a=3.6(\'4\');5(!a)l 3;5(!a.F)l 3;8 b=$(3).6(\'4.r\')||$(3.Z==\'X\'?3:s);5(a.F)a.F.H(b[0],[b.I(),$(\'a\',b.6(\'4.9\'))[0]])},1f:7(){8 a=3.6(\'4\');5(!a)l 3;5(a.m)l;3.4(\'N\');3.1n().1o().Y(\'.q-\'+a.t).n(\'9-4-M\')},N:7(){8 a=3.6(\'4\');5(!a)l 3;5(a.m)l;a.q.1W().Y(\'.q-\'+a.t).D(\'9-4-1q\').D(\'9-4-M\')},v:7(){8 a=3.6(\'4\');5(!a)l 3;3.4(\'N\');5(a.o){a.o.6(\'4.r\').R(\'L\',\'L\');a.o.1n().1o().Y(\'.q-\'+a.t).n(\'9-4-1q\')}B $(a.u).1r(\'L\');a.A[a.m||a.1Y?\'1i\':\'1Z\']();3.20()[a.m?\'n\':\'D\'](\'9-4-1e\')},w:7(a){8 b=3.6(\'4\');5(!b)l 3;5(b.m)l;b.o=s;5(E a!=\'1s\'){5(E a==\'19\')l $(b.C[a]).4(\'w\');5(E a==\'1j\')$.W(b.C,7(){5($(3).6(\'4.r\').I()==a)$(3).4(\'w\')})}B b.o=3[0].Z==\'X\'?3.6(\'4.9\'):(3.22(\'.q-\'+b.t)?3:s);3.6(\'4\',b);3.4(\'v\');8 c=$(b.o?b.o.6(\'4.r\'):s);5(b.1g)b.1g.H(c[0],[c.I(),$(\'a\',b.o)[0]])},m:7(a,b){8 c=3.6(\'4\');5(!c)l 3;c.m=a||a==1s?z:P;5(b)$(c.u).R("Q","Q");B $(c.u).1r("Q");3.6(\'4\',c);3.4(\'v\')},24:7(){3.4(\'m\',z,z)},25:7(){3.4(\'m\',P,P)}});$.p.4.18={A:\'26 27\',15:\'\',x:0,1c:16};$(7(){$(\'r[28=1w].9\').4()})})(1t);',62,134,'|||this|rating|if|data|function|var|star||||||||||||return|readOnly|addClass|current|fn|rater|input|null|serial|inputs|draw|select|split|count|true|cancel|else|stars|removeClass|typeof|blur|focus|apply|val|arguments|length|checked|hover|drain|div|false|disabled|attr|drawn|to|id|spw|each|INPUT|filter|tagName|extend|width|class|be|title|cancelValue||className|options|number|append|mouseout|starWidth|mouseover|readonly|fill|callback|click|hide|string|metadata|applied|document|prevAll|andSelf|value|on|removeAttr|undefined|jQuery|BackgroundImageCache|not|radio|msie|Math|floor|find|css|margin|left|px|catch|live|meta|try|name|unnamed|replace|span|change|window|context|control|before|_|makeArray|form|half|children|body|required|show|siblings|slice|is|execCommand|disable|enable|Cancel|Rating|type|browser'.split('|'),0,{}))
@@ -0,0 +1,44 @@
1
+ #reviews div.header {
2
+ font-size: 12pt;
3
+ font-weight: bold;
4
+ border-bottom: 1px #2222aa dashed;
5
+ margin-top: 10px;
6
+ margin-bottom: 10px;
7
+ }
8
+ #reviews div.review {
9
+ border-bottom: 1px #2222aa dashed;
10
+ margin-bottom: 10px;
11
+ }
12
+ #reviews div.review span.title {
13
+ font-size: 11pt;
14
+ font-weight: bold;
15
+ }
16
+ #reviews div.review span.attribution {
17
+ font-size: 8pt;
18
+ }
19
+
20
+ .lit {
21
+ background-color: #aaaaaa;
22
+ color: #0000bb;
23
+ margin-right: 1px;
24
+ padding-left: 1px;
25
+ }
26
+ .unlit {
27
+ background-color: #aaaaaa;
28
+ color: #000000;
29
+ margin-right: 1px;
30
+ padding-left: 1px;
31
+ }
32
+
33
+ /* jQuery.Rating Plugin CSS - http://www.fyneworks.com/jquery/star-rating/ */
34
+ div.rating-cancel,div.star-rating{float:left;width:17px;height:15px;text-indent:-999em;cursor:pointer;display:block;background:transparent;overflow:hidden}
35
+ div.rating-cancel,div.rating-cancel a{background: transparent url('/images/delete.gif') no-repeat scroll 0 -16px;}
36
+ div.star-rating,div.star-rating a{background:url('/images/star.gif') no-repeat 0 0px}
37
+ div.rating-cancel a,div.star-rating a{display:block;width:16px;height:100%;background-position:0 0px;border:0}
38
+ div.star-rating-on a{background-position:0 -16px!important}
39
+ div.star-rating-hover a{background-position:0 -32px}
40
+ /* Read Only CSS */
41
+ div.star-rating-readonly a{cursor:default !important}
42
+ /* Partial Star CSS */
43
+ div.star-rating{background:transparent!important;overflow:hidden!important}
44
+ /* END jQuery.Rating Plugin CSS */
@@ -0,0 +1,15 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe ReviewsController do
4
+
5
+ #Delete these examples and add some real ones
6
+ it "should use ReviewsController" do
7
+ controller.should be_an_instance_of(ReviewsController)
8
+ end
9
+
10
+
11
+ it "GET 'submit' should be successful" do
12
+ get 'submit'
13
+ response.should be_success
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe ReviewsHelper do
4
+
5
+ #Delete this example and add some real ones or delete this file
6
+ it "should include the ReviewsHelper" do
7
+ included_modules = self.metaclass.send :included_modules
8
+ included_modules.should include(ReviewsHelper)
9
+ end
10
+
11
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Ratings do
4
+ before(:each) do
5
+ @ratings = Ratings.new
6
+ end
7
+
8
+ it "should be valid" do
9
+ @ratings.should be_valid
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Reviews do
4
+ before(:each) do
5
+ @reviews = Reviews.new
6
+ end
7
+
8
+ it "should be valid" do
9
+ @reviews.should be_valid
10
+ end
11
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
@@ -0,0 +1,37 @@
1
+ unless defined? SPREE_ROOT
2
+ ENV["RAILS_ENV"] = "test"
3
+ case
4
+ when ENV["SPREE_ENV_FILE"]
5
+ require ENV["SPREE_ENV_FILE"]
6
+ when File.dirname(__FILE__) =~ %r{vendor/SPREE/vendor/extensions}
7
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../../")}/config/environment"
8
+ else
9
+ require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../")}/config/environment"
10
+ end
11
+ end
12
+ require "#{SPREE_ROOT}/spec/spec_helper"
13
+
14
+ if File.directory?(File.dirname(__FILE__) + "/scenarios")
15
+ Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios"
16
+ end
17
+ if File.directory?(File.dirname(__FILE__) + "/matchers")
18
+ Dir[File.dirname(__FILE__) + "/matchers/*.rb"].each {|file| require file }
19
+ end
20
+
21
+ Spec::Runner.configure do |config|
22
+ # config.use_transactional_fixtures = true
23
+ # config.use_instantiated_fixtures = false
24
+ # config.fixture_path = RAILS_ROOT + '/spec/fixtures'
25
+
26
+ # You can declare fixtures for each behaviour like this:
27
+ # describe "...." do
28
+ # fixtures :table_a, :table_b
29
+ #
30
+ # Alternatively, if you prefer to declare them only once, you can
31
+ # do so here, like so ...
32
+ #
33
+ # config.global_fixtures = :table_a, :table_b
34
+ #
35
+ # If you declare global fixtures, be aware that they will be declared
36
+ # for all of your examples, even those that don't use them.
37
+ end