hal_spec 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,10 +4,7 @@ module HalSpec
4
4
  def has_valid_content_type?(headers)
5
5
  return false if headers.nil?
6
6
  return false unless headers.include?("Content-Type")
7
- %w(
8
- application/vnd.hal+json
9
- application/hal+json
10
- ).include?(headers["Content-Type"])
7
+ headers["Content-Type"].match /application\/(vnd\.)?hal\+json(;.*)*/
11
8
  end
12
9
  end
13
10
  end
@@ -1,3 +1,3 @@
1
1
  module HalSpec
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -10,6 +10,13 @@ describe HalSpec::Matchers::HaveAValidHalContentType do
10
10
  response.headers.should have_a_valid_hal_content_type
11
11
  end
12
12
 
13
+ it "matches complex hal content types" do
14
+ response = OpenStruct.new(
15
+ headers: {"Content-Type" => "application/vnd.hal+json; charset=utf-8"}
16
+ )
17
+ response.headers.should have_a_valid_hal_content_type
18
+ end
19
+
13
20
  it "doesn't match invalid hal content types" do
14
21
  response = OpenStruct.new(headers: {"Content-Type" => "application/json"})
15
22
  response.headers.should_not have_a_valid_hal_content_type
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hal_spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-14 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: halidator