Created
May 11, 2020 14:43
-
-
Save gunesmes/68a839a40560f77edd93d0a970cf5083 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
module QA | |
RSpec.context 'API' do | |
describe '/user' do | |
before(:context) do | |
@api_client = Runtime::API::Client.new(env = :local) | |
end | |
let(:valid_user) { Runtime::API::Address.new(@api_client, path = 'user?username=testusername1') } | |
let(:non_existing_user) { Runtime::API::Address.new(@api_client, path = 'user?username=NonExistingUser') } | |
it 'should get a valid users' do | |
get valid_user.url | |
expect_status '200' | |
expect_json_types( | |
pk: :integer, | |
fields: { | |
username: :string, | |
email: :string, | |
address: :string, | |
birthday: :string, | |
premium: :boolean | |
} | |
) | |
expect_json(model: 'src.users') | |
end | |
it 'should return error for post request' do | |
post valid_user.url | |
expect_status '403' | |
end | |
it 'should return empty user list' do | |
get non_existing_user.url | |
expect_status '200' | |
expect_json({}) | |
expect(json_body.empty?).to be true | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment