rspec-hal 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5db7232aae0766a25700b98a53d8c343c0eb8f91
4
- data.tar.gz: 560a463c6967e2c0f060aec76c688d007cf08756
3
+ metadata.gz: 1350f30e17586dd2a1519b0ccf17b97061c7e6de
4
+ data.tar.gz: 273bc7a271b118ee026ddad7653c7b504f4558ea
5
5
  SHA512:
6
- metadata.gz: dfe7e6f2a41a4dce154256da82f2789d40db8509e5be62f7658a9db46ec97a3bdfdaa25e88669300158008dddb4aa1b320b0bae52aac65975646c02e11841231
7
- data.tar.gz: f48fead8ad5405d19646fe6c01b5d07518978f475f6683089d8ce0a65e09b46ba41d4246cb4244a9aa2bcdd1a2e2d0aa6953990a64ae18a7aae61c94b78868f0
6
+ metadata.gz: cbb1e494d0e157695a5bda7154e5c3cd5819a3b9207ff61b2eb265291510846a317cb7b05d212bd415e91fa2b96bb8ebc4774c73a775ca5ead8cda5518b1aaf0
7
+ data.tar.gz: 7c25b64edee190f075d92703d488d8421b4fe51dd47e67b32ec5139a37407ce1b650a7e864ccd6da6488bdbc65d18c44e2d982c7bce345e43bf8f1204a990da3
data/.travis.yml CHANGED
@@ -1,6 +1,19 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
4
- - "2.0.0"
5
- - "2.1.1"
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.1
6
6
  - jruby-19mode # JRuby in 1.9 mode
7
+
8
+ gemfile:
9
+ - gemfiles/rspec2_14.gemfile
10
+ - gemfiles/rspec3_0.gemfile
11
+
12
+ matrix:
13
+ exclude:
14
+ - rvm: 1.9.3
15
+ gemfile: gemfiles/rspec3_0.gemfile
16
+ - rvm: 2.0.0
17
+ gemfile: gemfiles/rspec3_0.gemfile
18
+ - rvm: jruby-19mode
19
+ gemfile: gemfiles/rspec3_0.gemfile
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rspec", "~>2.14"
4
+
5
+ # Specify your gem's dependencies in rspec-hal.gemspec
6
+ gemspec path: ".."
7
+
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "rspec", "~>3.0.0.beta"
4
+
5
+ # Specify your gem's dependencies in rspec-hal.gemspec
6
+ gemspec path: ".."
7
+
@@ -14,6 +14,11 @@ module RSpec
14
14
  end
15
15
  end.new
16
16
 
17
+ def repr=(jsonish)
18
+ @repr = parse jsonish
19
+ end
20
+ attr_reader :repr
21
+
17
22
  # Returns string composed of the specified clauses with proper
18
23
  # spacing between them. Empty and nil clauses are ignored.
19
24
  def sentencize(*clauses)
@@ -16,21 +16,25 @@ module RSpec
16
16
  end
17
17
 
18
18
  def matches?(jsonish)
19
- repr = parse(jsonish)
19
+ self.repr = jsonish
20
20
 
21
21
  repr.raw_related_hrefs(link_rel){[]}
22
+ .tap{|it| if it.none?
23
+ @outcome = :no_relations
24
+ return false
25
+ end }
22
26
  .select{|it| it.respond_to? :expand}
23
- .select{|it| expected === it }
24
- .any?
25
- .tap do |outcome|
26
- @outcome = if outcome
27
- :pass
28
- elsif repr.raw_related_hrefs(link_rel){[]}.any?
29
- :no_templates
30
- else
31
- :no_relations
32
- end
33
- end
27
+ .tap{|it| if it.none?
28
+ @outcome = :no_templates
29
+ return false
30
+ end }
31
+ .select{|it| expected === it.pattern }
32
+ .tap{|it| if it.none?
33
+ @outcome = :none_matched
34
+ return false
35
+ end }
36
+
37
+ true
34
38
  end
35
39
 
36
40
  def failure_message
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Hal
3
- VERSION = "1.2.1"
3
+ VERSION = "1.2.2"
4
4
  end
5
5
  end
@@ -54,13 +54,13 @@ describe RSpec::Hal::Matchers::TemplatedRelationMatcher do
54
54
  end
55
55
 
56
56
  context "failed due to sub-matcher failure matcher" do
57
- subject(:matcher) { described_class.new(a_link_rel, match("absent")) }
57
+ subject(:matcher) { described_class.new(a_link_rel, match(/absent/)) }
58
58
  before do
59
- matcher.matches? json_str_wo_link
59
+ matcher.matches? json_str_w_link
60
60
  end
61
61
 
62
62
  specify { expect(matcher.failure_message)
63
- .to match %r(Expected templated `#{a_link_rel}` link match(?:ing)? "absent" but found none) }
63
+ .to match %r(Expected templated `#{a_link_rel}` link match(?:ing)? /absent/ but found none) }
64
64
  end
65
65
 
66
66
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-hal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Williams
@@ -85,6 +85,8 @@ files:
85
85
  - LICENSE.txt
86
86
  - README.md
87
87
  - Rakefile
88
+ - gemfiles/rspec2_14.gemfile
89
+ - gemfiles/rspec3_0.gemfile
88
90
  - lib/rspec-hal.rb
89
91
  - lib/rspec/hal.rb
90
92
  - lib/rspec/hal/matchers.rb