chore: rubocop
chore: fix api test conventions chore: rubocop -A spec/ chore: more rubocop -A fix failing test rubocop fixes removes helper methods that are in my opinion dead code more rubocop fixes rubocop -a --auto-gen-config
This commit is contained in:
parent
f6fb804bbe
commit
fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions
103
spec/requests/api/v1/user/users_spec.rb
Normal file
103
spec/requests/api/v1/user/users_spec.rb
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
require 'swagger_helper'
|
||||
|
||||
describe 'User' do
|
||||
include ApiHelper
|
||||
|
||||
path '/user' do
|
||||
get 'info about the currently logged-in user' do
|
||||
tags 'User'
|
||||
produces 'application/json'
|
||||
let(:api_scopes) { ['user:read'] }
|
||||
let(:other_user1) { create(:user) }
|
||||
let(:user) { create(:user) }
|
||||
let(:other_user2) { create(:user) }
|
||||
|
||||
response '200', 'success' do
|
||||
schema type: :object,
|
||||
properties: {
|
||||
user: {
|
||||
type: :object,
|
||||
properties: {
|
||||
id: {
|
||||
type: :integer
|
||||
},
|
||||
name: {
|
||||
type: :string,
|
||||
description: 'full name'
|
||||
},
|
||||
email: {
|
||||
type: :string,
|
||||
description: 'email address'
|
||||
},
|
||||
locale: {
|
||||
type: :string,
|
||||
description: 'language code'
|
||||
}
|
||||
},
|
||||
required: %w[id name email]
|
||||
}
|
||||
}
|
||||
|
||||
run_test! do |response|
|
||||
data = JSON.parse(response.body)
|
||||
expect(data['user']['id']).to eq(user.id)
|
||||
end
|
||||
end
|
||||
|
||||
it_handles_invalid_token_and_scope
|
||||
end
|
||||
end
|
||||
|
||||
path '/user/financial_overview' do
|
||||
get 'financial summary about the currently logged-in user' do
|
||||
tags 'User', 'Financial Transaction'
|
||||
produces 'application/json'
|
||||
let(:user) { create(:user, :ordergroup) }
|
||||
let(:api_scopes) { ['finance:user'] }
|
||||
FinancialTransactionClass.create(name: 'TestTransaction')
|
||||
|
||||
response 200, 'success' do
|
||||
schema type: :object,
|
||||
properties: {
|
||||
financial_overview: {
|
||||
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: {
|
||||
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]
|
||||
}
|
||||
}
|
||||
|
||||
run_test!
|
||||
end
|
||||
|
||||
it_handles_invalid_token_and_scope
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue