spree_shipping_matrix 0.1.0 → 0.2.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.
- data/README.md +3 -1
- data/app/helpers/spree/admin/base_helper_decorator.rb +3 -1
- data/app/views/spree/admin/shipping_matrices/edit.html.erb +4 -5
- data/app/views/spree/admin/shipping_matrices/index.html.erb +3 -4
- data/app/views/spree/admin/shipping_matrices/new.html.erb +3 -5
- data/lib/spree_shipping_matrix/factories.rb +2 -0
- data/lib/spree_shipping_matrix/version.rb +1 -1
- data/spec/spec_helper.rb +1 -3
- data/spec/support/user_steps.rb +6 -10
- data/spec/unit/models/shipping_matrix_rule_spec.rb +0 -7
- metadata +4 -3
data/README.md
CHANGED
@@ -4,8 +4,10 @@ Advanced shipping calculator based on rules matrix for Spree.
|
|
4
4
|
|
5
5
|
[](https://codeclimate.com/github/madebymade/spree_shipping_matrix)
|
6
6
|
[](https://travis-ci.org/madebymade/spree_shipping_matrix)
|
7
|
-
[](http://rails-brakeman.com/madebymade/spree_shipping_matrix)
|
8
7
|
[](https://codeclimate.com/github/madebymade/spree_shipping_matrix)
|
8
|
+
[](https://www.pullreview.com/github/madebymade/spree_shipping_matrix/reviews/master)
|
9
|
+
[](https://gemnasium.com/madebymade/spree_shipping_matrix)
|
10
|
+
[](http://rails-brakeman.com/madebymade/spree_shipping_matrix)
|
9
11
|
|
10
12
|
## Installation
|
11
13
|
|
@@ -1,9 +1,11 @@
|
|
1
1
|
Spree::Admin::BaseHelper.module_eval do
|
2
|
+
alias_method :original_preference_field_for, :preference_field_for
|
3
|
+
|
2
4
|
def preference_field_for(form, field, options)
|
3
5
|
if options[:type] == :matrix_id
|
4
6
|
form.matrix_field(field, preference_field_options(options))
|
5
7
|
else
|
6
|
-
|
8
|
+
original_preference_field_for(form, field, options)
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render
|
1
|
+
<%= render 'spree/admin/shared/configuration_menu' %>
|
2
2
|
|
3
3
|
<% content_for :page_title do %>
|
4
4
|
<%= Spree.t(:editting, scope: :shipping_matrix) %>
|
@@ -13,13 +13,12 @@
|
|
13
13
|
</li>
|
14
14
|
<% end %>
|
15
15
|
|
16
|
-
<%= render
|
17
|
-
locals: { target: @shipping_matrix } %>
|
16
|
+
<%= render 'spree/shared/error_messages', target: @shipping_matrix %>
|
18
17
|
|
19
18
|
<%= form_for [:admin, @shipping_matrix] do |f| %>
|
20
19
|
<fieldset>
|
21
20
|
<legend align="center"><%= Spree.t(:editting, scope: :shipping_matrix) %></legend>
|
22
|
-
<%= render
|
23
|
-
<%= render
|
21
|
+
<%= render 'form', f: f %>
|
22
|
+
<%= render 'spree/admin/shared/edit_resource_links' %>
|
24
23
|
</fieldset>
|
25
24
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= render
|
1
|
+
<%= render 'spree/admin/shared/configuration_menu' %>
|
2
2
|
|
3
3
|
<% content_for :page_title do %>
|
4
4
|
<%= Spree.t(:title, scope: :shipping_matrix) %>
|
@@ -43,9 +43,8 @@
|
|
43
43
|
>
|
44
44
|
<td class="align-center"><%= shipping_matrix.name %></td>
|
45
45
|
<td class="actions">
|
46
|
-
<%= link_to_edit(shipping_matrix,
|
47
|
-
|
48
|
-
no_text: true) %>
|
46
|
+
<%= link_to_edit(shipping_matrix, class: 'admin_edit_shipping_matrix',
|
47
|
+
no_text: true) %>
|
49
48
|
<%= link_to_delete(shipping_matrix, no_text: true) %>
|
50
49
|
</td>
|
51
50
|
</tr>
|
@@ -1,11 +1,9 @@
|
|
1
|
-
<%= render
|
2
|
-
locals: { target: @shipping_matrix } %>
|
1
|
+
<%= render 'spree/shared/error_messages', target: @shipping_matrix %>
|
3
2
|
|
4
3
|
<%= form_for [:admin, @shipping_matrix] do |f| %>
|
5
4
|
<fieldset>
|
6
5
|
<legend align="center"><%= Spree.t(:new, scope: :shipping_matrix) %></legend>
|
7
|
-
<%= render
|
8
|
-
|
9
|
-
<%= render partial: 'spree/admin/shared/new_resource_links' %>
|
6
|
+
<%= render 'form', f: f %>
|
7
|
+
<%= render 'spree/admin/shared/new_resource_links' %>
|
10
8
|
</fieldset>
|
11
9
|
<% end %>
|
data/spec/spec_helper.rb
CHANGED
@@ -12,8 +12,6 @@ require 'ffaker'
|
|
12
12
|
require 'capybara/poltergeist'
|
13
13
|
require 'factory_girl'
|
14
14
|
|
15
|
-
include(FactoryGirl)
|
16
|
-
|
17
15
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
18
16
|
# in spec/support/ and its subdirectories.
|
19
17
|
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
@@ -27,7 +25,7 @@ require 'spree/testing_support/url_helpers'
|
|
27
25
|
require 'spree/testing_support/order_walkthrough'
|
28
26
|
|
29
27
|
# Requires factories defined in lib/spree_shipping_matrix/factories.rb
|
30
|
-
|
28
|
+
require 'spree_shipping_matrix/factories'
|
31
29
|
|
32
30
|
Capybara.default_selector = :css
|
33
31
|
Capybara.javascript_driver = :poltergeist
|
data/spec/support/user_steps.rb
CHANGED
@@ -1,19 +1,15 @@
|
|
1
|
-
def
|
2
|
-
|
3
|
-
|
1
|
+
def given_i_am_logged_in(login_path = nil)
|
2
|
+
visit login_path || spree.login_path
|
3
|
+
@user ||= FactoryGirl.create(:user)
|
4
4
|
fill_in :spree_user_email, with: @user.email
|
5
5
|
fill_in :spree_user_password, with: @user.password
|
6
6
|
click_button 'Login'
|
7
7
|
@user
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
@user = FactoryGirl.create(:
|
12
|
-
|
13
|
-
fill_in :spree_user_email, with: @user.email
|
14
|
-
fill_in :spree_user_password, with: @user.password
|
15
|
-
click_button 'Login'
|
16
|
-
@user
|
10
|
+
def given_i_am_logged_into_the_cms
|
11
|
+
@user = FactoryGirl.create(:admin_user)
|
12
|
+
given_i_am_logged_in(spree.admin_path)
|
17
13
|
end
|
18
14
|
|
19
15
|
def given_i_am_logged_in_as_user_with(role)
|
@@ -18,13 +18,6 @@ describe Spree::ShippingMatrixRule do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
[:matrix, :role, :min_line_item_total, :amount].each do |field|
|
22
|
-
context "and a ##{field} is not provided" do
|
23
|
-
before(:each) { attrs.delete(field) }
|
24
|
-
it { is_expected.to be_invalid }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
21
|
[:min_line_item_total, :amount].each do |field|
|
29
22
|
context "and text value provided for ##{field}" do
|
30
23
|
before(:each) { attrs.merge!(field => 'word') }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_shipping_matrix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-08-
|
12
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: spree_core
|
@@ -244,6 +244,7 @@ files:
|
|
244
244
|
- lib/generators/spree_shipping_matrix/install/install_generator.rb
|
245
245
|
- lib/spree_shipping_matrix.rb
|
246
246
|
- lib/spree_shipping_matrix/engine.rb
|
247
|
+
- lib/spree_shipping_matrix/factories.rb
|
247
248
|
- lib/spree_shipping_matrix/version.rb
|
248
249
|
- spec/factories/shipping_matrix_factory.rb
|
249
250
|
- spec/factories/shipping_matrix_rule_factory.rb
|
@@ -277,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
277
278
|
version: '0'
|
278
279
|
segments:
|
279
280
|
- 0
|
280
|
-
hash: -
|
281
|
+
hash: -3748712467567725661
|
281
282
|
requirements:
|
282
283
|
- none
|
283
284
|
rubyforge_project:
|