spree_delivery_options 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +6 -0
  5. data/LICENSE +26 -0
  6. data/README.md +53 -0
  7. data/Rakefile +15 -0
  8. data/Versionfile +11 -0
  9. data/app/assets/stylesheets/store/delivery_checkout.scss +11 -0
  10. data/app/assets/stylesheets/store/spree_delivery_options.css +4 -0
  11. data/app/models/spree/order_decorator.rb +38 -0
  12. data/app/overrides/admin_order_information.rb +5 -0
  13. data/app/overrides/admin_orders_delivery_date_column.rb +10 -0
  14. data/app/overrides/admin_orders_delivery_date_filter.rb +5 -0
  15. data/app/overrides/delivery_date.rb +5 -0
  16. data/app/overrides/delivery_date_details.rb +5 -0
  17. data/app/views/spree/admin/orders/_delivery_date_cell.html.erb +10 -0
  18. data/app/views/spree/admin/orders/_delivery_date_filter.html.erb +12 -0
  19. data/app/views/spree/admin/orders/_delivery_date_header.html.erb +2 -0
  20. data/app/views/spree/admin/shared/_admin_order_information_delivery_date.html.erb +12 -0
  21. data/app/views/spree/checkout/_delivery_date.html.erb +7 -0
  22. data/app/views/spree/orders/_order_delivery_date_details.html.erb +8 -0
  23. data/config/locales/en.yml +4 -0
  24. data/config/routes.rb +3 -0
  25. data/db/migrate/20130415025010_add_delivery_date_to_orders.rb +9 -0
  26. data/db/migrate/20131206053316_add_delivery_time_to_orders.rb +5 -0
  27. data/lib/generators/spree_delivery_options/install/install_generator.rb +26 -0
  28. data/lib/spree_delivery_options/configuration.rb +6 -0
  29. data/lib/spree_delivery_options/engine.rb +28 -0
  30. data/lib/spree_delivery_options.rb +2 -0
  31. data/script/rails +7 -0
  32. data/spec/models/order_spec.rb +85 -0
  33. data/spec/spec_helper.rb +80 -0
  34. data/spree_delivery_options.gemspec +31 -0
  35. metadata +246 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 90430005aee2f9194697cdebfdb46ccd1015f8c5
4
+ data.tar.gz: 67bc5085c228035dea01d91680eb9ebf44775ace
5
+ SHA512:
6
+ metadata.gz: 9f5d66a7bec717d37b60e798b10c0c2597d343741aea9fa9946d4e751a9551922c9444b178a088c1401ae3ec0bb2b09531b9789b34eaaa8fd726b9de19cb43de
7
+ data.tar.gz: e5058ee418577d59dff2ccc5e9361edbf32a89a242a124dc90491b6b817b0798b098bb3710c03da74ceb7221c43e6a95aa749d3b02d5b80153161d29f2e5769d
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ \#*
2
+ *~
3
+ .#*
4
+ .DS_Store
5
+ .idea
6
+ .project
7
+ .sass-cache
8
+ coverage
9
+ Gemfile.lock
10
+ tmp
11
+ nbproject
12
+ pkg
13
+ *.swp
14
+ spec/dummy
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Provides basic authentication functionality for testing parts of your engine
4
+ # gem 'spree_auth_devise', :git => "git://github.com/spree/spree_auth_devise"
5
+
6
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2013 [name of plugin creator]
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Spree nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ Spree Delivery Options
2
+ =================
3
+
4
+ This gem is a fork from [spree_delivery_date](from 'https://github.com/sgringwe/spree_delivery_date'), and it has been updated to work with spree_core 2.1.3, as well as other changes.
5
+
6
+ Requires user to enter a delivery date and delivery time during checkout (delivery section).
7
+
8
+ Features
9
+ -------
10
+
11
+ * Delivery date validation
12
+ * Creates a cut off time for deliveries done the day after
13
+ * If order is being done before cut off time, delivery date can be set to the day after
14
+ * If order is after cut off time, delivery date can only be set to the day after + 1
15
+
16
+ * Shows delivery date and time during checkout confirmation.
17
+ * Shows delivery date when viewing or editing order as admin.
18
+ * Allows admin to filter orders by delivery date and time (date range).
19
+ * Allows admin to sort orders by delivery date and time.
20
+ * Adds delivery date column to orders index page table.
21
+
22
+
23
+ Installation
24
+ ------------
25
+
26
+ Add the gem to your Gemfile
27
+
28
+ $ gem 'spree_delivery_options'
29
+
30
+ bundle with
31
+
32
+ $ bundle update
33
+
34
+ and run
35
+
36
+ $ rails g spree_delivery_options:install
37
+
38
+ to install and (be asken to) run the migrations. This migration simply adds the delivery_date field to Spree::Order.
39
+
40
+ Configuration
41
+ -------------
42
+
43
+ Both the delivery cut off hour and the delivery time options can be configured in your application.rb file
44
+
45
+ config.after_initialize do
46
+ delivery_time_options = {
47
+ pre_dawn: "Before 6am",
48
+ early_morning: "Between 6am-8am"
49
+ }.to_json
50
+ SpreeDeliveryOptions::Config.delivery_time_options = delivery_time_options
51
+ SpreeDeliveryOptions::Config.delivery_cut_off_hour = 12
52
+ end
53
+
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ require 'spree/testing_support/extension_rake'
6
+
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task :default => [:spec]
10
+
11
+ desc 'Generates a dummy app for testing'
12
+ task :test_app do
13
+ ENV['LIB_NAME'] = 'spree_delivery_options'
14
+ Rake::Task['common:test_app'].invoke
15
+ end
data/Versionfile ADDED
@@ -0,0 +1,11 @@
1
+ # This file is used to designate compatibilty with different versions of Spree
2
+ # Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
3
+
4
+ # Examples
5
+ #
6
+ # '1.2.x' => { :branch => 'master' }
7
+ # '1.1.x' => { :branch => '1-1-stable' }
8
+ # '1.0.x' => { :branch => '1-0-stable' }
9
+ # '0.70.x' => { :branch => '0-70-stable' }
10
+ # '0.40.x' => { :tag => 'v1.0.0', :version => '1.0.0' }
11
+
@@ -0,0 +1,11 @@
1
+ @import 'store/variables';
2
+
3
+ #shipping_method {
4
+ .stock-delivery-date-title {
5
+ background-color: lighten($body_text_color, 70);
6
+ text-align: center;
7
+ text-transform: uppercase;
8
+ font-weight: normal;
9
+ font-size :11px;
10
+ }
11
+ }
@@ -0,0 +1,4 @@
1
+ /*
2
+ *= require store/spree_frontend
3
+ *= require store/delivery_checkout
4
+ */
@@ -0,0 +1,38 @@
1
+ Spree::Order.class_eval do
2
+ require 'date'
3
+ require 'spree/order/checkout'
4
+
5
+ def valid_delivery_date?
6
+ self.errors[:delivery_date] << 'cannot be blank' unless self.delivery_date
7
+
8
+ if self.delivery_date
9
+ self.errors[:delivery_date] << 'cannot be today or in the past' if self.delivery_date <= Date.today
10
+
11
+ cutoff_time = Time.now.change(hour: SpreeDeliveryOptions::Config.delivery_cut_off_hour)
12
+ if self.delivery_date == Date.tomorrow && Time.now > cutoff_time
13
+ self.errors[:delivery_date] << "cannot be tomorrow if the order is created after #{SpreeDeliveryOptions::Config.delivery_cut_off_hour}"
14
+ end
15
+ end
16
+
17
+ self.errors[:delivery_date].empty? ? true : false
18
+ end
19
+
20
+ def valid_delivery_time?
21
+ self.errors[:delivery_time] << 'cannot be blank' unless self.delivery_time
22
+
23
+ if self.delivery_time
24
+ delivery_time_options = JSON.parse(SpreeDeliveryOptions::Config.delivery_time_options)
25
+ self.errors[:delivery_time] << 'is invalid' unless delivery_time_options.values.include?(self.delivery_time)
26
+ end
27
+
28
+ self.errors[:delivery_time].empty? ? true : false
29
+ end
30
+
31
+ end
32
+
33
+ Spree::PermittedAttributes.checkout_attributes << :delivery_date
34
+ Spree::PermittedAttributes.checkout_attributes << :delivery_time
35
+
36
+ Spree::Order.state_machine.before_transition :to => :payment, :do => :valid_delivery_date?
37
+ Spree::Order.state_machine.before_transition :to => :payment, :do => :valid_delivery_time?
38
+
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "spree/admin/shared/_order_tabs",
2
+ :name => "add_delivery_date_to_admin_order_information",
3
+ :insert_after => "#order_total",
4
+ :partial => "spree/admin/shared/admin_order_information_delivery_date",
5
+ :disabled => false)
@@ -0,0 +1,10 @@
1
+ Deface::Override.new(:virtual_path => "spree/admin/orders/index",
2
+ :name => "add_delivery_date_table_header",
3
+ :insert_top => "[data-hook='admin_orders_index_headers']",
4
+ :partial => "spree/admin/orders/delivery_date_header",
5
+ :disabled => false)
6
+ Deface::Override.new(:virtual_path => "spree/admin/orders/index",
7
+ :name => "add_delivery_date_table_row_cell",
8
+ :insert_top => "[data-hook='admin_orders_index_rows']",
9
+ :partial => "spree/admin/orders/delivery_date_cell",
10
+ :disabled => false)
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "spree/admin/orders/index",
2
+ :name => "add_delivery_date_filter_to_orders_index",
3
+ :insert_after => ".date-range-filter",
4
+ :partial => "spree/admin/orders/delivery_date_filter",
5
+ :disabled => false)
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "spree/checkout/_delivery",
2
+ :name => "add_delivery_date_to_delivery",
3
+ :insert_after => "[data-hook='shipping_method_inner']",
4
+ :partial => "spree/checkout/delivery_date",
5
+ :disabled => false)
@@ -0,0 +1,5 @@
1
+ Deface::Override.new(:virtual_path => "spree/shared/_order_details",
2
+ :name => "add_delivery_date_details_to_order",
3
+ :insert_before => "[data-hook='order_details']",
4
+ :partial => "spree/orders/order_delivery_date_details",
5
+ :disabled => false)
@@ -0,0 +1,10 @@
1
+ <% if order.delivery_date != nil %>
2
+ <td class="align-center"><%= order.delivery_date %></td>
3
+ <% else %>
4
+ <td class="align-center">Unknown</td>
5
+ <% end %>
6
+ <% if order.delivery_time != nil %>
7
+ <td class="align-center"><%= order.delivery_time %></td>
8
+ <% else %>
9
+ <td class="align-center">Unknown</td>
10
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <div class="date-range-filter field">
2
+ <%= label_tag nil, Spree.t(:delivery_date) %>
3
+ <div class="date-range-fields">
4
+ <%= f.text_field :delivery_date_gt, :class => 'datepicker datepicker-from', :value => params[:q][:delivery_date_gt], :placeholder => Spree.t(:start) %>
5
+
6
+ <span class="range-divider">
7
+ <i class="icon-arrow-right"></i>
8
+ </span>
9
+
10
+ <%= f.text_field :delivery_date_lt, :class => 'datepicker datepicker-to', :value => params[:q][:delivery_date_lt], :placeholder => Spree.t(:stop) %>
11
+ </div>
12
+ </div>
@@ -0,0 +1,2 @@
1
+ <th><%= sort_link @search, :delivery_date, t(:delivery_date, :scope => 'activerecord.attributes.spree/order') %></th>
2
+ <th><%= sort_link @search, :delivery_time, t(:delivery_time, :scope => 'activerecord.attributes.spree/order') %></th>
@@ -0,0 +1,12 @@
1
+ <dt><%= t(:delivery_date) %>:</dt>
2
+ <% if @order.delivery_date != nil %>
3
+ <dd id='delivery_date'><%= @order.delivery_date %></dd>
4
+ <% else %>
5
+ <dd id='delivery_date'>Unknown</dd>
6
+ <% end %>
7
+ <dt><%= t(:delivery_time) %>:</dt>
8
+ <% if @order.delivery_time != nil %>
9
+ <dd id='delivery_time'><%= @order.delivery_time %></dd>
10
+ <% else %>
11
+ <dd id='delivery_time'>Unknown</dd>
12
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <h5 class="stock-delivery-date-title">Delivery Date</h5>
2
+ <p id="delivery_date">
3
+ <%= form.label :delivery_date, "Delivery Date" %><br />
4
+ <%= form.date_select :delivery_date, default: Date.yesterday %><br />
5
+ <%= form.label :delivery_time, "Delivery Time" %><br />
6
+ <%= form.select :delivery_time, JSON.parse(SpreeDeliveryOptions::Config.delivery_time_options).values, {}
7
+ </p>
@@ -0,0 +1,8 @@
1
+ <div class="row steps-data">
2
+ <div class="columns sixteen">
3
+ <h6><%= t(:delivery_date) %></h6>
4
+ <div class="delivery-date">
5
+ <%= (order.delivery_date != nil) ? "#{order.delivery_date} - #{order.delivery_time}" : 'Unknown' %>
6
+ </div>
7
+ </div>
8
+ </div>
@@ -0,0 +1,4 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Spree::Core::Engine.routes.draw do
2
+ # Add your extension routes here
3
+ end
@@ -0,0 +1,9 @@
1
+ class AddDeliveryDateToOrders < ActiveRecord::Migration
2
+ def up
3
+ add_column :spree_orders, :delivery_date, :date
4
+ end
5
+
6
+ def down
7
+ remove_column :spree_orders, :delivery_date
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ class AddDeliveryTimeToOrders < ActiveRecord::Migration
2
+ def change
3
+ add_column :spree_orders, :delivery_time, :string
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ module SpreeDeliveryOptions
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
5
+ def add_javascripts
6
+ end
7
+
8
+ def add_stylesheets
9
+ inject_into_file 'app/assets/stylesheets/store/all.css', " *= require store/spree_delivery_options\n", :before => /\*\//, :verbose => true
10
+ end
11
+
12
+ def add_migrations
13
+ run 'bundle exec rake railties:install:migrations FROM=spree_delivery_options'
14
+ end
15
+
16
+ def run_migrations
17
+ res = ask 'Would you like to run the migrations now? [Y/n]'
18
+ if res == '' || res.downcase == 'y'
19
+ run 'bundle exec rake db:migrate'
20
+ else
21
+ puts 'Skipping rake db:migrate, don\'t forget to run it!'
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,6 @@
1
+ module SpreeDeliveryOptions
2
+ class Configuration < Spree::Preferences::Configuration
3
+ preference :delivery_cut_off_hour, :integer, default: 12
4
+ preference :delivery_time_options, :string, default: {early_morning: 'Between 6am-8am'}.to_json
5
+ end
6
+ end
@@ -0,0 +1,28 @@
1
+ module SpreeDeliveryOptions
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+
6
+ initializer "spree.spree_delivery_options.preferences", :after => "spree.environment" do |app|
7
+ SpreeDeliveryOptions::Config = SpreeDeliveryOptions::Configuration.new
8
+ end
9
+
10
+ engine_name 'spree_delivery_options'
11
+
12
+ config.autoload_paths += %W(#{config.root}/lib)
13
+
14
+ # use rspec for tests
15
+ config.generators do |g|
16
+ g.test_framework :rspec
17
+ end
18
+
19
+ def self.activate
20
+ Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
21
+ Rails.configuration.cache_classes ? require(c) : load(c)
22
+ end
23
+ end
24
+
25
+
26
+ config.to_prepare &method(:activate).to_proc
27
+ end
28
+ end
@@ -0,0 +1,2 @@
1
+ require 'spree_core'
2
+ require 'spree_delivery_options/engine'
data/script/rails ADDED
@@ -0,0 +1,7 @@
1
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
2
+
3
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
4
+ ENGINE_PATH = File.expand_path('../../lib/spree_delivery_options/engine', __FILE__)
5
+
6
+ require 'rails/all'
7
+ require 'rails/engine/commands'
@@ -0,0 +1,85 @@
1
+ require 'spec_helper'
2
+
3
+ describe Spree::Order do
4
+
5
+ let(:order){Spree::Order.new}
6
+
7
+ describe "validations" do
8
+
9
+ describe 'delivery date' do
10
+
11
+ it 'should require delivery date' do
12
+ order.valid_delivery_date?.should == false
13
+ order.errors[:delivery_date].should_not be_empty
14
+ end
15
+
16
+ it 'should not be valid if delivery date is in the past' do
17
+ order.delivery_date = Date.yesterday
18
+ order.valid_delivery_date?.should == false
19
+ order.errors[:delivery_date].should_not be_empty
20
+ end
21
+
22
+ it 'should not be valid if delivery date is today' do
23
+ order.delivery_date = Date.today
24
+ order.valid_delivery_date?.should == false
25
+ order.errors[:delivery_date].should_not be_empty
26
+ end
27
+
28
+ it 'should not be valid if delivery date is tomorrow and it is past the cutoff time' do
29
+ time_now = DateTime.parse("20/11/2013 #{SpreeDeliveryOptions::Config.delivery_cut_off_hour}:01 +1100")
30
+ Timecop.freeze(time_now)
31
+
32
+ order.delivery_date = '21/11/2013'
33
+ order.valid_delivery_date?.should == false
34
+ order.errors[:delivery_date].should_not be_empty
35
+ Timecop.return
36
+ end
37
+
38
+ it 'should be valid if delivery date is tomorrow but is before the cutoff time' do
39
+ time_now = DateTime.parse("20/11/2013 #{SpreeDeliveryOptions::Config.delivery_cut_off_hour-1}:59 +1100")
40
+ Timecop.freeze(time_now)
41
+
42
+ order.delivery_date = '21/11/2013'
43
+ order.valid_delivery_date?
44
+ order.errors[:delivery_date].should be_empty
45
+ Timecop.return
46
+ end
47
+
48
+ it 'should be valid if delivery date is after tomorrow' do
49
+ time_now = DateTime.parse("20/11/2013 #{SpreeDeliveryOptions::Config.delivery_cut_off_hour+1}:30 +1100")
50
+ Timecop.freeze(time_now)
51
+
52
+ order.delivery_date = '22/11/2013'
53
+ order.valid_delivery_date?
54
+ order.errors[:delivery_date].should be_empty
55
+ Timecop.return
56
+ end
57
+
58
+ end
59
+
60
+ describe 'delivery time' do
61
+
62
+ it 'should accept valid delivery time' do
63
+ delivery_time_options = JSON.parse(SpreeDeliveryOptions::Config.delivery_time_options)
64
+ order.delivery_time = delivery_time_options["early_morning"]
65
+ order.valid_delivery_time?
66
+ order.errors[:delivery_time].should be_empty
67
+ end
68
+
69
+ it 'should require delivery time' do
70
+ order.valid_delivery_time?.should == false
71
+ order.errors[:delivery_time].should_not be_empty
72
+ end
73
+
74
+ it 'should require a valid option for delivery time' do
75
+ order.delivery_time = 'crazy times!'
76
+ order.valid_delivery_time?.should == false
77
+ order.errors[:delivery_time].should_not be_empty
78
+ end
79
+
80
+ end
81
+
82
+
83
+ end
84
+
85
+ end
@@ -0,0 +1,80 @@
1
+ # Run Coverage report
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter 'spec/dummy'
5
+ add_group 'Controllers', 'app/controllers'
6
+ add_group 'Helpers', 'app/helpers'
7
+ add_group 'Mailers', 'app/mailers'
8
+ add_group 'Models', 'app/models'
9
+ add_group 'Views', 'app/views'
10
+ add_group 'Libraries', 'lib'
11
+ end
12
+
13
+ # Configure Rails Environment
14
+ ENV['RAILS_ENV'] = 'test'
15
+
16
+ require File.expand_path('../dummy/config/environment.rb', __FILE__)
17
+
18
+ require 'rspec/rails'
19
+ require 'timecop'
20
+ require 'database_cleaner'
21
+ require 'ffaker'
22
+
23
+ # Requires supporting ruby files with custom matchers and macros, etc,
24
+ # in spec/support/ and its subdirectories.
25
+ Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
26
+
27
+ # Requires factories defined in spree_core
28
+ require 'spree/testing_support/factories'
29
+ require 'spree/testing_support/controller_requests'
30
+ require 'spree/testing_support/authorization_helpers'
31
+ require 'spree/testing_support/url_helpers'
32
+
33
+ RSpec.configure do |config|
34
+ config.include FactoryGirl::Syntax::Methods
35
+
36
+ # == URL Helpers
37
+ #
38
+ # Allows access to Spree's routes in specs:
39
+ #
40
+ # visit spree.admin_path
41
+ # current_path.should eql(spree.products_path)
42
+ config.include Spree::TestingSupport::UrlHelpers
43
+
44
+ # == Mock Framework
45
+ #
46
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
47
+ #
48
+ # config.mock_with :mocha
49
+ # config.mock_with :flexmock
50
+ # config.mock_with :rr
51
+ config.mock_with :rspec
52
+ config.color = true
53
+
54
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
55
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
56
+
57
+ # Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
58
+ # to cleanup after each test instead. Without transactional fixtures set to false the records created
59
+ # to setup a test will be unavailable to the browser, which runs under a seperate server instance.
60
+ config.use_transactional_fixtures = false
61
+
62
+ # Ensure Suite is set to use transactions for speed.
63
+ config.before :suite do
64
+ DatabaseCleaner.strategy = :transaction
65
+ DatabaseCleaner.clean_with :truncation
66
+ end
67
+
68
+ # Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
69
+ config.before :each do
70
+ DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
71
+ DatabaseCleaner.start
72
+ end
73
+
74
+ # After each spec clean the database.
75
+ config.after :each do
76
+ DatabaseCleaner.clean
77
+ end
78
+
79
+ config.fail_fast = ENV['FAIL_FAST'] || false
80
+ end
@@ -0,0 +1,31 @@
1
+ # encoding: UTF-8
2
+ Gem::Specification.new do |s|
3
+ s.platform = Gem::Platform::RUBY
4
+ s.name = 'spree_delivery_options'
5
+ s.version = '2.1.3'
6
+ s.summary = 'Adds delivery date and time during checkout'
7
+ s.description = ''
8
+ s.required_ruby_version = '>= 2.0.0'
9
+
10
+ s.author = 'Francisco Trindade'
11
+ s.email = 'frank.trindade@gmail.com'
12
+
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.require_path = 'lib'
16
+ s.requirements << 'none'
17
+
18
+ s.add_dependency 'spree_core', '~> 2.1.3'
19
+
20
+ s.add_development_dependency 'capybara', '~> 2.1'
21
+ s.add_development_dependency 'coffee-rails'
22
+ s.add_development_dependency 'database_cleaner'
23
+ s.add_development_dependency 'factory_girl', '~> 4.2'
24
+ s.add_development_dependency 'ffaker'
25
+ s.add_development_dependency 'rspec-rails', '~> 2.13'
26
+ s.add_development_dependency 'sass-rails'
27
+ s.add_development_dependency 'selenium-webdriver'
28
+ s.add_development_dependency 'simplecov'
29
+ s.add_development_dependency 'sqlite3'
30
+ s.add_development_dependency 'timecop'
31
+ end
metadata ADDED
@@ -0,0 +1,246 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spree_delivery_options
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.3
5
+ platform: ruby
6
+ authors:
7
+ - Francisco Trindade
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: spree_core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 2.1.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 2.1.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: capybara
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '2.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coffee-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: database_cleaner
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '4.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '4.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: ffaker
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: '2.13'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '2.13'
111
+ - !ruby/object:Gem::Dependency
112
+ name: sass-rails
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: selenium-webdriver
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: sqlite3
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: timecop
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description: ''
182
+ email: frank.trindade@gmail.com
183
+ executables: []
184
+ extensions: []
185
+ extra_rdoc_files: []
186
+ files:
187
+ - .gitignore
188
+ - .rspec
189
+ - Gemfile
190
+ - LICENSE
191
+ - README.md
192
+ - Rakefile
193
+ - Versionfile
194
+ - app/assets/stylesheets/store/delivery_checkout.scss
195
+ - app/assets/stylesheets/store/spree_delivery_options.css
196
+ - app/models/spree/order_decorator.rb
197
+ - app/overrides/admin_order_information.rb
198
+ - app/overrides/admin_orders_delivery_date_column.rb
199
+ - app/overrides/admin_orders_delivery_date_filter.rb
200
+ - app/overrides/delivery_date.rb
201
+ - app/overrides/delivery_date_details.rb
202
+ - app/views/spree/admin/orders/_delivery_date_cell.html.erb
203
+ - app/views/spree/admin/orders/_delivery_date_filter.html.erb
204
+ - app/views/spree/admin/orders/_delivery_date_header.html.erb
205
+ - app/views/spree/admin/shared/_admin_order_information_delivery_date.html.erb
206
+ - app/views/spree/checkout/_delivery_date.html.erb
207
+ - app/views/spree/orders/_order_delivery_date_details.html.erb
208
+ - config/locales/en.yml
209
+ - config/routes.rb
210
+ - db/migrate/20130415025010_add_delivery_date_to_orders.rb
211
+ - db/migrate/20131206053316_add_delivery_time_to_orders.rb
212
+ - lib/generators/spree_delivery_options/install/install_generator.rb
213
+ - lib/spree_delivery_options.rb
214
+ - lib/spree_delivery_options/configuration.rb
215
+ - lib/spree_delivery_options/engine.rb
216
+ - script/rails
217
+ - spec/models/order_spec.rb
218
+ - spec/spec_helper.rb
219
+ - spree_delivery_options.gemspec
220
+ homepage:
221
+ licenses: []
222
+ metadata: {}
223
+ post_install_message:
224
+ rdoc_options: []
225
+ require_paths:
226
+ - lib
227
+ required_ruby_version: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - '>='
230
+ - !ruby/object:Gem::Version
231
+ version: 2.0.0
232
+ required_rubygems_version: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - '>='
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ requirements:
238
+ - none
239
+ rubyforge_project:
240
+ rubygems_version: 2.1.11
241
+ signing_key:
242
+ specification_version: 4
243
+ summary: Adds delivery date and time during checkout
244
+ test_files:
245
+ - spec/models/order_spec.rb
246
+ - spec/spec_helper.rb