refinerycms-stores 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/Gemfile +26 -0
  2. data/Gemfile.lock +306 -0
  3. data/Guardfile +27 -0
  4. data/LICENSE.txt +20 -0
  5. data/Rakefile +65 -0
  6. data/VERSION +1 -0
  7. data/app/assets/stylesheets/refinery/refinerycms-stores.sass +76 -0
  8. data/app/controllers/refinery/addresses/admin/addresses_controller.rb +12 -0
  9. data/app/controllers/refinery/orders/admin/orders_controller.rb +12 -0
  10. data/app/controllers/refinery/orders/orders_controller.rb +96 -0
  11. data/app/controllers/refinery/products/admin/products_controller.rb +12 -0
  12. data/app/controllers/refinery/products/products_controller.rb +17 -0
  13. data/app/controllers/refinery/stores/admin/stores_controller.rb +12 -0
  14. data/app/controllers/refinery/stores/stores_controller.rb +80 -0
  15. data/app/helpers/refinery/orders/orders_helper.rb +11 -0
  16. data/app/models/refinery/addresses/address.rb +12 -0
  17. data/app/models/refinery/orders/line_item.rb +24 -0
  18. data/app/models/refinery/orders/order.rb +364 -0
  19. data/app/models/refinery/products/product.rb +17 -0
  20. data/app/models/refinery/stores/store.rb +33 -0
  21. data/app/views/refinery/addresses/admin/addresses/_actions.html.erb +25 -0
  22. data/app/views/refinery/addresses/admin/addresses/_address.html.erb +16 -0
  23. data/app/views/refinery/addresses/admin/addresses/_addresses.html.erb +2 -0
  24. data/app/views/refinery/addresses/admin/addresses/_form.html.erb +89 -0
  25. data/app/views/refinery/addresses/admin/addresses/_records.html.erb +18 -0
  26. data/app/views/refinery/addresses/admin/addresses/_sortable_list.html.erb +5 -0
  27. data/app/views/refinery/addresses/admin/addresses/edit.html.erb +1 -0
  28. data/app/views/refinery/addresses/admin/addresses/index.html.erb +7 -0
  29. data/app/views/refinery/addresses/admin/addresses/new.html.erb +1 -0
  30. data/app/views/refinery/orders/admin/orders/_actions.html.erb +25 -0
  31. data/app/views/refinery/orders/admin/orders/_form.html.erb +122 -0
  32. data/app/views/refinery/orders/admin/orders/_order.html.erb +20 -0
  33. data/app/views/refinery/orders/admin/orders/_orders.html.erb +2 -0
  34. data/app/views/refinery/orders/admin/orders/_records.html.erb +18 -0
  35. data/app/views/refinery/orders/admin/orders/_sortable_list.html.erb +5 -0
  36. data/app/views/refinery/orders/admin/orders/edit.html.erb +1 -0
  37. data/app/views/refinery/orders/admin/orders/index.html.erb +7 -0
  38. data/app/views/refinery/orders/admin/orders/new.html.erb +1 -0
  39. data/app/views/refinery/orders/orders/_address_form.html.haml +35 -0
  40. data/app/views/refinery/orders/orders/_card_form.html.haml +63 -0
  41. data/app/views/refinery/orders/orders/_order_snapshot.html.haml +44 -0
  42. data/app/views/refinery/orders/orders/confirmation.html.haml +26 -0
  43. data/app/views/refinery/orders/orders/edit.html.haml +36 -0
  44. data/app/views/refinery/orders/orders/index.html.haml +6 -0
  45. data/app/views/refinery/orders/orders/purchase.html.haml +25 -0
  46. data/app/views/refinery/orders/orders/show.html.haml +36 -0
  47. data/app/views/refinery/products/admin/products/_actions.html.erb +25 -0
  48. data/app/views/refinery/products/admin/products/_form.html.erb +127 -0
  49. data/app/views/refinery/products/admin/products/_product.html.erb +20 -0
  50. data/app/views/refinery/products/admin/products/_products.html.erb +2 -0
  51. data/app/views/refinery/products/admin/products/_records.html.erb +18 -0
  52. data/app/views/refinery/products/admin/products/_sortable_list.html.erb +5 -0
  53. data/app/views/refinery/products/admin/products/edit.html.erb +4 -0
  54. data/app/views/refinery/products/admin/products/index.html.erb +10 -0
  55. data/app/views/refinery/products/admin/products/new.html.erb +4 -0
  56. data/app/views/refinery/products/products/show.html.erb +105 -0
  57. data/app/views/refinery/stores/admin/stores/_actions.html.erb +57 -0
  58. data/app/views/refinery/stores/admin/stores/_form.html.erb +56 -0
  59. data/app/views/refinery/stores/admin/stores/_records.html.erb +18 -0
  60. data/app/views/refinery/stores/admin/stores/_sortable_list.html.erb +5 -0
  61. data/app/views/refinery/stores/admin/stores/_store.html.erb +20 -0
  62. data/app/views/refinery/stores/admin/stores/_stores.html.erb +2 -0
  63. data/app/views/refinery/stores/admin/stores/edit.html.erb +4 -0
  64. data/app/views/refinery/stores/admin/stores/index.html.erb +13 -0
  65. data/app/views/refinery/stores/admin/stores/new.html.erb +4 -0
  66. data/app/views/refinery/stores/stores/_cart.html.erb +22 -0
  67. data/app/views/refinery/stores/stores/_cart_item.html.erb +9 -0
  68. data/app/views/refinery/stores/stores/_list_product.html.erb +16 -0
  69. data/app/views/refinery/stores/stores/index.html.erb +11 -0
  70. data/app/views/refinery/stores/stores/show.html.erb +28 -0
  71. data/config/locales/en.yml +143 -0
  72. data/config/locales/es.yml +143 -0
  73. data/config/locales/fr.yml +139 -0
  74. data/config/locales/nb.yml +143 -0
  75. data/config/locales/nl.yml +143 -0
  76. data/config/routes.rb +81 -0
  77. data/db/migrate/1_create_stores_stores.rb +29 -0
  78. data/db/migrate/2_create_products_products.rb +44 -0
  79. data/db/migrate/3_create_orders_orders.rb +44 -0
  80. data/db/migrate/4_create_orders_line_items.rb +20 -0
  81. data/db/migrate/5_create_addresses_addresses.rb +39 -0
  82. data/db/seeds.rb +23 -0
  83. data/lib/generators/refinery/stores_generator.rb +17 -0
  84. data/lib/refinery/addresses/engine.rb +31 -0
  85. data/lib/refinery/addresses.rb +21 -0
  86. data/lib/refinery/cart.rb +36 -0
  87. data/lib/refinery/cart_item.rb +28 -0
  88. data/lib/refinery/orders/engine.rb +31 -0
  89. data/lib/refinery/orders.rb +21 -0
  90. data/lib/refinery/products/engine.rb +31 -0
  91. data/lib/refinery/products.rb +21 -0
  92. data/lib/refinery/store_gateway.rb +106 -0
  93. data/lib/refinery/stores/engine.rb +31 -0
  94. data/lib/refinery/stores.rb +21 -0
  95. data/lib/refinerycms-stores.rb +7 -0
  96. data/lib/tasks/refinery/stores.rake +13 -0
  97. data/readme.md +10 -0
  98. data/refinerycms-stores.gemspec +261 -0
  99. data/spec/models/refinery/addresses/address_spec.rb +18 -0
  100. data/spec/models/refinery/orders/order_spec.rb +18 -0
  101. data/spec/models/refinery/products/product_spec.rb +18 -0
  102. data/spec/models/refinery/stores/store_spec.rb +18 -0
  103. data/spec/requests/refinery/addresses/admin/addresses_spec.rb +101 -0
  104. data/spec/requests/refinery/orders/admin/orders_spec.rb +101 -0
  105. data/spec/requests/refinery/products/admin/products_spec.rb +101 -0
  106. data/spec/requests/refinery/stores/admin/stores_spec.rb +101 -0
  107. data/spec/spec_helper.rb +53 -0
  108. data/spec/support/factories/refinery/addresses.rb +7 -0
  109. data/spec/support/factories/refinery/orders.rb +7 -0
  110. data/spec/support/factories/refinery/products.rb +7 -0
  111. data/spec/support/factories/refinery/stores.rb +7 -0
  112. data/tasks/rspec.rake +6 -0
  113. data/tasks/testing.rake +8 -0
  114. data/test/helper.rb +17 -0
  115. data/test/test_refinerycms-cart.rb +7 -0
  116. metadata +571 -0
@@ -0,0 +1,106 @@
1
+ module Refinery
2
+ class StoreGateway
3
+
4
+ require 'stripe'
5
+
6
+ # #########################################################################
7
+ # #########################################################################
8
+ # PAYMENT / GATEWAY CONFIGURATION
9
+ # #########################################################################
10
+ # #########################################################################
11
+
12
+ attr_reader :gateway_mode,
13
+ :payment_access_url, :payment_secret_key, :payment_api_key
14
+
15
+ # #########################################################################
16
+ # #########################################################################
17
+ # ---------------------------------------------------------------------------
18
+ # initialize -- creates new StoreGateway obj;
19
+ # args: store object
20
+ # ---------------------------------------------------------------------------
21
+ def initialize( store )
22
+ @store = store # remember the store
23
+
24
+ @gateways = %w( stripe )
25
+
26
+ # TODO: make this variable by gateway type
27
+ payment_gateway = "stripe"
28
+ @gateway_mode = ::Refinery::Setting.find_or_set( :payment_gateway_mode, "test" )
29
+ # do some error checking & cleanup
30
+ @gateway_mode = "test" unless @gateway_mode =~ /(test)|(live)/
31
+
32
+ # setup the keys for the payment gateway
33
+ payment_settings = "#{payment_gateway}_#{@gateway_mode}"
34
+
35
+ @payment_access_url = ::Refinery::Setting.find_or_set( "#{payment_settings}_access_url".to_sym, "access URL missing" )
36
+ @payment_secret_key = ::Refinery::Setting.find_or_set( "#{payment_settings}_secret_key".to_sym, "secret key missing" )
37
+ @payment_api_key = ::Refinery::Setting.find_or_set( "#{payment_settings}_api_key".to_sym, "public API key missing" )
38
+ end
39
+
40
+ # ---------------------------------------------------------------------------
41
+ # ---------------------------------------------------------------------------
42
+ def store_name
43
+ str = @store.name
44
+ str << " [TEST MODE]" if @gateway_mode == "test"
45
+ return str
46
+ end
47
+
48
+ # ---------------------------------------------------------------------------
49
+ # ---------------------------------------------------------------------------
50
+ def purchase_description( order_nbr, email )
51
+ "#{store_name } Order: #{order_nbr.to_s} purchase for: #{email.to_s}"
52
+ end
53
+
54
+ # ---------------------------------------------------------------------------
55
+ # charge_purchase -- charge customer card for purchase
56
+ # return nil if error; else the JSON charge object from Stripe
57
+ # args:
58
+ # token -- string for CC token produced earlier
59
+ # amount -- float amt for charge in dollars.cents
60
+ # order -- order object
61
+ # email -- customer email
62
+ # ---------------------------------------------------------------------------
63
+ def charge_purchase( token, amount, order, email )
64
+ begin
65
+ # secret_key for Stripe
66
+ Stripe.api_key = @payment_secret_key
67
+
68
+ # create the charge on Stripe's servers
69
+ # this will charge the user's card
70
+
71
+ charge = Stripe::Charge.create(
72
+ :amount => (amount * 100).to_i, # amount in cents
73
+ :currency => "usd", # US$
74
+ :card => token,
75
+ :description => purchase_description( order.order_number, email )
76
+ )
77
+
78
+ return charge
79
+
80
+ rescue ::Stripe::StripeError
81
+ order.errors.add($!.class.to_s, $!.to_s ) # capture errors to base object
82
+ # order.errors.add(:cc_token, $!.class.to_s + ": " + $!.to_s ) # capture errors to base object
83
+ return nil
84
+
85
+ end # begin .. end for exceptions
86
+
87
+
88
+ end
89
+
90
+ # ---------------------------------------------------------------------------
91
+ # ---------------------------------------------------------------------------
92
+ def register_gateway(name)
93
+ @gateways << name
94
+ end
95
+
96
+ # ---------------------------------------------------------------------------
97
+ # ---------------------------------------------------------------------------
98
+ def clear_gateways!
99
+ @gateways = []
100
+ end
101
+
102
+ # #########################################################################
103
+ # #########################################################################
104
+
105
+ end # class StoreGateway
106
+ end # module Refinery
@@ -0,0 +1,31 @@
1
+ module Refinery
2
+ module Stores
3
+ class Engine < Rails::Engine
4
+ include Refinery::Engine
5
+ isolate_namespace Refinery::Stores
6
+
7
+ engine_name :refinery_stores
8
+
9
+ initializer "register refinerycms_stores plugin" do |app|
10
+ Refinery::Plugin.register do |plugin|
11
+ plugin.name = "stores"
12
+ plugin.url = {
13
+ :controller => 'refinery/stores/admin/stores',
14
+ :action => 'index'
15
+ }
16
+ plugin.pathname = root
17
+
18
+ plugin.activity = {
19
+ :class_name => :'refinery/stores/store',
20
+ :title => 'name'
21
+ }
22
+
23
+ end
24
+ end
25
+
26
+ config.after_initialize do
27
+ Refinery.register_engine(Refinery::Stores)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ require 'refinerycms-core'
2
+
3
+ module Refinery
4
+ autoload :StoresGenerator, 'generators/refinery/stores_generator'
5
+
6
+ module Stores
7
+ require 'refinery/stores/engine'
8
+
9
+ class << self
10
+ attr_writer :root
11
+
12
+ def root
13
+ @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
14
+ end
15
+
16
+ def factory_paths
17
+ @factory_paths ||= [ root.join('spec', 'factories').to_s ]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,7 @@
1
+ require 'refinery/stores'
2
+ require 'refinery/products'
3
+ require 'refinery/cart'
4
+ require 'refinery/cart_item'
5
+ require 'refinery/orders'
6
+ require 'refinery/addresses'
7
+ require 'refinery/store_gateway'
@@ -0,0 +1,13 @@
1
+ namespace :refinery do
2
+
3
+ namespace :stores do
4
+
5
+ # call this task by running: rake refinery:stores:my_task
6
+ # desc "Description of my task below"
7
+ # task :my_task => :environment do
8
+ # # add your logic here
9
+ # end
10
+
11
+ end
12
+
13
+ end
data/readme.md ADDED
@@ -0,0 +1,10 @@
1
+ # Stores engine for Refinery CMS.
2
+
3
+ ## How to build this engine as a gem
4
+
5
+ cd vendor/engines/stores
6
+ gem build refinerycms-stores.gemspec
7
+ gem install refinerycms-stores.gem
8
+
9
+ # Sign up for a http://rubygems.org/ account and publish the gem
10
+ gem push refinerycms-stores.gem
@@ -0,0 +1,261 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "refinerycms-stores"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Daudi Amani"]
12
+ s.date = "2012-03-06"
13
+ s.description = "Complete engine for shopping cart to be used with a RefineryCMS project"
14
+ s.email = "dsaronin@gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt"
17
+ ]
18
+ s.files = [
19
+ "Gemfile",
20
+ "Gemfile.lock",
21
+ "Guardfile",
22
+ "LICENSE.txt",
23
+ "Rakefile",
24
+ "VERSION",
25
+ "app/assets/stylesheets/refinery/refinerycms-stores.sass",
26
+ "app/controllers/refinery/addresses/admin/addresses_controller.rb",
27
+ "app/controllers/refinery/orders/admin/orders_controller.rb",
28
+ "app/controllers/refinery/orders/orders_controller.rb",
29
+ "app/controllers/refinery/products/admin/products_controller.rb",
30
+ "app/controllers/refinery/products/products_controller.rb",
31
+ "app/controllers/refinery/stores/admin/stores_controller.rb",
32
+ "app/controllers/refinery/stores/stores_controller.rb",
33
+ "app/helpers/refinery/orders/orders_helper.rb",
34
+ "app/models/refinery/addresses/address.rb",
35
+ "app/models/refinery/orders/line_item.rb",
36
+ "app/models/refinery/orders/order.rb",
37
+ "app/models/refinery/products/product.rb",
38
+ "app/models/refinery/stores/store.rb",
39
+ "app/views/refinery/addresses/admin/addresses/_actions.html.erb",
40
+ "app/views/refinery/addresses/admin/addresses/_address.html.erb",
41
+ "app/views/refinery/addresses/admin/addresses/_addresses.html.erb",
42
+ "app/views/refinery/addresses/admin/addresses/_form.html.erb",
43
+ "app/views/refinery/addresses/admin/addresses/_records.html.erb",
44
+ "app/views/refinery/addresses/admin/addresses/_sortable_list.html.erb",
45
+ "app/views/refinery/addresses/admin/addresses/edit.html.erb",
46
+ "app/views/refinery/addresses/admin/addresses/index.html.erb",
47
+ "app/views/refinery/addresses/admin/addresses/new.html.erb",
48
+ "app/views/refinery/orders/admin/orders/_actions.html.erb",
49
+ "app/views/refinery/orders/admin/orders/_form.html.erb",
50
+ "app/views/refinery/orders/admin/orders/_order.html.erb",
51
+ "app/views/refinery/orders/admin/orders/_orders.html.erb",
52
+ "app/views/refinery/orders/admin/orders/_records.html.erb",
53
+ "app/views/refinery/orders/admin/orders/_sortable_list.html.erb",
54
+ "app/views/refinery/orders/admin/orders/edit.html.erb",
55
+ "app/views/refinery/orders/admin/orders/index.html.erb",
56
+ "app/views/refinery/orders/admin/orders/new.html.erb",
57
+ "app/views/refinery/orders/orders/_address_form.html.haml",
58
+ "app/views/refinery/orders/orders/_card_form.html.haml",
59
+ "app/views/refinery/orders/orders/_order_snapshot.html.haml",
60
+ "app/views/refinery/orders/orders/confirmation.html.haml",
61
+ "app/views/refinery/orders/orders/edit.html.haml",
62
+ "app/views/refinery/orders/orders/index.html.haml",
63
+ "app/views/refinery/orders/orders/purchase.html.haml",
64
+ "app/views/refinery/orders/orders/show.html.haml",
65
+ "app/views/refinery/products/admin/products/_actions.html.erb",
66
+ "app/views/refinery/products/admin/products/_form.html.erb",
67
+ "app/views/refinery/products/admin/products/_product.html.erb",
68
+ "app/views/refinery/products/admin/products/_products.html.erb",
69
+ "app/views/refinery/products/admin/products/_records.html.erb",
70
+ "app/views/refinery/products/admin/products/_sortable_list.html.erb",
71
+ "app/views/refinery/products/admin/products/edit.html.erb",
72
+ "app/views/refinery/products/admin/products/index.html.erb",
73
+ "app/views/refinery/products/admin/products/new.html.erb",
74
+ "app/views/refinery/products/products/show.html.erb",
75
+ "app/views/refinery/stores/admin/stores/_actions.html.erb",
76
+ "app/views/refinery/stores/admin/stores/_form.html.erb",
77
+ "app/views/refinery/stores/admin/stores/_records.html.erb",
78
+ "app/views/refinery/stores/admin/stores/_sortable_list.html.erb",
79
+ "app/views/refinery/stores/admin/stores/_store.html.erb",
80
+ "app/views/refinery/stores/admin/stores/_stores.html.erb",
81
+ "app/views/refinery/stores/admin/stores/edit.html.erb",
82
+ "app/views/refinery/stores/admin/stores/index.html.erb",
83
+ "app/views/refinery/stores/admin/stores/new.html.erb",
84
+ "app/views/refinery/stores/stores/_cart.html.erb",
85
+ "app/views/refinery/stores/stores/_cart_item.html.erb",
86
+ "app/views/refinery/stores/stores/_list_product.html.erb",
87
+ "app/views/refinery/stores/stores/index.html.erb",
88
+ "app/views/refinery/stores/stores/show.html.erb",
89
+ "config/locales/en.yml",
90
+ "config/locales/es.yml",
91
+ "config/locales/fr.yml",
92
+ "config/locales/nb.yml",
93
+ "config/locales/nl.yml",
94
+ "config/routes.rb",
95
+ "db/migrate/1_create_stores_stores.rb",
96
+ "db/migrate/2_create_products_products.rb",
97
+ "db/migrate/3_create_orders_orders.rb",
98
+ "db/migrate/4_create_orders_line_items.rb",
99
+ "db/migrate/5_create_addresses_addresses.rb",
100
+ "db/seeds.rb",
101
+ "lib/generators/refinery/stores_generator.rb",
102
+ "lib/refinery/addresses.rb",
103
+ "lib/refinery/addresses/engine.rb",
104
+ "lib/refinery/cart.rb",
105
+ "lib/refinery/cart_item.rb",
106
+ "lib/refinery/orders.rb",
107
+ "lib/refinery/orders/engine.rb",
108
+ "lib/refinery/products.rb",
109
+ "lib/refinery/products/engine.rb",
110
+ "lib/refinery/store_gateway.rb",
111
+ "lib/refinery/stores.rb",
112
+ "lib/refinery/stores/engine.rb",
113
+ "lib/refinerycms-stores.rb",
114
+ "lib/tasks/refinery/stores.rake",
115
+ "readme.md",
116
+ "refinerycms-stores.gemspec",
117
+ "spec/models/refinery/addresses/address_spec.rb",
118
+ "spec/models/refinery/orders/order_spec.rb",
119
+ "spec/models/refinery/products/product_spec.rb",
120
+ "spec/models/refinery/stores/store_spec.rb",
121
+ "spec/requests/refinery/addresses/admin/addresses_spec.rb",
122
+ "spec/requests/refinery/orders/admin/orders_spec.rb",
123
+ "spec/requests/refinery/products/admin/products_spec.rb",
124
+ "spec/requests/refinery/stores/admin/stores_spec.rb",
125
+ "spec/spec_helper.rb",
126
+ "spec/support/factories/refinery/addresses.rb",
127
+ "spec/support/factories/refinery/orders.rb",
128
+ "spec/support/factories/refinery/products.rb",
129
+ "spec/support/factories/refinery/stores.rb",
130
+ "tasks/rspec.rake",
131
+ "tasks/testing.rake",
132
+ "test/helper.rb",
133
+ "test/test_refinerycms-cart.rb"
134
+ ]
135
+ s.homepage = "http://github.com/dsaronin@gmail.com/refinerycms-stores"
136
+ s.licenses = ["MIT"]
137
+ s.require_paths = ["lib"]
138
+ s.rubygems_version = "1.8.10"
139
+ s.summary = "refinerycms shopping cart engine"
140
+
141
+ if s.respond_to? :specification_version then
142
+ s.specification_version = 3
143
+
144
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
145
+ s.add_runtime_dependency(%q<refinerycms-stores>, [">= 0"])
146
+ s.add_runtime_dependency(%q<refinerycms>, ["~> 2.0.0"])
147
+ s.add_runtime_dependency(%q<jquery-rails>, [">= 0"])
148
+ s.add_development_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
149
+ s.add_development_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
150
+ s.add_development_dependency(%q<factory_girl_rails>, [">= 0"])
151
+ s.add_development_dependency(%q<generator_spec>, [">= 0"])
152
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
153
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
154
+ s.add_development_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 0"])
155
+ s.add_development_dependency(%q<activerecord-jdbcmysql-adapter>, [">= 0"])
156
+ s.add_development_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
157
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
158
+ s.add_development_dependency(%q<mysql2>, [">= 0"])
159
+ s.add_development_dependency(%q<pg>, [">= 0"])
160
+ s.add_development_dependency(%q<rb-fchange>, ["~> 0.0.5"])
161
+ s.add_development_dependency(%q<rb-notifu>, ["~> 0.0.4"])
162
+ s.add_development_dependency(%q<spork>, ["= 0.9.0.rc9"])
163
+ s.add_development_dependency(%q<guard-spork>, [">= 0"])
164
+ s.add_development_dependency(%q<rb-inotify>, [">= 0.5.1"])
165
+ s.add_development_dependency(%q<libnotify>, ["~> 0.1.3"])
166
+ s.add_development_dependency(%q<rb-inotify>, [">= 0.5.1"])
167
+ s.add_development_dependency(%q<libnotify>, ["~> 0.1.3"])
168
+ s.add_development_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
169
+ s.add_development_dependency(%q<factory_girl_rails>, [">= 0"])
170
+ s.add_development_dependency(%q<generator_spec>, [">= 0"])
171
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
172
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
173
+ s.add_development_dependency(%q<rb-inotify>, [">= 0.5.1"])
174
+ s.add_development_dependency(%q<libnotify>, ["~> 0.1.3"])
175
+ s.add_development_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
176
+ s.add_development_dependency(%q<factory_girl_rails>, [">= 0"])
177
+ s.add_development_dependency(%q<generator_spec>, [">= 0"])
178
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
179
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
180
+ s.add_development_dependency(%q<rb-inotify>, [">= 0.5.1"])
181
+ s.add_development_dependency(%q<libnotify>, ["~> 0.1.3"])
182
+ else
183
+ s.add_dependency(%q<refinerycms-stores>, [">= 0"])
184
+ s.add_dependency(%q<refinerycms>, ["~> 2.0.0"])
185
+ s.add_dependency(%q<jquery-rails>, [">= 0"])
186
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
187
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
188
+ s.add_dependency(%q<factory_girl_rails>, [">= 0"])
189
+ s.add_dependency(%q<generator_spec>, [">= 0"])
190
+ s.add_dependency(%q<jeweler>, [">= 0"])
191
+ s.add_dependency(%q<simplecov>, [">= 0"])
192
+ s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 0"])
193
+ s.add_dependency(%q<activerecord-jdbcmysql-adapter>, [">= 0"])
194
+ s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
195
+ s.add_dependency(%q<sqlite3>, [">= 0"])
196
+ s.add_dependency(%q<mysql2>, [">= 0"])
197
+ s.add_dependency(%q<pg>, [">= 0"])
198
+ s.add_dependency(%q<rb-fchange>, ["~> 0.0.5"])
199
+ s.add_dependency(%q<rb-notifu>, ["~> 0.0.4"])
200
+ s.add_dependency(%q<spork>, ["= 0.9.0.rc9"])
201
+ s.add_dependency(%q<guard-spork>, [">= 0"])
202
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
203
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
204
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
205
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
206
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
207
+ s.add_dependency(%q<factory_girl_rails>, [">= 0"])
208
+ s.add_dependency(%q<generator_spec>, [">= 0"])
209
+ s.add_dependency(%q<jeweler>, [">= 0"])
210
+ s.add_dependency(%q<simplecov>, [">= 0"])
211
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
212
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
213
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
214
+ s.add_dependency(%q<factory_girl_rails>, [">= 0"])
215
+ s.add_dependency(%q<generator_spec>, [">= 0"])
216
+ s.add_dependency(%q<jeweler>, [">= 0"])
217
+ s.add_dependency(%q<simplecov>, [">= 0"])
218
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
219
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
220
+ end
221
+ else
222
+ s.add_dependency(%q<refinerycms-stores>, [">= 0"])
223
+ s.add_dependency(%q<refinerycms>, ["~> 2.0.0"])
224
+ s.add_dependency(%q<jquery-rails>, [">= 0"])
225
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
226
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
227
+ s.add_dependency(%q<factory_girl_rails>, [">= 0"])
228
+ s.add_dependency(%q<generator_spec>, [">= 0"])
229
+ s.add_dependency(%q<jeweler>, [">= 0"])
230
+ s.add_dependency(%q<simplecov>, [">= 0"])
231
+ s.add_dependency(%q<activerecord-jdbcsqlite3-adapter>, [">= 0"])
232
+ s.add_dependency(%q<activerecord-jdbcmysql-adapter>, [">= 0"])
233
+ s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
234
+ s.add_dependency(%q<sqlite3>, [">= 0"])
235
+ s.add_dependency(%q<mysql2>, [">= 0"])
236
+ s.add_dependency(%q<pg>, [">= 0"])
237
+ s.add_dependency(%q<rb-fchange>, ["~> 0.0.5"])
238
+ s.add_dependency(%q<rb-notifu>, ["~> 0.0.4"])
239
+ s.add_dependency(%q<spork>, ["= 0.9.0.rc9"])
240
+ s.add_dependency(%q<guard-spork>, [">= 0"])
241
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
242
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
243
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
244
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
245
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
246
+ s.add_dependency(%q<factory_girl_rails>, [">= 0"])
247
+ s.add_dependency(%q<generator_spec>, [">= 0"])
248
+ s.add_dependency(%q<jeweler>, [">= 0"])
249
+ s.add_dependency(%q<simplecov>, [">= 0"])
250
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
251
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
252
+ s.add_dependency(%q<refinerycms-testing>, ["~> 2.0.0"])
253
+ s.add_dependency(%q<factory_girl_rails>, [">= 0"])
254
+ s.add_dependency(%q<generator_spec>, [">= 0"])
255
+ s.add_dependency(%q<jeweler>, [">= 0"])
256
+ s.add_dependency(%q<simplecov>, [">= 0"])
257
+ s.add_dependency(%q<rb-inotify>, [">= 0.5.1"])
258
+ s.add_dependency(%q<libnotify>, ["~> 0.1.3"])
259
+ end
260
+ end
261
+
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Refinery
4
+ module Addresses
5
+ describe Address do
6
+ describe "validations" do
7
+ subject do
8
+ FactoryGirl.create(:address,
9
+ :first_name => "Refinery CMS")
10
+ end
11
+
12
+ it { should be_valid }
13
+ its(:errors) { should be_empty }
14
+ its(:first_name) { should == "Refinery CMS" }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Refinery
4
+ module Orders
5
+ describe Order do
6
+ describe "validations" do
7
+ subject do
8
+ FactoryGirl.create(:order,
9
+ :order_status => "Refinery CMS")
10
+ end
11
+
12
+ it { should be_valid }
13
+ its(:errors) { should be_empty }
14
+ its(:order_status) { should == "Refinery CMS" }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Refinery
4
+ module Products
5
+ describe Product do
6
+ describe "validations" do
7
+ subject do
8
+ FactoryGirl.create(:product,
9
+ :name => "Refinery CMS")
10
+ end
11
+
12
+ it { should be_valid }
13
+ its(:errors) { should be_empty }
14
+ its(:name) { should == "Refinery CMS" }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Refinery
4
+ module Stores
5
+ describe Store do
6
+ describe "validations" do
7
+ subject do
8
+ FactoryGirl.create(:store,
9
+ :name => "Refinery CMS")
10
+ end
11
+
12
+ it { should be_valid }
13
+ its(:errors) { should be_empty }
14
+ its(:name) { should == "Refinery CMS" }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,101 @@
1
+ # encoding: utf-8
2
+ require "spec_helper"
3
+
4
+ describe Refinery do
5
+ describe "Addresses" do
6
+ describe "Admin" do
7
+ describe "addresses" do
8
+ login_refinery_user
9
+
10
+ describe "addresses list" do
11
+ before(:each) do
12
+ FactoryGirl.create(:address, :first_name => "UniqueTitleOne")
13
+ FactoryGirl.create(:address, :first_name => "UniqueTitleTwo")
14
+ end
15
+
16
+ it "shows two items" do
17
+ visit refinery.addresses_admin_addresses_path
18
+ page.should have_content("UniqueTitleOne")
19
+ page.should have_content("UniqueTitleTwo")
20
+ end
21
+ end
22
+
23
+ describe "create" do
24
+ before(:each) do
25
+ visit refinery.addresses_admin_addresses_path
26
+
27
+ click_link "Add New Address"
28
+ end
29
+
30
+ context "valid data" do
31
+ it "should succeed" do
32
+ fill_in "First Name", :with => "This is a test of the first string field"
33
+ click_button "Save"
34
+
35
+ page.should have_content("'This is a test of the first string field' was successfully added.")
36
+ Refinery::Addresses::Address.count.should == 1
37
+ end
38
+ end
39
+
40
+ context "invalid data" do
41
+ it "should fail" do
42
+ click_button "Save"
43
+
44
+ page.should have_content("First Name can't be blank")
45
+ Refinery::Addresses::Address.count.should == 0
46
+ end
47
+ end
48
+
49
+ context "duplicate" do
50
+ before(:each) { FactoryGirl.create(:address, :first_name => "UniqueTitle") }
51
+
52
+ it "should fail" do
53
+ visit refinery.addresses_admin_addresses_path
54
+
55
+ click_link "Add New Address"
56
+
57
+ fill_in "First Name", :with => "UniqueTitle"
58
+ click_button "Save"
59
+
60
+ page.should have_content("There were problems")
61
+ Refinery::Addresses::Address.count.should == 1
62
+ end
63
+ end
64
+
65
+ end
66
+
67
+ describe "edit" do
68
+ before(:each) { FactoryGirl.create(:address, :first_name => "A first_name") }
69
+
70
+ it "should succeed" do
71
+ visit refinery.addresses_admin_addresses_path
72
+
73
+ within ".actions" do
74
+ click_link "Edit this address"
75
+ end
76
+
77
+ fill_in "First Name", :with => "A different first_name"
78
+ click_button "Save"
79
+
80
+ page.should have_content("'A different first_name' was successfully updated.")
81
+ page.should have_no_content("A first_name")
82
+ end
83
+ end
84
+
85
+ describe "destroy" do
86
+ before(:each) { FactoryGirl.create(:address, :first_name => "UniqueTitleOne") }
87
+
88
+ it "should succeed" do
89
+ visit refinery.addresses_admin_addresses_path
90
+
91
+ click_link "Remove this address forever"
92
+
93
+ page.should have_content("'UniqueTitleOne' was successfully removed.")
94
+ Refinery::Addresses::Address.count.should == 0
95
+ end
96
+ end
97
+
98
+ end
99
+ end
100
+ end
101
+ end