diff options
author | ThibG <thib@sitedethib.com> | 2019-01-11 10:53:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 10:53:58 +0100 |
commit | 2cfa55185a5fc7d93a160a4e9a4730aae6725b0f (patch) | |
tree | c57169b5a3d717f4e68b8ec5d2d6e220d1456434 /spec/helpers | |
parent | d1da0a1086fa25f22739277fbf32ba1b3745317d (diff) | |
parent | 394525e32994e605093c87d3a9fad2a4202f3401 (diff) |
Merge pull request #885 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/jsonld_helper_spec.rb | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/spec/helpers/jsonld_helper_spec.rb b/spec/helpers/jsonld_helper_spec.rb index a5ab249c2..883a88b14 100644 --- a/spec/helpers/jsonld_helper_spec.rb +++ b/spec/helpers/jsonld_helper_spec.rb @@ -22,11 +22,35 @@ describe JsonLdHelper do end describe '#first_of_value' do - pending + context 'value.is_a?(Array)' do + it 'returns value.first' do + value = ['a'] + expect(helper.first_of_value(value)).to be 'a' + end + end + + context '!value.is_a?(Array)' do + it 'returns value' do + value = 'a' + expect(helper.first_of_value(value)).to be 'a' + end + end end describe '#supported_context?' do - pending + context "!json.nil? && equals_or_includes?(json['@context'], ActivityPub::TagManager::CONTEXT)" do + it 'returns true' do + json = { '@context' => ActivityPub::TagManager::CONTEXT }.as_json + expect(helper.supported_context?(json)).to be true + end + end + + context 'else' do + it 'returns false' do + json = nil + expect(helper.supported_context?(json)).to be false + end + end end describe '#fetch_resource' do |