diff options
Diffstat (limited to 'spec/controllers/api/web/embeds_controller_spec.rb')
-rw-r--r-- | spec/controllers/api/web/embeds_controller_spec.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/spec/controllers/api/web/embeds_controller_spec.rb b/spec/controllers/api/web/embeds_controller_spec.rb index a8fc1718f..e03f5a371 100644 --- a/spec/controllers/api/web/embeds_controller_spec.rb +++ b/spec/controllers/api/web/embeds_controller_spec.rb @@ -6,10 +6,12 @@ describe Api::Web::EmbedsController do render_views let(:user) { Fabricate(:user) } + before { sign_in user } describe 'POST #create' do subject(:response) { post :create, params: { url: url } } + subject(:body) { JSON.parse(response.body, symbolize_names: true) } context 'when successfully finds status' do @@ -17,7 +19,7 @@ describe Api::Web::EmbedsController do let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" } it 'returns a right response' do - expect(response).to have_http_status :ok + expect(response).to have_http_status 200 expect(body[:author_name]).to eq status.account.username end end @@ -35,7 +37,7 @@ describe Api::Web::EmbedsController do let(:call_result) { { result: :ok } } it 'returns a right response' do - expect(response).to have_http_status :ok + expect(response).to have_http_status 200 expect(body[:result]).to eq 'ok' end end @@ -44,7 +46,7 @@ describe Api::Web::EmbedsController do let(:call_result) { nil } it 'returns a right response' do - expect(response).to have_http_status :not_found + expect(response).to have_http_status 404 end end end |