diff options
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/accounts_controller_spec.rb | 17 | ||||
-rw-r--r-- | spec/controllers/api/salmon_controller_spec.rb | 7 | ||||
-rw-r--r-- | spec/controllers/api/subscriptions_controller_spec.rb | 11 | ||||
-rw-r--r-- | spec/controllers/atom_controller_spec.rb | 11 | ||||
-rw-r--r-- | spec/controllers/home_controller_spec.rb | 5 | ||||
-rw-r--r-- | spec/controllers/profile_controller_spec.rb | 11 | ||||
-rw-r--r-- | spec/controllers/stream_entries_controller_spec.rb | 18 | ||||
-rw-r--r-- | spec/controllers/xrd_controller_spec.rb | 17 |
8 files changed, 72 insertions, 25 deletions
diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb new file mode 100644 index 000000000..b1646b314 --- /dev/null +++ b/spec/controllers/accounts_controller_spec.rb @@ -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 diff --git a/spec/controllers/api/salmon_controller_spec.rb b/spec/controllers/api/salmon_controller_spec.rb new file mode 100644 index 000000000..e81ad12ad --- /dev/null +++ b/spec/controllers/api/salmon_controller_spec.rb @@ -0,0 +1,7 @@ +require 'rails_helper' + +RSpec.describe Api::SalmonController, type: :controller do + describe 'POST #update' do + pending + end +end diff --git a/spec/controllers/api/subscriptions_controller_spec.rb b/spec/controllers/api/subscriptions_controller_spec.rb new file mode 100644 index 000000000..16995c687 --- /dev/null +++ b/spec/controllers/api/subscriptions_controller_spec.rb @@ -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 diff --git a/spec/controllers/atom_controller_spec.rb b/spec/controllers/atom_controller_spec.rb deleted file mode 100644 index 6f04ad347..000000000 --- a/spec/controllers/atom_controller_spec.rb +++ /dev/null @@ -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 diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index e609ab6be..7eaa43df7 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -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 diff --git a/spec/controllers/profile_controller_spec.rb b/spec/controllers/profile_controller_spec.rb deleted file mode 100644 index e4d124e29..000000000 --- a/spec/controllers/profile_controller_spec.rb +++ /dev/null @@ -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 diff --git a/spec/controllers/stream_entries_controller_spec.rb b/spec/controllers/stream_entries_controller_spec.rb new file mode 100644 index 000000000..5fa3195eb --- /dev/null +++ b/spec/controllers/stream_entries_controller_spec.rb @@ -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 diff --git a/spec/controllers/xrd_controller_spec.rb b/spec/controllers/xrd_controller_spec.rb index 669c02c40..a74b5c143 100644 --- a/spec/controllers/xrd_controller_spec.rb +++ b/spec/controllers/xrd_controller_spec.rb @@ -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 |