diff options
author | pluralcafe-docker <git@plural.cafe> | 2018-12-17 01:28:17 +0000 |
---|---|---|
committer | pluralcafe-docker <git@plural.cafe> | 2018-12-17 01:28:17 +0000 |
commit | f290c5e2c337bb0aab82cb23653d4ff084ba8bbe (patch) | |
tree | 65712093ee4852a04fab5160cea341cb80f91747 /spec/controllers/remote_interaction_controller_spec.rb | |
parent | 87f09d3bebd2d890ecad19d360fc687f1a57f3b0 (diff) | |
parent | 396c5dea87f259255f3676bb7b30f5cfdfec9d4e (diff) |
Merge branch 'glitch'
Diffstat (limited to 'spec/controllers/remote_interaction_controller_spec.rb')
-rw-r--r-- | spec/controllers/remote_interaction_controller_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/controllers/remote_interaction_controller_spec.rb b/spec/controllers/remote_interaction_controller_spec.rb new file mode 100644 index 000000000..bb0074b11 --- /dev/null +++ b/spec/controllers/remote_interaction_controller_spec.rb @@ -0,0 +1,39 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe RemoteInteractionController, type: :controller do + render_views + + let(:status) { Fabricate(:status) } + + describe 'GET #new' do + it 'returns 200' do + get :new, params: { id: status.id } + expect(response).to have_http_status(200) + end + end + + describe 'POST #create' do + context '@remote_follow is valid' do + it 'returns 302' do + allow_any_instance_of(RemoteFollow).to receive(:valid?) { true } + allow_any_instance_of(RemoteFollow).to receive(:addressable_template) do + Addressable::Template.new('https://hoge.com') + end + + post :create, params: { id: status.id, remote_follow: { acct: '@hoge' } } + expect(response).to have_http_status(302) + end + end + + context '@remote_follow is invalid' do + it 'returns 200' do + allow_any_instance_of(RemoteFollow).to receive(:valid?) { false } + post :create, params: { id: status.id, remote_follow: { acct: '@hoge' } } + + expect(response).to have_http_status(200) + end + end + end +end |