spree_shipping_matrix 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -4,8 +4,10 @@ Advanced shipping calculator based on rules matrix for Spree.
4
4
 
5
5
  [![Code Climate](https://codeclimate.com/github/madebymade/spree_shipping_matrix/badges/gpa.svg)](https://codeclimate.com/github/madebymade/spree_shipping_matrix)
6
6
  [![Build Status](https://travis-ci.org/madebymade/spree_shipping_matrix.svg?branch=master)](https://travis-ci.org/madebymade/spree_shipping_matrix)
7
- [![Brakeman](http://rails-brakeman.com/madebymade/spree_shipping_matrix.png)](http://rails-brakeman.com/madebymade/spree_shipping_matrix)
8
7
  [![Test Coverage](https://codeclimate.com/github/madebymade/spree_shipping_matrix/badges/coverage.svg)](https://codeclimate.com/github/madebymade/spree_shipping_matrix)
8
+ [![PullReview stats](https://www.pullreview.com/github/madebymade/spree_shipping_matrix/badges/master.svg?)](https://www.pullreview.com/github/madebymade/spree_shipping_matrix/reviews/master)
9
+ [![Dependency Status](https://gemnasium.com/madebymade/spree_shipping_matrix.svg)](https://gemnasium.com/madebymade/spree_shipping_matrix)
10
+ [![Brakeman](http://rails-brakeman.com/madebymade/spree_shipping_matrix.png)](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
- super
8
+ original_preference_field_for(form, field, options)
7
9
  end
8
10
  end
9
11
  end
@@ -1,4 +1,4 @@
1
- <%= render partial: 'spree/admin/shared/configuration_menu' %>
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 partial: 'spree/shared/error_messages',
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 :partial => 'form', :locals => { :f => f } %>
23
- <%= render :partial => 'spree/admin/shared/edit_resource_links' %>
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 :partial => 'spree/admin/shared/configuration_menu' %>
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
- class: 'admin_edit_shipping_matrix',
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 partial: 'spree/shared/error_messages',
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 partial: 'form', locals: { f: f } %>
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 %>
@@ -0,0 +1,2 @@
1
+ factory_glob = SpreeShippingMatrix::Engine.root.join('spec/factories/*_factory.rb')
2
+ Dir[factory_glob].each { |f| require f }
@@ -1,3 +1,3 @@
1
1
  module SpreeShippingMatrix
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  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
- Dir[File.join(File.dirname(__FILE__), 'factories/**/*_factory.rb')].each { |f| require f }
28
+ require 'spree_shipping_matrix/factories'
31
29
 
32
30
  Capybara.default_selector = :css
33
31
  Capybara.javascript_driver = :poltergeist
@@ -1,19 +1,15 @@
1
- def given_i_am_logged_into_the_cms
2
- @user = FactoryGirl.create(:admin_user)
3
- visit spree.admin_path
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 given_i_am_logged_in
11
- @user = FactoryGirl.create(:user)
12
- visit spree.login_path
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.1.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-28 00:00:00.000000000 Z
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: -729713437542143338
281
+ hash: -3748712467567725661
281
282
  requirements:
282
283
  - none
283
284
  rubyforge_project: