Sha256: 9c853158eb7a312a0861fdd798d591a0a4814bb6b9241f9980f1695f7b797fd3

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

feature 'Shipping Matrix Calculator' do
  before(:each) do
    given_i_am_logged_into_the_cms
    and_i_have_shipping_category
    and_i_have_shipping_matrices_and_rules
  end

  scenario 'creating a shipping method using matrix calculator', js: true do
    when_i_create_a_new_shipping_method_using_matrix_calculator
    then_the_num_of_shipping_methods_should_be(1)
  end
end

def and_i_have_shipping_category
  create(:shipping_category)
end

def and_i_have_shipping_matrices_and_rules
  create(:shipping_matrix_with_rules, num_of_rules: 3)
end

def when_i_create_a_new_shipping_method_using_matrix_calculator
  visit spree.new_admin_shipping_method_path
  fill_in :shipping_method_name, with: 'UK Next Day'
  fill_in :shipping_method_admin_name, with: 'UK Next Day'
  all('[type=checkbox]').each { |checkbox| checkbox.set(true) }
  select2 'Shipping Matrix Calculator', from: 'Calculator'
  click_button 'Create'
end

def then_the_num_of_shipping_methods_should_be(expected_num)
  expect(page).to have_content('has been successfully created!')
  expect(Spree::ShippingMethod.count).to be(expected_num)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_shipping_matrix-0.2.1 spec/features/shipping_matrix_calculator_spec.rb
spree_shipping_matrix-0.2.0 spec/features/shipping_matrix_calculator_spec.rb
spree_shipping_matrix-0.1.0 spec/features/shipping_matrix_calculator_spec.rb