-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
63 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddUserIdToTask < ActiveRecord::Migration[7.0] | ||
def change | ||
add_reference :tasks, :user, null: false, foreign_key: true | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,45 @@ | ||
require 'rails_helper' | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe "Tasks", type: :request do | ||
describe "GET /index" do | ||
pending "add some examples (or delete) #{__FILE__}" | ||
require 'swagger_helper' | ||
RSpec.describe 'Tasks', type: :request do | ||
path '/task' do | ||
post 'Create a task' do | ||
tags 'Tasks' | ||
consumes 'application/json' | ||
produces 'application/json' | ||
security [bearer_auth: []] | ||
|
||
parameter name: :register_params, in: :body, schema: { | ||
type: :object, | ||
properties: { | ||
title: { type: :string }, | ||
description: { type: :string } | ||
}, | ||
required: %w[title] | ||
}, | ||
required: true | ||
|
||
let(:token) { token_scopes('public manage') } | ||
|
||
let(:Authorization) { "Bearer #{token.token}" } | ||
|
||
request_body_example value: { | ||
title: 'Some title', | ||
description: 'password' | ||
}, name: '1', summary: 'Success 201' | ||
|
||
response '201', 'task created' do | ||
let(:register_params) do | ||
{ | ||
title: 'user@example.com', | ||
description: 'password' | ||
} | ||
end | ||
|
||
run_test! do |response| | ||
expect(response).to have_http_status(:created) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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