Sha256: 0875ff749c3c6f2dbd15d94f55aeb427b58cb4a1d494963dd8cc0a0b4b33ced3
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true require 'spec_helper' require 'spree/api/testing_support/helpers' RSpec.describe Spree::Api::UsersController, type: :controller do include Spree::Api::TestingSupport::Helpers routes { Spree::Core::Engine.routes } let!(:user) do create(:user, &:generate_spree_api_key).tap(&:save) end let!(:subscription) { create :subscription, :with_line_item, user: user } describe 'patch /update' do subject(:update_user) { patch :update, params: params } let(:params) do { id: user.id, token: user.spree_api_key, format: 'json', user: { subscriptions_attributes: [{ id: subscription.id, line_items_attributes: [line_item_attributes] }] } } end let(:line_item_attributes) do { id: subscription.line_item_ids.first, quantity: 6, interval_length: 1, interval_units: 'month' } end it 'updates the subscription line items' do update_user line_item = subscription.line_items.reload.first expect(line_item).to have_attributes(line_item_attributes) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_subscriptions-1.0.0 | spec/controllers/spree/api/users_controller_spec.rb |
solidus_subscriptions-1.0.0.rc1 | spec/controllers/spree/api/users_controller_spec.rb |