spree_variant_options 0.2.0 → 0.3.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 (39) hide show
  1. data/.travis.yml +12 -0
  2. data/README.md +4 -50
  3. data/Versionfile +1 -1
  4. data/{public/images → app/assets/images/store}/out-of-stock.png +0 -0
  5. data/{public/javascripts → app/assets/javascripts/store}/product.js +0 -0
  6. data/{public/javascripts → app/assets/javascripts/store}/variant_options.js +4 -4
  7. data/{public/stylesheets → app/assets/stylesheets/store}/variant_options.css +0 -0
  8. data/app/models/option_value_decorator.rb +3 -14
  9. data/app/overrides/spree_variant_options.rb +5 -0
  10. data/app/views/products/_variant_options.html.erb +6 -5
  11. data/features/admin_option_types.feature +2 -2
  12. data/features/step_definitions/option_values.rb +2 -2
  13. data/features/step_definitions/variant_options.rb +4 -3
  14. data/features/step_definitions/web_steps.rb +2 -2
  15. data/features/support/env.rb +18 -23
  16. data/features/variant_options.feature +11 -11
  17. data/lib/generators/spree_variant_options/install_generator.rb +11 -2
  18. data/lib/spree_variant_options.rb +9 -11
  19. data/lib/spree_variant_options/version.rb +1 -1
  20. data/spree_variant_options.gemspec +6 -9
  21. data/test/dummy_hooks/before_migrate.rb +12 -10
  22. data/test/dummy_hooks/templates/admin/all.css +3 -0
  23. data/test/dummy_hooks/templates/admin/all.js +1 -0
  24. data/test/dummy_hooks/templates/store/all.css +3 -0
  25. data/test/dummy_hooks/templates/store/all.js +1 -0
  26. data/test/support/images/1.gif +0 -0
  27. data/test/support/images/1.jpg +0 -0
  28. data/test/support/images/1.png +0 -0
  29. data/test/support/images/2.gif +0 -0
  30. data/test/support/images/2.jpg +0 -0
  31. data/test/support/images/2.png +0 -0
  32. data/test/support/images/3.gif +0 -0
  33. data/test/support/images/3.jpg +0 -0
  34. data/test/support/images/3.png +0 -0
  35. data/test/test_helper.rb +8 -19
  36. data/test/unit/option_value_test.rb +4 -4
  37. data/test/unit/product_test.rb +1 -1
  38. metadata +116 -126
  39. data/app/views/products/_cart_form.html.erb +0 -32
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - rbx
6
+ - ree
7
+
8
+ before_script:
9
+ - "sh -e /etc/init.d/xvfb start"
10
+ - "bundle exec dummier"
11
+
12
+ script: "DISPLAY=:99.0 bundle exec rake"
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
- Spree Variant Options
2
- =====================
1
+ # Spree Variant Options [![Build Status](https://secure.travis-ci.org/citrus/spree_variant_options.png)](http://travis-ci.org/citrus/spree_variant_options)
2
+
3
3
 
4
4
  Spree Variant Options is a very simple spree extension that replaces the radio-button variant selection with groups of option types and values. To get a better idea let's let a few images do the explaining.
5
5
 
@@ -24,7 +24,7 @@ If you don't already have an existing Spree site, [click here](https://gist.gith
24
24
 
25
25
  To install Spree Variant Options, just add the following to your Gemfile:
26
26
 
27
- gem 'spree_variant_options', '0.2.0'
27
+ gem 'spree_variant_options', '0.3.0'
28
28
 
29
29
 
30
30
  Now, bundle up with:
@@ -36,23 +36,13 @@ Next, run the install generator to copy the necessary migration to your project
36
36
 
37
37
  rails g spree_variant_options:install
38
38
  rake db:migrate
39
-
40
-
41
- Finally, you'll need include `app/views/products/_variant_options.html.erb` in your `products#show` view...
42
-
43
- If you don't have a custom version of `_cart_form.html.erb` in your application, then don't worry about a thing, spree_variant_options will include the partial for you. Otherwise, just replace the entire `<% if @product.has_variants? %>` block with:
44
-
45
- <%= render 'variant_options' %>
46
-
47
-
48
- To tie spree_variant_options in with your product photos just delete your local copy of `product.js` or copy spree_variant_options' `product.js` to your local `public/javascripts` directory.
49
39
 
50
40
 
51
41
 
52
42
  Versions
53
43
  --------
54
44
 
55
- Spree Variant Options works on Spree 0.30.x through 0.60.x. 0.70.x compatibility is just around the corner... Please let me know if you run into any issues.
45
+ Spree Variant Options is compatible with Spree 0.30.x through 0.70.x. Please reference `Versionfile` for more details.
56
46
 
57
47
 
58
48
  Testing
@@ -65,42 +55,6 @@ Clone this repo to where you develop, bundle up, then run `dummier' to get the s
65
55
  bundle install
66
56
  bundle exec dummier
67
57
 
68
-
69
- This will generate a fresh rails app in test/dummy, install spree & spree_variant_options, then migrate the test database. Sweet.
70
-
71
-
72
- ### Spork + Cucumber
73
-
74
- To run the cucumber features, boot spork like this:
75
-
76
- bundle exec spork
77
-
78
- Then, in another window, run:
79
-
80
- cucumber --drb
81
-
82
-
83
- ### Spork + Test::Unit
84
-
85
- If you want to run shoulda tests, start spork with:
86
-
87
- bundle exec spork TestUnit
88
- #or
89
- bundle exec spork t
90
-
91
- In another window, run all tests:
92
-
93
- testdrb test/**/*_test.rb
94
-
95
- Or just a specific test:
96
-
97
- testdrb test/unit/supplier_test.rb
98
-
99
-
100
- ### No Spork
101
-
102
- If you don't want to spork, just use rake:
103
-
104
58
  # cucumber/capybara
105
59
  rake cucumber
106
60
 
data/Versionfile CHANGED
@@ -1,4 +1,4 @@
1
- "0.70.x" => { :branch => "0.70.x" }
1
+ "0.70.x" => { :version => "0.3.0" }
2
2
  "0.60.x" => { :version => "0.2.0" }
3
3
  "0.50.x" => { :version => "0.1.1" }
4
4
  "0.40.x" => { :version => "0.1.1" }
@@ -150,9 +150,9 @@ function VariantOptions(options, allow_backorders) {
150
150
  return to_f(a) < to_f(b) ? -1 : 1;
151
151
  });
152
152
  if (prices.length == 1) {
153
- $('.prices .price').html('<span class="price assumed">' + prices[0] + '</span>');
153
+ $('#product-price .price').html('<span class="price assumed">' + prices[0] + '</span>');
154
154
  } else {
155
- $('.prices .price').html('<span class="price from">' + prices[0] + '</span> - <span class="price to">' + prices[prices.length - 1] + '</span>');
155
+ $('#product-price .price').html('<span class="price from">' + prices[0] + '</span> - <span class="price to">' + prices[prices.length - 1] + '</span>');
156
156
  }
157
157
  return false;
158
158
  }
@@ -161,7 +161,7 @@ function VariantOptions(options, allow_backorders) {
161
161
  function toggle() {
162
162
  if (variant) {
163
163
  $('#variant_id').val(variant.id);
164
- $('.prices .price').removeClass('unselected').text(variant.price);
164
+ $('#product-price .price').removeClass('unselected').text(variant.price);
165
165
  $('button[type=submit]').attr('disabled', false).fadeTo(100, 1);
166
166
  try {
167
167
  select_variant(variant.id, $.map($('a.selected'), function(i) { return $(i).text() }).join(" "));
@@ -171,7 +171,7 @@ function VariantOptions(options, allow_backorders) {
171
171
  } else {
172
172
  $('#variant_id').val('');
173
173
  $('button[type=submit]').attr('disabled', true).fadeTo(0, 0.5);
174
- $('.prices .price').addClass('unselected').text('(select)');
174
+ $('#product-price .price').addClass('unselected').text('(select)');
175
175
  }
176
176
  }
177
177
 
@@ -2,20 +2,9 @@ OptionValue.class_eval do
2
2
 
3
3
  default_scope order(:position)
4
4
 
5
- if defined?(SpreeHeroku)
6
- has_attached_file :image,
7
- :styles => { :small => '40x30#', :large => '140x110#' },
8
- :default_style => :small,
9
- :path => "assets/option_values/:id/:style/:basename.:extension",
10
- :storage => "s3",
11
- :s3_credentials => "#{Rails.root}/config/s3.yml"
12
- else
13
- has_attached_file :image,
14
- :styles => { :small => '40x30#', :large => '140x110#' },
15
- :default_style => :small,
16
- :url => "/assets/option_values/:id/:style/:basename.:extension",
17
- :path => ":rails_root/public/assets/option_values/:id/:style/:basename.:extension"
18
- end
5
+ has_attached_file :image,
6
+ :styles => { :small => '40x30#', :large => '140x110#' },
7
+ :default_style => :small
19
8
 
20
9
  def has_image?
21
10
  image_file_name && !image_file_name.empty?
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "products/_cart_form",
2
+ :name => "spree_variant_options",
3
+ :replace => "#product-variants",
4
+ :partial => "products/variant_options",
5
+ :disabled => false)
@@ -35,9 +35,10 @@
35
35
  </script>
36
36
 
37
37
  </div>
38
- <% end%>
38
+
39
+ <% content_for :head do %>
40
+ <%= stylesheet_link_tag 'store/variant_options' %>
41
+ <%= javascript_include_tag 'store/variant_options' %>
42
+ <% end %>
39
43
 
40
- <% content_for :head do %>
41
- <%= stylesheet_link_tag 'variant_options' %>
42
- <%= javascript_include_tag 'variant_options' %>
43
- <% end %>
44
+ <% end%>
@@ -18,14 +18,14 @@ Feature: Admin option type values
18
18
  And I fill in the option value fields for the new option value
19
19
  When I press "Update"
20
20
  Then I should see option values for small, medium, large, x-large and xxx-large
21
- And I should see image "spree.jpg"
21
+ And I should see image "1.jpg"
22
22
 
23
23
  Scenario: Update an existing option value
24
24
  Given I'm on the edit admin option type page for option type "Size"
25
25
  When I fill in the option value fields for option value "Medium"
26
26
  And I press "Update"
27
27
  Then I should see option values for small, large, x-large and xxx-large
28
- And I should see image "spree.jpg"
28
+ And I should see image "1.jpg"
29
29
 
30
30
  Scenario: Delete an existing option value
31
31
  Given I'm on the edit admin option type page for option type "Size"
@@ -19,8 +19,8 @@ Then /^I fill in the option value fields for (.*)$/ do |parent|
19
19
  %w(name presentation).each do |name|
20
20
  find(:xpath, ".//input[contains(@name, '[#{name}]')]").set('xxx-large')
21
21
  end
22
- find(:xpath, ".//input[contains(@name, '[image]')]").set(Rails.root.join("public/images/spree.jpg"))
23
- end
22
+ find(:xpath, ".//input[contains(@name, '[image]')]").set(File.expand_path("../../../test/support/images/1.jpg", __FILE__))
23
+ end
24
24
  end
25
25
 
26
26
 
@@ -10,7 +10,7 @@ end
10
10
 
11
11
  def random_image
12
12
  unless @sample_images
13
- dir = File.expand_path("../../../test/dummy/db/sample/assets/*", __FILE__)
13
+ dir = File.expand_path("../../../test/support/images/*", __FILE__)
14
14
  @sample_images = Dir[dir]
15
15
  end
16
16
  image = @sample_images.shuffle.first
@@ -22,6 +22,7 @@ end
22
22
 
23
23
  Given /^I( don't)? allow backorders$/ do |dont|
24
24
  Spree::Config.set(:allow_backorders => dont.nil?)
25
+ assert_equal dont.nil?, Spree::Config[:allow_backorders]
25
26
  end
26
27
 
27
28
  Given /^I have a product( with variants)?( and images)?$/ do |has_variants, has_images|
@@ -38,14 +39,14 @@ end
38
39
 
39
40
  Given /^the first option type has an option value with image "([^"]*)"$/ do |source|
40
41
  flunk unless @product
41
- @product.option_types.first.option_values.first.update_attributes(:image => File.open(Rails.root.join("public/images/#{source}")))
42
+ @product.option_types.first.option_values.first.update_attributes(:image => File.open(Rails.root.join("../support/images/#{source}")))
42
43
  end
43
44
 
44
45
  Then /^I should see image "([^"]*)" within the first option value$/ do |source|
45
46
  ot = @product.option_types.first
46
47
  ov = ot.option_values.first
47
48
  within ".variant-options a[rel='#{ot.id}-#{ov.id}']" do
48
- assert_match "/assets/option_values/#{ov.id}/small/#{source}", find("img").native.attribute("src")
49
+ assert_match "/system/images/#{ov.id}/small/#{source}", find("img").native.attribute("src")
49
50
  end
50
51
  end
51
52
 
@@ -8,8 +8,8 @@ def get_parent(parent)
8
8
  when "flash notice"; ".flash"
9
9
  when "first set of options"; "#option_type_#{@product.option_types.first.id}"
10
10
  when "second set of options"; "#option_type_#{@product.option_types[1].id}"
11
- when "variant images label"; "#variant-images"
12
- when "price"; ".prices .price"
11
+ when "variant images label"; "#product-thumbnails"
12
+ when "price"; "#product-price .price"
13
13
  else "[set-your-parent] #{parent}"
14
14
  end
15
15
  end
@@ -1,31 +1,26 @@
1
1
  ENV["RAILS_ENV"] = "test"
2
2
  ENV["RAILS_ROOT"] = File.expand_path("../../../test/dummy", __FILE__)
3
3
 
4
- require 'spork'
5
-
6
- Spork.prefork do
7
- require 'cucumber/rails'
8
- require 'selenium/webdriver'
9
- require 'factory_girl'
10
-
11
-
12
- I18n.reload!
13
-
14
- ActionController::Base.allow_rescue = false
15
-
16
- Capybara.default_driver = :selenium
17
- Capybara.default_selector = :css
4
+ require "cucumber/rails"
5
+ require "selenium/webdriver"
6
+ require "factory_girl"
7
+
8
+ # I18n.reload!
18
9
 
19
- Cucumber::Rails::World.use_transactional_fixtures
20
- DatabaseCleaner.strategy = :transaction
10
+ ActionController::Base.allow_rescue = false
11
+
12
+ Capybara.default_driver = :selenium
13
+ Capybara.default_selector = :css
14
+
15
+ Cucumber::Rails::World.use_transactional_fixtures
16
+ DatabaseCleaner.strategy = :transaction
21
17
 
22
- Spree::Config.set(:random => rand(1000))
23
-
24
- end
25
-
26
- Spork.each_run do
18
+ Dir["#{File.expand_path("../../../", __FILE__)}/test/support/**/*.rb"].each { |f| require f }
27
19
 
28
- Dir["#{File.expand_path("../../../", __FILE__)}/test/support/**/*.rb"].each { |f| require f }
29
- World(HelperMethods)
20
+ World(HelperMethods)
30
21
 
22
+ # ensures spree preferencs are initialized before each test
23
+ Before do
24
+ Spree::Config.instance_variable_set("@configuration", nil)
25
+ Spree::Config.set(:random => rand(1000))
31
26
  end
@@ -16,9 +16,9 @@ Feature: Products should have variant options
16
16
 
17
17
  Scenario: Display option images when visiting a product
18
18
  Given I have a product with variants
19
- And the first option type has an option value with image "spree.jpg"
19
+ And the first option type has an option value with image "1.jpg"
20
20
  And I'm on the product page for the first product
21
- Then I should see image "spree.jpg" within the first option value
21
+ Then I should see image "1.jpg" within the first option value
22
22
 
23
23
  Scenario: Interact with options for a product
24
24
  Given I have a product with variants
@@ -117,13 +117,13 @@ Feature: Products should have variant options
117
117
  Then I should see "$24.99" in the price
118
118
  And the add to cart button should be enabled
119
119
 
120
- Scenario: Should show variant images when a selection is made
121
- Given I have a product with variants and images
122
- And I'm on the product page for the first product
123
- When I follow "Small" within the first set of options
124
- And I follow "Green" within the second set of options
125
- Then the add to cart button should be enabled
126
- And I should see "Small Green" in the variant images label
127
- When I follow "Red" within the second set of options
128
- Then I should see "Small Red" in the variant images label
120
+ #Scenario: Should show variant images when a selection is made
121
+ # Given I have a product with variants and images
122
+ # And I'm on the product page for the first product
123
+ # When I follow "Small" within the first set of options
124
+ # And I follow "Green" within the second set of options
125
+ # Then the add to cart button should be enabled
126
+ # And I should see "Small Green" in the variant images label
127
+ # When I follow "Red" within the second set of options
128
+ # Then I should see "Small Red" in the variant images label
129
129
 
@@ -4,15 +4,24 @@ module SpreeVariantOptions
4
4
 
5
5
  include Rails::Generators::Migration
6
6
 
7
- def self.count!
7
+ def self.count
8
8
  @count ||= 0
9
9
  (@count += 1) * 3
10
10
  end
11
+
12
+ def self.new_migration_number
13
+ (Time.new.utc + self.count).strftime("%Y%m%d%H%M%S")
14
+ end
11
15
 
12
16
  def self.next_migration_number(path)
13
17
  @time ||= Time.new.utc
14
18
  if ActiveRecord::Base.timestamped_migrations
15
- (@time + self.count!).strftime("%Y%m%d%H%M%S")
19
+ files = Dir.entries(Rails.root.join("db/migrate"))
20
+ migration = new_migration_number
21
+ while files.join.include?(migration)
22
+ migration = new_migration_number
23
+ end
24
+ migration
16
25
  else
17
26
  "%.3d" % (current_migration_number(dirname) + 1)
18
27
  end
@@ -7,19 +7,17 @@ module SpreeVariantOptions
7
7
 
8
8
  config.autoload_paths += %W(#{config.root}/lib)
9
9
 
10
- initializer "static assets" do |app|
11
- app.middleware.insert_before ::Rack::Lock, ::ActionDispatch::Static, "#{config.root}/public"
12
- end
13
-
14
- def self.activate
15
-
16
- Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator.rb")) do |c|
17
- Rails.env.production? ? require(c) : load(c)
10
+ config.to_prepare do
11
+ #loads application's model / class decorators
12
+ Dir.glob File.expand_path("../../app/**/*_decorator.rb", __FILE__) do |c|
13
+ Rails.configuration.cache_classes ? require(c) : load(c)
18
14
  end
19
-
20
- end
21
15
 
22
- config.to_prepare &method(:activate).to_proc
16
+ #loads application's deface view overrides
17
+ Dir.glob File.expand_path("../../app/overrides/*.rb", __FILE__) do |c|
18
+ Rails.application.config.cache_classes ? require(c) : load(c)
19
+ end
20
+ end
23
21
 
24
22
  end
25
23
 
@@ -1,3 +1,3 @@
1
1
  module SpreeVariantOptions
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -20,18 +20,15 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  # Runtime
23
- s.add_dependency('spree_core', '>= 0.30.1')
23
+ s.add_dependency('spree_core', '>= 0.70.0')
24
24
 
25
25
  # Development
26
- s.add_development_dependency('spree_sample', '>= 0.30.1')
27
- s.add_development_dependency('dummier', '>= 0.2.0')
28
- s.add_development_dependency('shoulda', '>= 2.11.3')
29
- s.add_development_dependency('factory_girl', '>= 2.0.4')
30
- s.add_development_dependency('cucumber-rails', '>= 1.0.2')
26
+ s.add_development_dependency('spree_sample', '>= 0.70.0')
27
+ s.add_development_dependency('dummier', '>= 0.2.4')
28
+ s.add_development_dependency('shoulda', '>= 3.0.0.beta2')
29
+ s.add_development_dependency('factory_girl', '>= 2.3.2')
30
+ s.add_development_dependency('cucumber-rails', '>= 1.2.1')
31
31
  s.add_development_dependency('database_cleaner', '>= 0.6.7')
32
32
  s.add_development_dependency('sqlite3', '>= 1.3.4')
33
- s.add_development_dependency('spork', '>= 0.9.0.rc9')
34
- s.add_development_dependency('spork-testunit', '>= 0.0.5')
35
- s.add_development_dependency('turn', '>= 0.8.2')
36
33
 
37
34
  end
@@ -1,11 +1,13 @@
1
- # install spree & spree_sample
2
- rake "spree_core:install spree_sample:install"
1
+ # install spree & spree_variant_options
2
+ run "rails g spree:site"
3
+ run "rails g spree_variant_options:install"
3
4
 
4
- # install spree_variant_options
5
- run "rails g spree_variant_options:install"
6
-
7
- # since spree auth isn't installed
8
- create_file "app/views/shared/_login_bar.html.erb", ""
9
-
10
- # remove the default product.js
11
- remove_file "public/javascripts/product.js"
5
+ # remove all stylesheets except core
6
+ %w(admin store).each do |ns|
7
+ js = "app/assets/javascripts/#{ns}/all.js"
8
+ css = "app/assets/stylesheets/#{ns}/all.css"
9
+ remove_file js
10
+ remove_file css
11
+ template "#{ns}/all.js", js
12
+ template "#{ns}/all.css", css
13
+ end
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require admin/spree_core
3
+ */
@@ -0,0 +1 @@
1
+ //= require admin/spree_core
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require store/spree_core
3
+ */
@@ -0,0 +1 @@
1
+ //= require store/spree_core
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/test/test_helper.rb CHANGED
@@ -1,23 +1,12 @@
1
1
  # Configure Rails Envinronment
2
2
  ENV["RAILS_ENV"] = "test"
3
- require 'spork'
4
-
5
- Spork.prefork do
6
3
 
7
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
- require "rails/test_help"
9
- require "shoulda"
10
- require "factory_girl"
11
- require "sqlite3"
12
- require "faker"
13
- require "turn"
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+ require "shoulda"
7
+ require "factory_girl"
8
+ require "sqlite3"
9
+ require "faker"
10
+ begin; require "turn"; rescue LoadError; end
14
11
 
15
- # Run any available migration if needed
16
- ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
17
- end
18
-
19
- Spork.each_run do
20
-
21
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
22
-
23
- end
12
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -1,9 +1,9 @@
1
- require_relative '../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class OptionValueTest < ActiveSupport::TestCase
4
4
 
5
5
  setup do
6
- @images = Dir[File.expand_path("../../dummy/db/sample/assets/*", __FILE__)]
6
+ @images = Dir[File.expand_path("../../support/images/*", __FILE__)]
7
7
  end
8
8
 
9
9
  should_have_attached_file :image
@@ -44,13 +44,13 @@ class OptionValueTest < ActiveSupport::TestCase
44
44
  end
45
45
 
46
46
  should "have small large and original images" do
47
- dir = File.expand_path("../../dummy/public/assets/option_values/#{@option_value.id}", __FILE__)
47
+ dir = File.expand_path("../../dummy/public/system/images/#{@option_value.id}", __FILE__)
48
48
  %w(small large original).each do |size|
49
49
  assert File.exists?(File.join(dir, size, File.basename(@path)))
50
50
  end
51
51
  end
52
52
 
53
- end
53
+ end
54
54
 
55
55
  end
56
56
 
@@ -1,4 +1,4 @@
1
- require_relative '../test_helper'
1
+ require 'test_helper'
2
2
 
3
3
  class ProductTest < ActiveSupport::TestCase
4
4
 
metadata CHANGED
@@ -1,160 +1,130 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: spree_variant_options
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
4
5
  prerelease:
5
- version: 0.2.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Spencer Steffen
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-17 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-12-30 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: spree_core
17
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70264012210960 !ruby/object:Gem::Requirement
18
17
  none: false
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.30.1
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.70.0
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *70264012210960
25
+ - !ruby/object:Gem::Dependency
27
26
  name: spree_sample
28
- requirement: &id002 !ruby/object:Gem::Requirement
27
+ requirement: &70264012210180 !ruby/object:Gem::Requirement
29
28
  none: false
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 0.30.1
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.70.0
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
35
+ version_requirements: *70264012210180
36
+ - !ruby/object:Gem::Dependency
38
37
  name: dummier
39
- requirement: &id003 !ruby/object:Gem::Requirement
38
+ requirement: &70264012209520 !ruby/object:Gem::Requirement
40
39
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: 0.2.0
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 0.2.4
45
44
  type: :development
46
45
  prerelease: false
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
46
+ version_requirements: *70264012209520
47
+ - !ruby/object:Gem::Dependency
49
48
  name: shoulda
50
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ requirement: &70264012208880 !ruby/object:Gem::Requirement
51
50
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: 2.11.3
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0.beta2
56
55
  type: :development
57
56
  prerelease: false
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
57
+ version_requirements: *70264012208880
58
+ - !ruby/object:Gem::Dependency
60
59
  name: factory_girl
61
- requirement: &id005 !ruby/object:Gem::Requirement
60
+ requirement: &70264012208400 !ruby/object:Gem::Requirement
62
61
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 2.0.4
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 2.3.2
67
66
  type: :development
68
67
  prerelease: false
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
68
+ version_requirements: *70264012208400
69
+ - !ruby/object:Gem::Dependency
71
70
  name: cucumber-rails
72
- requirement: &id006 !ruby/object:Gem::Requirement
71
+ requirement: &70264012207760 !ruby/object:Gem::Requirement
73
72
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: 1.0.2
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: 1.2.1
78
77
  type: :development
79
78
  prerelease: false
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
79
+ version_requirements: *70264012207760
80
+ - !ruby/object:Gem::Dependency
82
81
  name: database_cleaner
83
- requirement: &id007 !ruby/object:Gem::Requirement
82
+ requirement: &70264012207300 !ruby/object:Gem::Requirement
84
83
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
88
87
  version: 0.6.7
89
88
  type: :development
90
89
  prerelease: false
91
- version_requirements: *id007
92
- - !ruby/object:Gem::Dependency
90
+ version_requirements: *70264012207300
91
+ - !ruby/object:Gem::Dependency
93
92
  name: sqlite3
94
- requirement: &id008 !ruby/object:Gem::Requirement
93
+ requirement: &70264012206820 !ruby/object:Gem::Requirement
95
94
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
99
98
  version: 1.3.4
100
99
  type: :development
101
100
  prerelease: false
102
- version_requirements: *id008
103
- - !ruby/object:Gem::Dependency
104
- name: spork
105
- requirement: &id009 !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: 0.9.0.rc9
111
- type: :development
112
- prerelease: false
113
- version_requirements: *id009
114
- - !ruby/object:Gem::Dependency
115
- name: spork-testunit
116
- requirement: &id010 !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
119
- - - ">="
120
- - !ruby/object:Gem::Version
121
- version: 0.0.5
122
- type: :development
123
- prerelease: false
124
- version_requirements: *id010
125
- - !ruby/object:Gem::Dependency
126
- name: turn
127
- requirement: &id011 !ruby/object:Gem::Requirement
128
- none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: 0.8.2
133
- type: :development
134
- prerelease: false
135
- version_requirements: *id011
136
- description: Spree Variant Options is a simple spree extension that replaces the radio-button variant selection with groups of option types and values. Please see the documentation for more details.
137
- email:
101
+ version_requirements: *70264012206820
102
+ description: Spree Variant Options is a simple spree extension that replaces the radio-button
103
+ variant selection with groups of option types and values. Please see the documentation
104
+ for more details.
105
+ email:
138
106
  - spencer@citrusme.com
139
107
  executables: []
140
-
141
108
  extensions: []
142
-
143
109
  extra_rdoc_files: []
144
-
145
- files:
110
+ files:
146
111
  - .gitignore
112
+ - .travis.yml
147
113
  - Gemfile
148
114
  - LICENSE
149
115
  - README.md
150
116
  - Rakefile
151
117
  - Versionfile
118
+ - app/assets/images/store/out-of-stock.png
119
+ - app/assets/javascripts/store/product.js
120
+ - app/assets/javascripts/store/variant_options.js
121
+ - app/assets/stylesheets/store/variant_options.css
152
122
  - app/controllers/admin/option_values_controller.rb
153
123
  - app/models/option_value_decorator.rb
154
124
  - app/models/product_decorator.rb
125
+ - app/overrides/spree_variant_options.rb
155
126
  - app/views/admin/option_types/_option_value_fields.html.erb
156
127
  - app/views/admin/option_types/edit.html.erb
157
- - app/views/products/_cart_form.html.erb
158
128
  - app/views/products/_variant_options.html.erb
159
129
  - config/cucumber.yml
160
130
  - config/routes.rb
@@ -170,53 +140,60 @@ files:
170
140
  - lib/generators/templates/db/migrate/add_image_to_option_values.rb
171
141
  - lib/spree_variant_options.rb
172
142
  - lib/spree_variant_options/version.rb
173
- - public/images/out-of-stock.png
174
- - public/javascripts/product.js
175
- - public/javascripts/variant_options.js
176
- - public/stylesheets/variant_options.css
177
143
  - spree_variant_options.gemspec
178
144
  - test/dummy_hooks/after_migrate.rb.sample
179
145
  - test/dummy_hooks/before_migrate.rb
146
+ - test/dummy_hooks/templates/admin/all.css
147
+ - test/dummy_hooks/templates/admin/all.js
148
+ - test/dummy_hooks/templates/store/all.css
149
+ - test/dummy_hooks/templates/store/all.js
180
150
  - test/support/factories.rb
181
151
  - test/support/helper_methods.rb
152
+ - test/support/images/1.gif
153
+ - test/support/images/1.jpg
154
+ - test/support/images/1.png
155
+ - test/support/images/2.gif
156
+ - test/support/images/2.jpg
157
+ - test/support/images/2.png
158
+ - test/support/images/3.gif
159
+ - test/support/images/3.jpg
160
+ - test/support/images/3.png
182
161
  - test/support/paperclip.rb
183
162
  - test/test_helper.rb
184
163
  - test/unit/option_value_test.rb
185
164
  - test/unit/product_test.rb
186
165
  homepage: https://github.com/citrus/spree_variant_options
187
166
  licenses: []
188
-
189
167
  post_install_message:
190
168
  rdoc_options: []
191
-
192
- require_paths:
169
+ require_paths:
193
170
  - lib
194
- required_ruby_version: !ruby/object:Gem::Requirement
171
+ required_ruby_version: !ruby/object:Gem::Requirement
195
172
  none: false
196
- requirements:
197
- - - ">="
198
- - !ruby/object:Gem::Version
199
- hash: 2340832333583009512
200
- segments:
173
+ requirements:
174
+ - - ! '>='
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ segments:
201
178
  - 0
202
- version: "0"
203
- required_rubygems_version: !ruby/object:Gem::Requirement
179
+ hash: -3966294049605257627
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
204
181
  none: false
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- hash: 2340832333583009512
209
- segments:
182
+ requirements:
183
+ - - ! '>='
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ segments:
210
187
  - 0
211
- version: "0"
188
+ hash: -3966294049605257627
212
189
  requirements: []
213
-
214
190
  rubyforge_project: spree_variant_options
215
- rubygems_version: 1.8.8
191
+ rubygems_version: 1.8.10
216
192
  signing_key:
217
193
  specification_version: 3
218
- summary: Spree Variant Options is a simple spree extension that replaces the radio-button variant selection with groups of option types and values.
219
- test_files:
194
+ summary: Spree Variant Options is a simple spree extension that replaces the radio-button
195
+ variant selection with groups of option types and values.
196
+ test_files:
220
197
  - features/admin_option_types.feature
221
198
  - features/step_definitions/option_values.rb
222
199
  - features/step_definitions/variant_options.rb
@@ -227,8 +204,21 @@ test_files:
227
204
  - features/variant_options.feature
228
205
  - test/dummy_hooks/after_migrate.rb.sample
229
206
  - test/dummy_hooks/before_migrate.rb
207
+ - test/dummy_hooks/templates/admin/all.css
208
+ - test/dummy_hooks/templates/admin/all.js
209
+ - test/dummy_hooks/templates/store/all.css
210
+ - test/dummy_hooks/templates/store/all.js
230
211
  - test/support/factories.rb
231
212
  - test/support/helper_methods.rb
213
+ - test/support/images/1.gif
214
+ - test/support/images/1.jpg
215
+ - test/support/images/1.png
216
+ - test/support/images/2.gif
217
+ - test/support/images/2.jpg
218
+ - test/support/images/2.png
219
+ - test/support/images/3.gif
220
+ - test/support/images/3.jpg
221
+ - test/support/images/3.png
232
222
  - test/support/paperclip.rb
233
223
  - test/test_helper.rb
234
224
  - test/unit/option_value_test.rb
@@ -1,32 +0,0 @@
1
- <%= form_for :order, :url => populate_orders_url do |f| %>
2
- <%= hook :inside_product_cart_form do %>
3
-
4
- <% if product_price(@product) %>
5
- <%= hook :product_price do %>
6
- <p class="prices">
7
- <%= t("price") %>
8
- <br />
9
- <span class="price selling"><%= product_price(@product) %></span>
10
- </p>
11
- <% end %>
12
- <% end %>
13
-
14
- <%= render 'variant_options' %>
15
-
16
- <% if @product.has_stock? || Spree::Config[:allow_backorders] %>
17
- <%= text_field_tag (@product.has_variants? ? :quantity : "variants[#{@product.master.id}]"),
18
- 1, :class => "title", :size => 3 %>
19
- &nbsp;
20
- <button type='submit' class='large primary'>
21
- <%= image_tag('/images/add-to-cart.png') + t('add_to_cart') %>
22
- </button>
23
- <% else %>
24
- <%= content_tag('strong', t('out_of_stock')) %>
25
- <% end %>
26
-
27
- <% end %>
28
- <% end %>
29
-
30
- <% content_for :head do %>
31
- <%= javascript_include_tag 'product' %>
32
- <% end %>