about summary refs log tree commit diff
path: root/spec/rails_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rails_helper.rb')
-rw-r--r--spec/rails_helper.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index dc1f32e08..c575128e4 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -50,6 +50,14 @@ RSpec.configure do |config|
     Capybara.app_host = "http#{https ? 's' : ''}://#{ENV.fetch('LOCAL_DOMAIN')}"
   end
 
+  config.before :each, type: :controller do
+    stub_jsonld_contexts!
+  end
+
+  config.before :each, type: :service do
+    stub_jsonld_contexts!
+  end
+
   config.after :each do
     Rails.cache.clear
 
@@ -69,3 +77,9 @@ end
 def attachment_fixture(name)
   File.open(File.join(Rails.root, 'spec', 'fixtures', 'files', name))
 end
+
+def stub_jsonld_contexts!
+  stub_request(:get, 'https://www.w3.org/ns/activitystreams').to_return(request_fixture('json-ld.activitystreams.txt'))
+  stub_request(:get, 'https://w3id.org/identity/v1').to_return(request_fixture('json-ld.identity.txt'))
+  stub_request(:get, 'https://w3id.org/security/v1').to_return(request_fixture('json-ld.security.txt'))
+end