about summary refs log tree commit diff
path: root/spec/controllers/disputes/strikes_controller_spec.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-17 22:31:21 +0100
committerGitHub <noreply@github.com>2022-02-17 22:31:21 +0100
commitc8ef003c6b40e9b7212f43f1b5706b0967fcfe8a (patch)
tree7ab6dc75943d22b27df0ac411483b34f79e72211 /spec/controllers/disputes/strikes_controller_spec.rb
parentec4f9066189fbab4368a275e9cd654dc7ad48217 (diff)
parent41a8606627216e8ed32fb562d245327e5985ba2d (diff)
Merge pull request #1692 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/controllers/disputes/strikes_controller_spec.rb')
-rw-r--r--spec/controllers/disputes/strikes_controller_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/controllers/disputes/strikes_controller_spec.rb b/spec/controllers/disputes/strikes_controller_spec.rb
new file mode 100644
index 000000000..157f9ec3c
--- /dev/null
+++ b/spec/controllers/disputes/strikes_controller_spec.rb
@@ -0,0 +1,30 @@
+require 'rails_helper'
+
+RSpec.describe Disputes::StrikesController, type: :controller do
+  render_views
+
+  before { sign_in current_user, scope: :user }
+
+  describe '#show' do
+    let(:current_user) { Fabricate(:user) }
+    let(:strike) { Fabricate(:account_warning, target_account: current_user.account) }
+
+    before do
+      get :show, params: { id: strike.id }
+    end
+
+    context 'when meant for the user' do
+      it 'returns http success' do
+        expect(response).to have_http_status(:success)
+      end
+    end
+
+    context 'when meant for a different user' do
+      let(:strike) { Fabricate(:account_warning) }
+
+      it 'returns http forbidden' do
+        expect(response).to have_http_status(:forbidden)
+      end
+    end
+  end
+end