diff --git a/spec/requests/api/user/users_spec.rb b/spec/requests/api/user/users_spec.rb index 2b6020e9..568c6fb7 100644 --- a/spec/requests/api/user/users_spec.rb +++ b/spec/requests/api/user/users_spec.rb @@ -52,35 +52,42 @@ describe 'User', type: :request do get 'financial summary about the currently logged-in user' do tags 'User', 'FinancialTransaction' produces 'application/json' - let!(:user) { create :user, :ordergroup } + let(:user) { create :user, :ordergroup } + FinancialTransactionClass.create(name: 'TestTransaction') response 200, 'success' do schema type: :object, properties: { - account_balance: { - type: :number, - description: 'booked accout balance of ordergroup' - }, - available_funds: { - type: :number, - description: 'fund available to order articles' - }, - financial_transaction_class_sums: { + financial_overview: { type: :object, properties: { - id: { - type: :integer, - description: 'id of the financial transaction class' - }, - name: { - type: :string, - description: 'name of the financial transaction class' - }, - amount: { + + account_balance: { type: :number, - description: 'sum of the amounts belonging to the financial transaction class' + description: 'booked accout balance of ordergroup' }, - required: %w[id name amount] + available_funds: { + type: :number, + description: 'fund available to order articles' + }, + financial_transaction_class_sums: { + type: :array, + properties: { + id: { + type: :integer, + description: 'id of the financial transaction class' + }, + name: { + type: :string, + description: 'name of the financial transaction class' + }, + amount: { + type: :number, + description: 'sum of the amounts belonging to the financial transaction class' + } + }, + required: %w[id name amount] + } }, required: %w[account_balance available_funds financial_transaction_class_sums] } diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 080fde20..600f45fd 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -93,7 +93,8 @@ RSpec.configure do |config| description: 'id of order this order article belongs to' }, price: { - type: :float, + type: :number, + format: :float, description: 'foodcoop price' }, quantity: { @@ -146,12 +147,10 @@ RSpec.configure do |config| }, user_id: { type: :integer, - required: false, description: 'id of user who entered the transaction (may be null for deleted users or 0 for a system user)' }, user_name: { type: :string, - required: false, description: 'name of user who entered the transaction (may be null or empty string for deleted users or system users)' }, financial_transaction_type_name: { @@ -227,9 +226,9 @@ RSpec.configure do |config| total_count: { type: :integer, description: 'total number of items in the collection' - }, - required: %w[page per_page total_pages total_count] - } + } + }, + required: %w[page per_page total_pages total_count] }, Navigation: { type: :array,