about summary refs log tree commit diff
path: root/spec/helpers
diff options
context:
space:
mode:
authorbeatrix <beatrix.bitrot@gmail.com>2017-09-09 20:11:48 -0400
committerGitHub <noreply@github.com>2017-09-09 20:11:48 -0400
commit3dff74eecf5387b92b862893248710d2efb90eec (patch)
tree0d29d8c952a0c62e7de4348a1d63963fd5eca237 /spec/helpers
parente18ed4bbc7ab4e258d05a3e2a5db0790f67a8f37 (diff)
parent14e1fb8d36763e5255e7b8e440ecaf02208db004 (diff)
Merge pull request #141 from yipdw/sync/upstream
Sync with upstream @ v1.6.0rc3

ohhhhhhhhhhh heck here we go
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/jsonld_helper_spec.rb35
-rw-r--r--spec/helpers/routing_helper_spec.rb43
2 files changed, 78 insertions, 0 deletions
diff --git a/spec/helpers/jsonld_helper_spec.rb b/spec/helpers/jsonld_helper_spec.rb
new file mode 100644
index 000000000..7d3912e6c
--- /dev/null
+++ b/spec/helpers/jsonld_helper_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+describe JsonLdHelper do
+  describe '#equals_or_includes?' do
+    it 'returns true when value equals' do
+      expect(helper.equals_or_includes?('foo', 'foo')).to be true
+    end
+
+    it 'returns false when value does not equal' do
+      expect(helper.equals_or_includes?('foo', 'bar')).to be false
+    end
+
+    it 'returns true when value is included' do
+      expect(helper.equals_or_includes?(%w(foo baz), 'foo')).to be true
+    end
+
+    it 'returns false when value is not included' do
+      expect(helper.equals_or_includes?(%w(foo baz), 'bar')).to be false
+    end
+  end
+
+  describe '#first_of_value' do
+    pending
+  end
+
+  describe '#supported_context?' do
+    pending
+  end
+
+  describe '#fetch_resource' do
+    pending
+  end
+end
diff --git a/spec/helpers/routing_helper_spec.rb b/spec/helpers/routing_helper_spec.rb
new file mode 100644
index 000000000..940392c9b
--- /dev/null
+++ b/spec/helpers/routing_helper_spec.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+RSpec.describe RoutingHelper, type: :helper do
+  describe '.full_asset_url' do
+    around do |example|
+      use_s3 = Rails.configuration.x.use_s3
+      example.run
+      Rails.configuration.x.use_s3 = use_s3
+    end
+
+    shared_examples 'returns full path URL' do
+      it 'with host' do
+        url = helper.full_asset_url('https://example.com/avatars/000/000/002/original/icon.png')
+
+        expect(url).to eq 'https://example.com/avatars/000/000/002/original/icon.png'
+      end
+
+      it 'without host' do
+        url = helper.full_asset_url('/avatars/original/missing.png', skip_pipeline: true)
+
+        expect(url).to eq 'http://test.host/avatars/original/missing.png'
+      end
+    end
+
+    context 'Do not use S3' do
+      before do
+        Rails.configuration.x.use_s3 = false
+      end
+
+      it_behaves_like 'returns full path URL'
+    end
+
+    context 'Use S3' do
+      before do
+        Rails.configuration.x.use_s3 = true
+      end
+
+      it_behaves_like 'returns full path URL'
+    end
+  end
+end