open_graph_reader 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
- RSpec.describe 'valid examples' do
3
+ RSpec.describe "valid examples" do
4
4
  %w(
5
5
  article-offset
6
6
  article-utc
@@ -33,10 +33,11 @@ RSpec.describe 'valid examples' do
33
33
 
34
34
  describe "article" do
35
35
  let(:object) { OpenGraphReader.parse! example_html "article" }
36
+
36
37
  it "parses" do
37
38
  expect {
38
- object
39
- }.to_not raise_error
39
+ object
40
+ }.to_not raise_error
40
41
  end
41
42
 
42
43
  it "allows access to the first tag" do
@@ -68,8 +69,8 @@ RSpec.describe 'valid examples' do
68
69
  describe "errors/book" do
69
70
  it "parses" do
70
71
  expect {
71
- OpenGraphReader.parse! example_html "errors/book"
72
- }.to_not raise_error
72
+ OpenGraphReader.parse! example_html "errors/book"
73
+ }.to_not raise_error
73
74
  end
74
75
  end
75
76
  end
@@ -1,7 +1,7 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  RSpec.describe OpenGraphReader do
4
- let (:invalid_object) { "<head><meta property='og:type' content='foobar' /></head>" }
4
+ let(:invalid_object) { "<head><meta property='og:type' content='foobar' /></head>" }
5
5
 
6
6
  describe "::fetch!" do
7
7
  it "raises if there's no html" do
@@ -15,7 +15,7 @@ RSpec.describe OpenGraphReader do
15
15
  it "raises if there are no tags" do
16
16
  fetcher = double(html?: true, url: "http://example.org", body: "")
17
17
  allow(OpenGraphReader::Fetcher).to receive(:new).and_return(fetcher)
18
- allow(OpenGraphReader::Parser).to receive(:new).and_return(double(has_tags?: false))
18
+ allow(OpenGraphReader::Parser).to receive(:new).and_return(double(any_tags?: false))
19
19
  expect {
20
20
  OpenGraphReader.fetch! "http://example.org"
21
21
  }.to raise_error OpenGraphReader::NoOpenGraphDataError
@@ -43,7 +43,7 @@ RSpec.describe OpenGraphReader do
43
43
  it "does not raise if there are no tags" do
44
44
  fetcher = double(html?: true, url: "http://example.org", body: "")
45
45
  allow(OpenGraphReader::Fetcher).to receive(:new).and_return(fetcher)
46
- allow(OpenGraphReader::Parser).to receive(:new).and_return(double(has_tags?: false))
46
+ allow(OpenGraphReader::Parser).to receive(:new).and_return(double(any_tags?: false))
47
47
 
48
48
  expect {
49
49
  OpenGraphReader.fetch "http://example.org"
@@ -62,7 +62,7 @@ RSpec.describe OpenGraphReader do
62
62
 
63
63
  describe "::parse!" do
64
64
  it "raises if there are no tags" do
65
- allow(OpenGraphReader::Parser).to receive(:new).and_return(double(has_tags?: false))
65
+ allow(OpenGraphReader::Parser).to receive(:new).and_return(double(any_tags?: false))
66
66
 
67
67
  expect {
68
68
  OpenGraphReader.parse! ""
@@ -78,7 +78,7 @@ RSpec.describe OpenGraphReader do
78
78
 
79
79
  describe "::parse" do
80
80
  it "does not raise if there are no tags" do
81
- allow(OpenGraphReader::Parser).to receive(:new).and_return(double(has_tags?: false))
81
+ allow(OpenGraphReader::Parser).to receive(:new).and_return(double(any_tags?: false))
82
82
 
83
83
  expect {
84
84
  OpenGraphReader.parse ""
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
- require 'bundler/setup'
2
- require 'webmock/rspec'
1
+ require "bundler/setup"
2
+ require "webmock/rspec"
3
3
 
4
- require 'open_graph_reader'
4
+ require "open_graph_reader"
5
5
 
6
6
  RSpec.configure do |config|
7
7
  config.expect_with :rspec do |expectations|
@@ -17,11 +17,9 @@ RSpec.configure do |config|
17
17
 
18
18
  config.disable_monkey_patching!
19
19
 
20
- config.warnings = true if ENV['TRAVIS']
20
+ config.warnings = true if ENV["TRAVIS"]
21
21
 
22
- if config.files_to_run.one?
23
- config.default_formatter = 'doc'
24
- end
22
+ config.default_formatter = "doc" if config.files_to_run.one?
25
23
 
26
24
  config.profile_examples = 10
27
25
 
@@ -33,7 +31,6 @@ RSpec.configure do |config|
33
31
  end
34
32
  end
35
33
 
36
-
37
34
  def example_html example
38
35
  fixture_html "examples/#{example}"
39
36
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: open_graph_reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonne Haß
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-14 00:00:00.000000000 Z
11
+ date: 2015-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -167,6 +167,8 @@ files:
167
167
  - spec/fixtures/examples/video.html
168
168
  - spec/fixtures/real_world/image_path.html
169
169
  - spec/fixtures/real_world/image_path_2.html
170
+ - spec/fixtures/real_world/invalid_article_author.html
171
+ - spec/fixtures/real_world/invalid_datetime.html
170
172
  - spec/fixtures/real_world/missing_image.html
171
173
  - spec/fixtures/real_world/missing_title.html
172
174
  - spec/fixtures/real_world/mixed_case_properties.html
@@ -176,6 +178,7 @@ files:
176
178
  - spec/fixtures/real_world/undefined_property_2.html
177
179
  - spec/fixtures/real_world/unknown_namespace.html
178
180
  - spec/fixtures/real_world/unknown_type.html
181
+ - spec/fixtures/real_world/url_path.html
179
182
  - spec/integration/invalid_examples_spec.rb
180
183
  - spec/integration/real_world_spec.rb
181
184
  - spec/integration/valid_examples_spec.rb
@@ -201,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
204
  version: '0'
202
205
  requirements: []
203
206
  rubyforge_project:
204
- rubygems_version: 2.4.1
207
+ rubygems_version: 2.4.5
205
208
  signing_key:
206
209
  specification_version: 4
207
210
  summary: OpenGraph protocol parser
@@ -255,6 +258,8 @@ test_files:
255
258
  - spec/fixtures/examples/video.html
256
259
  - spec/fixtures/real_world/image_path.html
257
260
  - spec/fixtures/real_world/image_path_2.html
261
+ - spec/fixtures/real_world/invalid_article_author.html
262
+ - spec/fixtures/real_world/invalid_datetime.html
258
263
  - spec/fixtures/real_world/missing_image.html
259
264
  - spec/fixtures/real_world/missing_title.html
260
265
  - spec/fixtures/real_world/mixed_case_properties.html
@@ -264,6 +269,7 @@ test_files:
264
269
  - spec/fixtures/real_world/undefined_property_2.html
265
270
  - spec/fixtures/real_world/unknown_namespace.html
266
271
  - spec/fixtures/real_world/unknown_type.html
272
+ - spec/fixtures/real_world/url_path.html
267
273
  - spec/integration/invalid_examples_spec.rb
268
274
  - spec/integration/real_world_spec.rb
269
275
  - spec/integration/valid_examples_spec.rb