Sha256: 50a5d4c4a9cfcdadd696f5c916b6909c78da65f64b0155a7e95a153e1eea2609

Contents?: true

Size: 905 Bytes

Versions: 47

Compression:

Stored size: 905 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Spree::Admin::ReturnItemsController, type: :controller do
  stub_authorization!

  describe '#update' do
    let(:customer_return) { create(:customer_return) }
    let(:return_item) { customer_return.return_items.first }
    let(:old_acceptance_status) { 'pending' }
    let(:new_acceptance_status) { 'rejected' }

    subject do
      put :update, params: { id: return_item.to_param, return_item: { acceptance_status: new_acceptance_status } }
    end

    it 'updates the return item' do
      expect {
        subject
      }.to change { return_item.reload.acceptance_status }.from(old_acceptance_status).to(new_acceptance_status)
    end

    it 'redirects to the customer return' do
      subject
      expect(response).to redirect_to spree.edit_admin_order_customer_return_path(customer_return.order, customer_return)
    end
  end
end

Version data entries

47 entries across 47 versions & 2 rubygems

Version Path
solidus_backend_devise_token_auth-2.8.0.alpha.4 spec/controllers/spree/admin/return_items_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.3 spec/controllers/spree/admin/return_items_controller_spec.rb
solidus_backend_devise_token_auth-2.8.0.alpha.2 spec/controllers/spree/admin/return_items_controller_spec.rb
solidus_backend-2.7.0 spec/controllers/spree/admin/return_items_controller_spec.rb
solidus_backend-2.6.1 spec/controllers/spree/admin/return_items_controller_spec.rb
solidus_backend-2.6.0 spec/controllers/spree/admin/return_items_controller_spec.rb
solidus_backend-2.6.0.rc1 spec/controllers/spree/admin/return_items_controller_spec.rb