yaks-html 0.6.0.alpha → 0.6.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -525
- data/Rakefile +1 -41
- data/{yaks-html/lib → lib}/yaks-html.rb +0 -0
- data/{yaks-html/lib → lib}/yaks/format/html.rb +0 -0
- data/{yaks-html/lib → lib}/yaks/format/template.html +0 -0
- data/{yaks-html/spec → spec}/spec_helper.rb +0 -0
- data/{yaks-html/yaks-html.gemspec → yaks-html.gemspec} +1 -1
- metadata +11 -108
- data/.gitignore +0 -7
- data/.travis.yml +0 -36
- data/ADDING_FORMATS.md +0 -13
- data/CHANGELOG.md +0 -149
- data/Gemfile +0 -4
- data/IDENTIFIERS.md +0 -113
- data/LICENSE +0 -7
- data/bench/bench.rb +0 -16
- data/bench/bench_1000.rb +0 -60
- data/notes.org +0 -72
- data/shaved_yak.gif +0 -0
- data/yaks-html/README.md +0 -3
- data/yaks/README.md +0 -526
- data/yaks/lib/yaks.rb +0 -62
- data/yaks/lib/yaks/breaking_changes.rb +0 -49
- data/yaks/lib/yaks/collection_mapper.rb +0 -52
- data/yaks/lib/yaks/collection_resource.rb +0 -73
- data/yaks/lib/yaks/config.rb +0 -65
- data/yaks/lib/yaks/config/dsl.rb +0 -165
- data/yaks/lib/yaks/default_policy.rb +0 -100
- data/yaks/lib/yaks/format.rb +0 -87
- data/yaks/lib/yaks/format/collection_json.rb +0 -42
- data/yaks/lib/yaks/format/hal.rb +0 -82
- data/yaks/lib/yaks/format/json_api.rb +0 -86
- data/yaks/lib/yaks/fp.rb +0 -26
- data/yaks/lib/yaks/fp/callable.rb +0 -9
- data/yaks/lib/yaks/fp/hash_updatable.rb +0 -19
- data/yaks/lib/yaks/fp/updatable.rb +0 -17
- data/yaks/lib/yaks/mapper.rb +0 -75
- data/yaks/lib/yaks/mapper/association.rb +0 -43
- data/yaks/lib/yaks/mapper/association_mapper.rb +0 -42
- data/yaks/lib/yaks/mapper/attribute.rb +0 -17
- data/yaks/lib/yaks/mapper/class_methods.rb +0 -37
- data/yaks/lib/yaks/mapper/config.rb +0 -44
- data/yaks/lib/yaks/mapper/has_many.rb +0 -29
- data/yaks/lib/yaks/mapper/has_one.rb +0 -15
- data/yaks/lib/yaks/mapper/link.rb +0 -91
- data/yaks/lib/yaks/null_resource.rb +0 -40
- data/yaks/lib/yaks/primitivize.rb +0 -45
- data/yaks/lib/yaks/resource.rb +0 -51
- data/yaks/lib/yaks/resource/link.rb +0 -21
- data/yaks/lib/yaks/runner.rb +0 -101
- data/yaks/lib/yaks/util.rb +0 -56
- data/yaks/lib/yaks/version.rb +0 -3
- data/yaks/spec/acceptance/acceptance_spec.rb +0 -48
- data/yaks/spec/acceptance/json_shared_examples.rb +0 -8
- data/yaks/spec/acceptance/models.rb +0 -48
- data/yaks/spec/fixture_helpers.rb +0 -14
- data/yaks/spec/integration/map_to_resource_spec.rb +0 -28
- data/yaks/spec/json/confucius.collection.json +0 -28
- data/yaks/spec/json/confucius.hal.json +0 -59
- data/yaks/spec/json/confucius.json_api.json +0 -51
- data/yaks/spec/json/john.hal.json +0 -29
- data/yaks/spec/json/plant_collection.collection.json +0 -32
- data/yaks/spec/json/plant_collection.hal.json +0 -34
- data/yaks/spec/json/youtypeitwepostit.collection.json +0 -45
- data/yaks/spec/spec_helper.rb +0 -30
- data/yaks/spec/support/classes_for_policy_testing.rb +0 -36
- data/yaks/spec/support/deep_eql.rb +0 -123
- data/yaks/spec/support/fixtures.rb +0 -6
- data/yaks/spec/support/friends_mapper.rb +0 -29
- data/yaks/spec/support/models.rb +0 -23
- data/yaks/spec/support/pet_mapper.rb +0 -3
- data/yaks/spec/support/pet_peeve_mapper.rb +0 -3
- data/yaks/spec/support/shared_contexts.rb +0 -57
- data/yaks/spec/support/youtypeit_models_mappers.rb +0 -20
- data/yaks/spec/unit/yaks/collection_mapper_spec.rb +0 -165
- data/yaks/spec/unit/yaks/collection_resource_spec.rb +0 -77
- data/yaks/spec/unit/yaks/config/dsl_spec.rb +0 -87
- data/yaks/spec/unit/yaks/config_spec.rb +0 -74
- data/yaks/spec/unit/yaks/default_policy/derive_mapper_from_object_spec.rb +0 -80
- data/yaks/spec/unit/yaks/default_policy_spec.rb +0 -70
- data/yaks/spec/unit/yaks/format/collection_json_spec.rb +0 -41
- data/yaks/spec/unit/yaks/format/hal_spec.rb +0 -44
- data/yaks/spec/unit/yaks/format/json_api_spec.rb +0 -42
- data/yaks/spec/unit/yaks/format_spec.rb +0 -37
- data/yaks/spec/unit/yaks/fp/callable_spec.rb +0 -13
- data/yaks/spec/unit/yaks/fp/hash_updatable_spec.rb +0 -22
- data/yaks/spec/unit/yaks/fp/updatable_spec.rb +0 -22
- data/yaks/spec/unit/yaks/fp_spec.rb +0 -31
- data/yaks/spec/unit/yaks/mapper/association_mapper_spec.rb +0 -60
- data/yaks/spec/unit/yaks/mapper/association_spec.rb +0 -135
- data/yaks/spec/unit/yaks/mapper/attribute_spec.rb +0 -20
- data/yaks/spec/unit/yaks/mapper/class_methods_spec.rb +0 -67
- data/yaks/spec/unit/yaks/mapper/config_spec.rb +0 -166
- data/yaks/spec/unit/yaks/mapper/has_many_spec.rb +0 -89
- data/yaks/spec/unit/yaks/mapper/has_one_spec.rb +0 -51
- data/yaks/spec/unit/yaks/mapper/link_spec.rb +0 -196
- data/yaks/spec/unit/yaks/mapper_spec.rb +0 -303
- data/yaks/spec/unit/yaks/null_resource_spec.rb +0 -32
- data/yaks/spec/unit/yaks/primitivize_spec.rb +0 -77
- data/yaks/spec/unit/yaks/resource/link_spec.rb +0 -20
- data/yaks/spec/unit/yaks/resource_spec.rb +0 -108
- data/yaks/spec/unit/yaks/runner_spec.rb +0 -260
- data/yaks/spec/unit/yaks/util_spec.rb +0 -49
- data/yaks/spec/yaml/confucius.yaml +0 -28
- data/yaks/spec/yaml/youtypeitwepostit.yaml +0 -9
- data/yaks/yaks.gemspec +0 -41
@@ -1,59 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"id": 9,
|
3
|
-
"name": "孔子",
|
4
|
-
"pinyin": "Kongzi",
|
5
|
-
"latinized": "Confucius",
|
6
|
-
"_links": {
|
7
|
-
"self": { "href": "http://literature.example.com/authors/kongzi" },
|
8
|
-
"profile": { "href": "http://literature.example.com/profiles/scholar" },
|
9
|
-
"http://literature.example.com/rels/quotes": [
|
10
|
-
{
|
11
|
-
"href": "http://literature.example.com/quotes/?author=kongzi&q={query}",
|
12
|
-
"templated": true,
|
13
|
-
"title": "Search for quotes"
|
14
|
-
}
|
15
|
-
]
|
16
|
-
},
|
17
|
-
"_embedded": {
|
18
|
-
"http://literature.example.com/rel/works": [
|
19
|
-
{
|
20
|
-
"id": 11,
|
21
|
-
"chinese_name": "論語",
|
22
|
-
"english_name": "Analects",
|
23
|
-
"_links": {
|
24
|
-
"self": { "href": "http://literature.example.com/work/11" },
|
25
|
-
"profile": { "href": "http://literature.example.com/profiles/work" }
|
26
|
-
},
|
27
|
-
"_embedded": {
|
28
|
-
"http://literature.example.com/rel/quotes": [
|
29
|
-
{
|
30
|
-
"id": 17,
|
31
|
-
"chinese": "廄焚。子退朝,曰:“傷人乎?” 不問馬。"
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"id": 18,
|
35
|
-
"chinese": "子曰:“其恕乎!己所不欲、勿施於人。”"
|
36
|
-
}
|
37
|
-
],
|
38
|
-
"http://literature.example.com/rel/era": {
|
39
|
-
"id": 99,
|
40
|
-
"name": "Zhou Dynasty"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
},
|
44
|
-
{
|
45
|
-
"id": 12,
|
46
|
-
"chinese_name": "易經",
|
47
|
-
"english_name": "Commentaries to the Yi-jing",
|
48
|
-
"_links": {
|
49
|
-
"self": { "href": "http://literature.example.com/work/12" },
|
50
|
-
"profile": { "href": "http://literature.example.com/profiles/work" }
|
51
|
-
},
|
52
|
-
"_embedded": {
|
53
|
-
"http://literature.example.com/rel/quotes": [],
|
54
|
-
"http://literature.example.com/rel/era": null
|
55
|
-
}
|
56
|
-
}
|
57
|
-
]
|
58
|
-
}
|
59
|
-
}
|
@@ -1,51 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"scholars": [
|
3
|
-
{
|
4
|
-
"id": 9,
|
5
|
-
"href": "http://literature.example.com/authors/kongzi",
|
6
|
-
"name": "孔子",
|
7
|
-
"pinyin": "Kongzi",
|
8
|
-
"latinized": "Confucius",
|
9
|
-
"links": {
|
10
|
-
"works": [11,12]
|
11
|
-
}
|
12
|
-
}
|
13
|
-
],
|
14
|
-
"linked": {
|
15
|
-
"works": [
|
16
|
-
{
|
17
|
-
"id": 11,
|
18
|
-
"href": "http://literature.example.com/work/11",
|
19
|
-
"chinese_name": "論語",
|
20
|
-
"english_name": "Analects",
|
21
|
-
"links": {
|
22
|
-
"quotes": [17, 18],
|
23
|
-
"era": 99
|
24
|
-
}
|
25
|
-
},
|
26
|
-
{
|
27
|
-
"id": 12,
|
28
|
-
"href": "http://literature.example.com/work/12",
|
29
|
-
"chinese_name": "易經",
|
30
|
-
"english_name": "Commentaries to the Yi-jing",
|
31
|
-
"links": {}
|
32
|
-
}
|
33
|
-
],
|
34
|
-
"quotes": [
|
35
|
-
{
|
36
|
-
"id": 17,
|
37
|
-
"chinese": "廄焚。子退朝,曰:“傷人乎?” 不問馬。"
|
38
|
-
},
|
39
|
-
{
|
40
|
-
"id": 18,
|
41
|
-
"chinese": "子曰:“其恕乎!己所不欲、勿施於人。”"
|
42
|
-
}
|
43
|
-
],
|
44
|
-
"erae": [
|
45
|
-
{
|
46
|
-
"id": 99,
|
47
|
-
"name": "Zhou Dynasty"
|
48
|
-
}
|
49
|
-
]
|
50
|
-
}
|
51
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"id": 1,
|
3
|
-
"name": "john",
|
4
|
-
"_links": {
|
5
|
-
"copyright": [
|
6
|
-
{
|
7
|
-
"href": "/api/copyright/2024"
|
8
|
-
}
|
9
|
-
]
|
10
|
-
},
|
11
|
-
"_embedded": {
|
12
|
-
"http://api.mysuperfriends.com/pet_peeve": {
|
13
|
-
"id": 4,
|
14
|
-
"type": "parsing with regexps"
|
15
|
-
},
|
16
|
-
"http://api.mysuperfriends.com/pets": [
|
17
|
-
{
|
18
|
-
"id": 2,
|
19
|
-
"name": "boingboing",
|
20
|
-
"species": "dog"
|
21
|
-
},
|
22
|
-
{
|
23
|
-
"id": 3,
|
24
|
-
"name": "wassup",
|
25
|
-
"species": "cat"
|
26
|
-
}
|
27
|
-
]
|
28
|
-
}
|
29
|
-
}
|
@@ -1,32 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"collection": {
|
3
|
-
"version": "1.0",
|
4
|
-
"href": "http://api.example.com/plants",
|
5
|
-
"items": [
|
6
|
-
{
|
7
|
-
"href": "http://api.example.com/plants/7/plain_grass",
|
8
|
-
"data": [ { "name": "name", "value": "Plain grass" },
|
9
|
-
{ "name": "type", "value": "grass" } ],
|
10
|
-
"links": [
|
11
|
-
{ "rel": "profile", "href": "http://api.example.com/doc/plant" }
|
12
|
-
]
|
13
|
-
},
|
14
|
-
{
|
15
|
-
"href": "http://api.example.com/plants/15/oak",
|
16
|
-
"data": [ { "name": "name", "value": "Oak" },
|
17
|
-
{ "name": "type", "value": "tree" } ],
|
18
|
-
"links": [
|
19
|
-
{ "rel": "profile", "href": "http://api.example.com/doc/plant" }
|
20
|
-
]
|
21
|
-
},
|
22
|
-
{
|
23
|
-
"href": "http://api.example.com/plants/33/passiflora",
|
24
|
-
"data": [ { "name": "name", "value": "Passiflora" },
|
25
|
-
{ "name": "type", "value": "flower" } ],
|
26
|
-
"links": [
|
27
|
-
{ "rel": "profile", "href": "http://api.example.com/doc/plant" }
|
28
|
-
]
|
29
|
-
}
|
30
|
-
]
|
31
|
-
}
|
32
|
-
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_links" : {
|
3
|
-
"profile" : { "href" : "http://api.example.com/doc/plant_collection" },
|
4
|
-
"self" : { "href" : "http://api.example.com/plants" }
|
5
|
-
},
|
6
|
-
"_embedded" : {
|
7
|
-
"http://api.example.com/rels/plants" : [
|
8
|
-
{
|
9
|
-
"_links" : {
|
10
|
-
"profile" : { "href" : "http://api.example.com/doc/plant" },
|
11
|
-
"self" : { "href" : "http://api.example.com/plants/7/plain_grass" }
|
12
|
-
},
|
13
|
-
"name" : "Plain grass",
|
14
|
-
"type" : "grass"
|
15
|
-
},
|
16
|
-
{
|
17
|
-
"_links" : {
|
18
|
-
"profile" : { "href" : "http://api.example.com/doc/plant" },
|
19
|
-
"self" : { "href" : "http://api.example.com/plants/15/oak" }
|
20
|
-
},
|
21
|
-
"name" : "Oak",
|
22
|
-
"type" : "tree"
|
23
|
-
},
|
24
|
-
{
|
25
|
-
"_links" : {
|
26
|
-
"profile" : { "href" : "http://api.example.com/doc/plant" },
|
27
|
-
"self" : { "href" : "http://api.example.com/plants/33/passiflora" }
|
28
|
-
},
|
29
|
-
"name" : "Passiflora",
|
30
|
-
"type" : "flower"
|
31
|
-
}
|
32
|
-
]
|
33
|
-
}
|
34
|
-
}
|
@@ -1,45 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"collection" :
|
3
|
-
{
|
4
|
-
"version" : "1.0",
|
5
|
-
"href" : "http://www.youtypeitwepostit.com/api/",
|
6
|
-
|
7
|
-
"items" :
|
8
|
-
[
|
9
|
-
{
|
10
|
-
"href": "http://www.youtypeitwepostit.com/api/12091295723803341",
|
11
|
-
"data": [
|
12
|
-
{
|
13
|
-
"name": "text",
|
14
|
-
"value": "massage"
|
15
|
-
},
|
16
|
-
{
|
17
|
-
"name": "date_posted",
|
18
|
-
"value": "2014-05-29T07:56:58.035Z"
|
19
|
-
}
|
20
|
-
],
|
21
|
-
"links" :
|
22
|
-
[
|
23
|
-
{ "rel": "profile", "href" : "http://www.youtypeitwepostit.com/profiles/message" }
|
24
|
-
]
|
25
|
-
},
|
26
|
-
{
|
27
|
-
"href": "http://www.youtypeitwepostit.com/api/613856331910938",
|
28
|
-
"data": [
|
29
|
-
{
|
30
|
-
"name": "text",
|
31
|
-
"value": "Squid!"
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"name": "date_posted",
|
35
|
-
"value": "2013-03-28T21:51:08.406Z"
|
36
|
-
}
|
37
|
-
],
|
38
|
-
"links" :
|
39
|
-
[
|
40
|
-
{ "rel": "profile", "href" : "http://www.youtypeitwepostit.com/profiles/message" }
|
41
|
-
]
|
42
|
-
}
|
43
|
-
]
|
44
|
-
}
|
45
|
-
}
|
data/yaks/spec/spec_helper.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'rspec/its'
|
2
|
-
require 'bogus/rspec'
|
3
|
-
|
4
|
-
require 'yaks'
|
5
|
-
require 'virtus'
|
6
|
-
|
7
|
-
require 'fixture_helpers'
|
8
|
-
|
9
|
-
require_relative 'support/models'
|
10
|
-
require_relative 'support/pet_mapper'
|
11
|
-
require_relative 'support/pet_peeve_mapper'
|
12
|
-
require_relative 'support/friends_mapper'
|
13
|
-
require_relative 'support/fixtures'
|
14
|
-
require_relative 'support/shared_contexts'
|
15
|
-
require_relative 'support/youtypeit_models_mappers'
|
16
|
-
require_relative 'support/deep_eql'
|
17
|
-
require_relative 'support/classes_for_policy_testing'
|
18
|
-
|
19
|
-
|
20
|
-
RSpec.configure do |rspec|
|
21
|
-
rspec.include FixtureHelpers
|
22
|
-
rspec.backtrace_exclusion_patterns = [] if ENV['FULLSTACK']
|
23
|
-
rspec.disable_monkey_patching!
|
24
|
-
rspec.raise_errors_for_deprecations!
|
25
|
-
end
|
26
|
-
|
27
|
-
Bogus.configure do |bogus|
|
28
|
-
bogus.search_modules << Yaks
|
29
|
-
bogus.search_modules << Yaks::Mapper
|
30
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
# Used by Yaks::DefaultPolicy* tests to test various name inference schemes
|
2
|
-
|
3
|
-
class SoyMapper ; end
|
4
|
-
class Soy ; end
|
5
|
-
class Wheat ; end
|
6
|
-
|
7
|
-
module MyMappers
|
8
|
-
class SoyMapper ; end
|
9
|
-
end
|
10
|
-
|
11
|
-
class SoyCollectionMapper ; end
|
12
|
-
|
13
|
-
module Namespace
|
14
|
-
module Nested
|
15
|
-
class Rye ; end
|
16
|
-
end
|
17
|
-
|
18
|
-
class RyeMapper ; end
|
19
|
-
class RyeCollectionMapper ; end
|
20
|
-
|
21
|
-
class CollectionMapper ; end
|
22
|
-
|
23
|
-
class ShoeMapper ; end
|
24
|
-
end
|
25
|
-
|
26
|
-
module DislikesCollectionMapper
|
27
|
-
def self.const_get(const)
|
28
|
-
raise "not a NameError" if const.to_s == 'CollectionMapper'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
module DislikesOtherMappers
|
33
|
-
def self.const_get(const)
|
34
|
-
raise "not a NameError" if const.to_s != 'CollectionMapper'
|
35
|
-
end
|
36
|
-
end
|
@@ -1,123 +0,0 @@
|
|
1
|
-
# When comparing deep nested structures, it can be really hard to figure out what
|
2
|
-
# the actual differences are looking at the RSpec output. This custom matcher
|
3
|
-
# traverses nested hashes and arrays recursively, and reports each difference
|
4
|
-
# separately, with a JSONPath string of where the difference was found
|
5
|
-
#
|
6
|
-
# e.g.
|
7
|
-
#
|
8
|
-
# at $.shows[0].venues[0].name, got Foo, expected Bar
|
9
|
-
|
10
|
-
module Matchers
|
11
|
-
class DeepEql
|
12
|
-
extend Forwardable
|
13
|
-
attr_reader :expectation, :stack, :target, :diffs, :result
|
14
|
-
def_delegators :stack, :push, :pop
|
15
|
-
|
16
|
-
def initialize(expectation, stack = [], diffs = [])
|
17
|
-
@expectation = expectation
|
18
|
-
@stack = stack
|
19
|
-
@diffs = diffs
|
20
|
-
@result = true
|
21
|
-
end
|
22
|
-
|
23
|
-
def description
|
24
|
-
'be deeply equal'
|
25
|
-
end
|
26
|
-
|
27
|
-
def recurse(target, expectation)
|
28
|
-
@result &&= DeepEql.new(expectation, stack, diffs).matches?(target)
|
29
|
-
end
|
30
|
-
|
31
|
-
def stack_as_jsonpath
|
32
|
-
'$' + stack.map do |item|
|
33
|
-
case item
|
34
|
-
when Integer, /\W/
|
35
|
-
"[#{item.inspect}]"
|
36
|
-
else
|
37
|
-
".#{item}"
|
38
|
-
end
|
39
|
-
end.join
|
40
|
-
end
|
41
|
-
|
42
|
-
def add_failure_message(message)
|
43
|
-
diffs << "at %s, %s" % [stack_as_jsonpath, message]
|
44
|
-
@result = false
|
45
|
-
end
|
46
|
-
|
47
|
-
def compare(key)
|
48
|
-
push key
|
49
|
-
if target[key] != expectation[key]
|
50
|
-
if [Hash, Array].any?{|klz| target[key].is_a? klz }
|
51
|
-
recurse(target[key], expectation[key])
|
52
|
-
else
|
53
|
-
add_failure_message begin
|
54
|
-
if expectation[key].class == target[key].class
|
55
|
-
"expected #{expectation[key].inspect}, got #{target[key].inspect}"
|
56
|
-
else
|
57
|
-
"expected #{expectation[key].class}: #{expectation[key].inspect}, got #{target[key].class}: #{target[key].inspect}"
|
58
|
-
end
|
59
|
-
rescue Encoding::CompatibilityError
|
60
|
-
"expected #{expectation[key].encoding}, got #{target[key].encoding}"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
pop
|
65
|
-
end
|
66
|
-
|
67
|
-
def matches?(target)
|
68
|
-
@target = target
|
69
|
-
|
70
|
-
case expectation
|
71
|
-
when Hash
|
72
|
-
if target.is_a?(Hash)
|
73
|
-
if target.class != expectation.class # e.g. HashWithIndifferentAccess
|
74
|
-
add_failure_message("expected #{expectation.class}, got #{target.class}")
|
75
|
-
end
|
76
|
-
(expectation.keys - target.keys).each do |key|
|
77
|
-
add_failure_message "Expected key #{key}"
|
78
|
-
end
|
79
|
-
(target.keys - expectation.keys).each do |key|
|
80
|
-
add_failure_message "Unexpected key #{key}"
|
81
|
-
end
|
82
|
-
(target.keys | expectation.keys).each do |key|
|
83
|
-
compare key
|
84
|
-
end
|
85
|
-
else
|
86
|
-
add_failure_message("expected Hash got #{@target.inspect}")
|
87
|
-
end
|
88
|
-
|
89
|
-
when Array
|
90
|
-
if target.is_a?(Array)
|
91
|
-
0.upto([target.count, expectation.count].max) do |idx|
|
92
|
-
compare idx
|
93
|
-
end
|
94
|
-
else
|
95
|
-
add_failure_message("expected Array got #{@target.inspect}")
|
96
|
-
end
|
97
|
-
|
98
|
-
else
|
99
|
-
if target != expectation
|
100
|
-
add_failure_message("expected #{expectation.inspect}, got #{@target.inspect}")
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
result
|
105
|
-
end
|
106
|
-
|
107
|
-
def failure_message_for_should
|
108
|
-
diffs.join("\n")
|
109
|
-
end
|
110
|
-
alias failure_message failure_message_for_should
|
111
|
-
|
112
|
-
def failure_message_for_should_not
|
113
|
-
"expected #{@target.inspect} not to be in deep_eql with #{@expectation.inspect}"
|
114
|
-
end
|
115
|
-
alias failure_message_when_negated failure_message_for_should_not
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
module RSpec::Matchers
|
120
|
-
def deep_eql(exp)
|
121
|
-
Matchers::DeepEql.new(exp)
|
122
|
-
end
|
123
|
-
end
|