summaryrefslogtreecommitdiff
path: root/spec/support/legacy_path_redirect_shared_examples.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/legacy_path_redirect_shared_examples.rb')
-rw-r--r--spec/support/legacy_path_redirect_shared_examples.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/legacy_path_redirect_shared_examples.rb b/spec/support/legacy_path_redirect_shared_examples.rb
new file mode 100644
index 00000000000..f300bdd48b1
--- /dev/null
+++ b/spec/support/legacy_path_redirect_shared_examples.rb
@@ -0,0 +1,13 @@
+shared_examples 'redirecting a legacy path' do |source, target|
+ include RSpec::Rails::RequestExampleGroup
+
+ it "redirects #{source} to #{target} when the resource does not exist" do
+ expect(get(source)).to redirect_to(target)
+ end
+
+ it "does not redirect #{source} to #{target} when the resource exists" do
+ resource
+
+ expect(get(source)).not_to redirect_to(target)
+ end
+end