Refactoring Grape API methods into normal controllers & other things
This commit is contained in:
parent
11ff92c9d7
commit
0e8f59c16f
63 changed files with 336 additions and 406 deletions
17
spec/controllers/accounts_controller_spec.rb
Normal file
17
spec/controllers/accounts_controller_spec.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountsController, type: :controller do
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns 200' do
|
||||
get :show, username: alice.username
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'returns 200 with Atom' do
|
||||
get :show, username: alice.username, format: 'atom'
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
end
|
7
spec/controllers/api/salmon_controller_spec.rb
Normal file
7
spec/controllers/api/salmon_controller_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::SalmonController, type: :controller do
|
||||
describe 'POST #update' do
|
||||
pending
|
||||
end
|
||||
end
|
11
spec/controllers/api/subscriptions_controller_spec.rb
Normal file
11
spec/controllers/api/subscriptions_controller_spec.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::SubscriptionsController, type: :controller do
|
||||
describe 'GET #show' do
|
||||
pending
|
||||
end
|
||||
|
||||
describe 'POST #update' do
|
||||
pending
|
||||
end
|
||||
end
|
|
@ -1,11 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AtomController, type: :controller do
|
||||
describe 'GET #user_stream' do
|
||||
pending
|
||||
end
|
||||
|
||||
describe 'GET #entry' do
|
||||
pending
|
||||
end
|
||||
end
|
|
@ -2,6 +2,9 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe HomeController, type: :controller do
|
||||
describe 'GET #index' do
|
||||
pending
|
||||
it 'returns 200' do
|
||||
get :index
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ProfileController, type: :controller do
|
||||
describe 'GET #show' do
|
||||
pending
|
||||
end
|
||||
|
||||
describe 'GET #entry' do
|
||||
pending
|
||||
end
|
||||
end
|
18
spec/controllers/stream_entries_controller_spec.rb
Normal file
18
spec/controllers/stream_entries_controller_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe StreamEntriesController, type: :controller do
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
let(:status) { Fabricate(:status, account: alice) }
|
||||
|
||||
describe 'GET #show' do
|
||||
it 'returns 200 with HTML' do
|
||||
get :show, account_username: alice.username, id: status.stream_entry.id
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'returns 200 with Atom' do
|
||||
get :show, account_username: alice.username, id: status.stream_entry.id, format: 'atom'
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,10 +2,23 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe XrdController, type: :controller do
|
||||
describe 'GET #host_meta' do
|
||||
pending
|
||||
it 'returns 200' do
|
||||
get :host_meta
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #webfinger' do
|
||||
pending
|
||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||
|
||||
it 'returns 200 when account can be found' do
|
||||
get :webfinger, resource: "acct:#{alice.username}@anything.com"
|
||||
expect(response).to have_http_status(:success)
|
||||
end
|
||||
|
||||
it 'returns 404 when account cannot be found' do
|
||||
get :webfinger, resource: 'acct:not@existing.com'
|
||||
expect(response).to have_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue