about summary refs log tree commit diff
path: root/spec/controllers/disputes/strikes_controller_spec.rb
diff options
context:
space:
mode:
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