Sha256: 0437df3880edd34a6f2d6a6499f9eec3f65a4dbc7cf043caa8c4a21247fab3c4

Contents?: true

Size: 877 Bytes

Versions: 28

Compression:

Stored size: 877 Bytes

Contents

require 'rails_helper'
require 'rack/test'

RSpec.describe Api::UsersController, feature_group: 'Users', type: :controller, appmap: true do
  describe 'POST /api/users', feature: 'Create a user' do
    describe 'with required parameters' do
      it 'creates a user' do
        post :create, params: { login: 'alice', password: 'foobar' }
        expect(response.status).to eq(201)
      end
    end
    describe 'with a missing parameter' do
      it 'reports error 422' do
        post :create, params: {}
        expect(response.status).to eq(422)
      end
    end
  end
  describe 'GET /api/users', feature: 'List users' do
    before do
      post :create, params: { login: 'alice' }
    end
    it 'lists the users' do
      post :index, params: {}
      users = JSON.parse(response.body)
      expect(users.map { |r| r['login'] }).to include('alice')
    end
  end
end

Version data entries

28 entries across 27 versions & 1 rubygems

Version Path
appmap-0.37.2 spec/fixtures/rails5_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.37.2 spec/fixtures/rails6_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.37.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.36.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.35.2 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.35.1 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.35.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.34.5 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.34.4 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.34.2 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.34.1 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.34.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.33.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.32.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.31.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.28.1 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.28.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.27.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.26.1 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb
appmap-0.26.0 spec/fixtures/rails_users_app/spec/controllers/users_controller_api_spec.rb