pragmatic_context 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7c1851a206e8b77ffbaaae7c8fd88ab89c3e5fe
|
4
|
+
data.tar.gz: 824579bd6aeda691cd918acb53f5690c47d31b60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11801a92e11a66751f968cc97322f6f56fee0695c92c1b3618e7b81bb8f1a2694546ba664f0b11d0ac369d7c1c76777a8aae2bd05289ea060fae3db09a6ee80e
|
7
|
+
data.tar.gz: 91fdf01fe732d12623c74246b17d8cdd5961fd09effd0487166167ced7ae235b08025507186b502a8993bb43c21ea44b6d518f82eb0196b05bbbb6fa11416b83
|
data/pragmatic_context.gemspec
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'pragmatic_context'
|
2
|
+
require 'active_model'
|
2
3
|
|
3
4
|
class Stub
|
5
|
+
include ActiveModel::Serializers::JSON
|
4
6
|
include PragmaticContext::Contextualizable
|
5
7
|
|
6
8
|
attr_accessor :bacon
|
@@ -54,6 +56,16 @@ describe PragmaticContext::Contextualizable do
|
|
54
56
|
subject.class.contextualize_with contextualizer_class
|
55
57
|
end
|
56
58
|
|
59
|
+
describe 'as_jsonld' do
|
60
|
+
it 'should respond with the underlying as_json result plus the context' do
|
61
|
+
@contextualizer.stub(:definitions_for_terms) do |terms|
|
62
|
+
{ 'bacon' => { "@id" => "http://bacon.yum" } }.slice(*terms)
|
63
|
+
end
|
64
|
+
subject.bacon = 'crispy'
|
65
|
+
subject.as_jsonld.should == subject.as_json.merge("@context" => subject.context)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
57
69
|
describe 'context' do
|
58
70
|
it 'should properly marshall together term definitions with the appropriate terms' do
|
59
71
|
@contextualizer.stub(:definitions_for_terms) do |terms|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pragmatic_context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mat Trudel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activemodel
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: A library to declaratively add JSON-LD support to your ActiveModel models
|
70
84
|
email:
|
71
85
|
- mat@geeky.net
|