hotchoc 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-gemset +1 -0
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +9 -0
  5. data/LICENSE.md +1 -1
  6. data/README.md +3 -2
  7. data/Rakefile +3 -8
  8. data/hotchoc.gemspec +5 -4
  9. data/lib/hotchoc/client/api.rb +21 -0
  10. data/lib/hotchoc/client/configuration.rb +37 -0
  11. data/lib/hotchoc/client/errors.rb +12 -0
  12. data/lib/hotchoc/client/fetcher.rb +44 -0
  13. data/lib/hotchoc/client/version.rb +5 -0
  14. data/lib/hotchoc/client.rb +4 -4
  15. data/lib/hotchoc/presenters/album.rb +0 -4
  16. data/lib/hotchoc/presenters/base.rb +0 -4
  17. data/lib/hotchoc/presenters/blocks/base.rb +0 -4
  18. data/lib/hotchoc/presenters/blocks/image.rb +0 -4
  19. data/lib/hotchoc/presenters/blocks/text.rb +0 -4
  20. data/lib/hotchoc/presenters/file.rb +1 -5
  21. data/lib/hotchoc/presenters/page.rb +0 -4
  22. data/lib/hotchoc/presenters/post.rb +0 -4
  23. data/lib/hotchoc/presenters/thumbnail.rb +0 -4
  24. data/lib/hotchoc/presenters/topic.rb +0 -4
  25. data/lib/hotchoc.rb +6 -6
  26. data/spec/hotchoc/{api_spec.rb → client/api_spec.rb} +7 -12
  27. data/spec/hotchoc/client/configuration_spec.rb +15 -0
  28. data/spec/hotchoc/{main_spec.rb → client/main_spec.rb} +1 -2
  29. data/spec/hotchoc/client_spec.rb +1 -2
  30. data/spec/hotchoc/presenters/album_spec.rb +0 -2
  31. data/spec/hotchoc/presenters/blocks/image_spec.rb +0 -2
  32. data/spec/hotchoc/presenters/blocks/text_spec.rb +0 -2
  33. data/spec/hotchoc/presenters/file_spec.rb +0 -2
  34. data/spec/hotchoc/presenters/page_spec.rb +0 -2
  35. data/spec/hotchoc/presenters/post_spec.rb +0 -2
  36. data/spec/hotchoc/presenters/thumbnail_spec.rb +0 -2
  37. data/spec/hotchoc/presenters/topic_spec.rb +0 -2
  38. data/spec/support/stubs.rb +0 -2
  39. metadata +31 -30
  40. data/.rubocop.yml +0 -558
  41. data/lib/hotchoc/api.rb +0 -21
  42. data/lib/hotchoc/configuration.rb +0 -36
  43. data/lib/hotchoc/errors.rb +0 -12
  44. data/lib/hotchoc/fetcher.rb +0 -35
  45. data/lib/hotchoc/version.rb +0 -3
  46. data/spec/hotchoc/configuration_spec.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6755f8467bd572a215a91f2e359ed6bf044b256d
4
- data.tar.gz: 4a36c9752a34f42825a92413cac48e332f4d721f
3
+ metadata.gz: c9e5cbbe0a4ac84c3a34276088b1ee8f99bdb4d6
4
+ data.tar.gz: 23957659ecc09f31f748b56b3117316ba7d9d22f
5
5
  SHA512:
6
- metadata.gz: ab36bffd5983e96eb34ea1b49243bce98cb4e624e537456a403cadf0d8b0488f829b8d63a3dd2bf44b225d54d16bcf0dbe184b51890cc1c47c6fdc0a1032eedb
7
- data.tar.gz: e21c2248d0665fbd209833e2d249ca64c9dfb338173a334f7bdba9253ebc0b21eec4b9d81e9d7a08713743a668018d34da2c7f8a6013b61ecb8697a265df171d
6
+ metadata.gz: 56bace741611ecb19ef9e10ca7e5120c61936b257bdbd07271599887ccda5ddcbc05722f19ea96e8e00b6e03382e97b0ae62fac72be74ea458d7917a0a4ed4c8
7
+ data.tar.gz: f57a0c75eee90516efc980ec3eef3bfb034216011f456083b7c19e49147f938f4bb51743c9f9f1531109f10ab246ce6169490241fb12e10edb1b5de2d8c436af
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ hotchoc
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  ## Master
4
4
 
5
+ ## 0.3.0
6
+
7
+ [Full changelog](https://github.com/choc/hotchoc-ruby/compare/v0.2.1...v0.3.0)
8
+
9
+ Changes:
10
+
11
+ * Internal code reorganisation
12
+ * Switched from Typhoeus to HTTParty
13
+
5
14
  ## 0.2.1
6
15
 
7
16
  [Full changelog](https://github.com/choc/hotchoc-ruby/compare/v0.2.0...v0.2.1)
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 Matthias Siegel
1
+ Copyright (c) 2014-2015 Matthias Siegel
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
- # hotchoc-ruby
1
+ # hotchoc
2
2
 
3
3
  Ruby wrapper for the Hotchoc API (in private beta).
4
4
 
5
+ [![Codeship Status for choc/hotchoc-ruby](https://codeship.com/projects/954557c0-e9a3-0132-ab76-56071da69c74/status?branch=master)](https://codeship.com/projects/82979)
5
6
  [![Gem Version](https://badge.fury.io/rb/hotchoc.svg)](http://badge.fury.io/rb/hotchoc)
6
- [![Code Climate](https://codeclimate.com/github/choc/hotchoc-ruby.png)](https://codeclimate.com/github/choc/hotchoc-ruby)
7
+ [![Code Climate](https://codeclimate.com/github/choc/hotchoc/badges/gpa.svg)](https://codeclimate.com/github/choc/hotchoc)
7
8
 
8
9
  ## Installation
9
10
 
data/Rakefile CHANGED
@@ -1,9 +1,4 @@
1
- require "bundler/gem_tasks"
2
- require "rubocop/rake_task"
1
+ require 'bundler/gem_tasks'
3
2
 
4
- desc 'Run RuboCop checks'
5
- RuboCop::RakeTask.new(:rubocop) do |task|
6
- task.patterns = ['{lib,spec}/**/*.rb']
7
- task.formatters = ['progress']
8
- task.fail_on_error = true
9
- end
3
+ spec = Gem::Specification.find_by_name('lint')
4
+ load "#{spec.gem_dir}/lib/tasks/lint.rake"
data/hotchoc.gemspec CHANGED
@@ -1,10 +1,11 @@
1
1
  lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'hotchoc/version'
3
+
4
+ require 'hotchoc/client/version'
4
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = 'hotchoc'
7
- spec.version = Hotchoc::VERSION
8
+ spec.version = Hotchoc::Client::VERSION
8
9
  spec.authors = ['Matthias Siegel']
9
10
  spec.email = ['matthias.siegel@gmail.com']
10
11
  spec.summary = %q{Ruby wrapper for the Hotchoc API.}
@@ -16,13 +17,13 @@ Gem::Specification.new do |spec|
16
17
  spec.test_files = spec.files.grep(%r{^(spec)/})
17
18
  spec.require_paths = ['lib']
18
19
 
19
- spec.add_dependency 'typhoeus', '~> 0.7.0'
20
+ spec.add_dependency 'httparty', '~> 0.13'
20
21
 
21
22
  spec.add_development_dependency 'binding_of_caller', '~> 0.7.2'
22
23
  spec.add_development_dependency 'bundler', '~> 1.7'
24
+ spec.add_development_dependency 'lint', '~> 0.3'
23
25
  spec.add_development_dependency 'pry', '~> 0.10.1'
24
26
  spec.add_development_dependency 'rake', '~> 10.4'
25
27
  spec.add_development_dependency 'rspec', '~> 3.2'
26
- spec.add_development_dependency 'rubocop', '~> 0.24.1'
27
28
  spec.add_development_dependency 'webmock', '~> 1.20'
28
29
  end
@@ -0,0 +1,21 @@
1
+ module Hotchoc
2
+ class Client
3
+ module API
4
+ def get_albums(opts = {})
5
+ get('albums', opts)['albums'].map { |album| Hotchoc::Presenters::Album.new(album) }
6
+ end
7
+
8
+ def get_pages(opts = {})
9
+ get('pages', opts)['pages'].map { |page| Hotchoc::Presenters::Page.new(page) }
10
+ end
11
+
12
+ def get_posts(opts = {})
13
+ get('posts', opts)['posts'].map { |post| Hotchoc::Presenters::Post.new(post) }
14
+ end
15
+
16
+ def get_topics(opts = {})
17
+ get('topics', opts)['topics'].map { |topic| Hotchoc::Presenters::Topic.new(topic) }
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,37 @@
1
+ module Hotchoc
2
+ class Client
3
+ module Configuration
4
+ VALID_CONFIG_KEYS = [:api_key, :site, :hostname, :verify].freeze
5
+
6
+ DEFAULT_API_KEY = nil
7
+ DEFAULT_SITE = nil
8
+ DEFAULT_HOSTNAME = 'hotchoc.io'
9
+ DEFAULT_VERIFY = true
10
+
11
+ #
12
+ # Build accessor methods for every config options so we can do this, for example:
13
+ #
14
+ # Hotchoc.site = 'mattdownunder'
15
+ #
16
+ attr_accessor(*VALID_CONFIG_KEYS)
17
+
18
+ #
19
+ # Make sure we have the default values set when we get 'extended'
20
+ #
21
+ def self.extended(base)
22
+ base.reset
23
+ end
24
+
25
+ def reset
26
+ self.api_key = DEFAULT_API_KEY
27
+ self.site = DEFAULT_SITE
28
+ self.hostname = DEFAULT_HOSTNAME
29
+ self.verify = DEFAULT_VERIFY
30
+ end
31
+
32
+ def options
33
+ Hash[*VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten]
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,12 @@
1
+ module Hotchoc
2
+ class Client
3
+ module Errors
4
+ # Base error class for all custom errors
5
+ class HotchocError < StandardError
6
+ end
7
+
8
+ class RequestError < HotchocError
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,44 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ module Hotchoc
5
+ class Client
6
+ class Fetcher
7
+ DEFAULT_OPTIONS = {
8
+ headers: {
9
+ 'Accept' => 'application/json',
10
+ 'Accept-Encoding' => 'gzip',
11
+ 'User-Agent' => "Hotchoc Ruby client #{Hotchoc::Client::VERSION}"
12
+ },
13
+ follow_redirects: true
14
+ }
15
+
16
+ def self.get(url, opts = {}, verify = true)
17
+ new.get(url, opts, verify)
18
+ end
19
+
20
+ def get(url, opts = {}, verify = true)
21
+ response = HTTParty.get(url, params(opts, verify))
22
+
23
+ if response.success?
24
+ JSON.parse(response.body)
25
+ else
26
+ fail Errors::RequestError, request_error_message(response)
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def params(opts, verify)
33
+ {
34
+ query: opts,
35
+ verify: verify
36
+ }.merge(DEFAULT_OPTIONS)
37
+ end
38
+
39
+ def request_error_message(response)
40
+ "Request failed with code #{response.code}. #{response.message}"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,5 @@
1
+ module Hotchoc
2
+ class Client
3
+ VERSION = '0.3.0'
4
+ end
5
+ end
@@ -1,17 +1,17 @@
1
1
  module Hotchoc
2
2
  class Client
3
- include Hotchoc::API
3
+ include API
4
4
 
5
5
  #
6
6
  # Define the same set of accessors as in the Hotchoc module
7
7
  #
8
- attr_accessor *Configuration::VALID_CONFIG_KEYS
8
+ attr_accessor(*Configuration::VALID_CONFIG_KEYS)
9
9
 
10
10
  def initialize(opts = {})
11
11
  options = Hotchoc.options.merge(opts)
12
12
 
13
- raise ArgumentError, "API key is required" unless options[:api_key]
14
- raise ArgumentError, "Site name is required" unless options[:site]
13
+ fail ArgumentError, 'API key is required' unless options[:api_key]
14
+ fail ArgumentError, 'Site name is required' unless options[:site]
15
15
 
16
16
  #
17
17
  # Copy the merged values to this client and ignore those
@@ -1,8 +1,6 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
-
4
3
  class Album < Hotchoc::Presenters::Base
5
-
6
4
  def id
7
5
  @item['id']
8
6
  end
@@ -54,8 +52,6 @@ module Hotchoc
54
52
  def inspect
55
53
  %(#<Hotchoc::Presenters::Album: title="#{title}">)
56
54
  end
57
-
58
55
  end
59
-
60
56
  end
61
57
  end
@@ -1,8 +1,6 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
-
4
3
  class Base
5
-
6
4
  attr_reader :item
7
5
 
8
6
  def initialize(item = {})
@@ -19,8 +17,6 @@ module Hotchoc
19
17
  Hotchoc::Presenters::Blocks::Image.new(block)
20
18
  end
21
19
  end
22
-
23
20
  end
24
-
25
21
  end
26
22
  end
@@ -1,9 +1,7 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
3
  module Blocks
4
-
5
4
  class Base < Hotchoc::Presenters::Base
6
-
7
5
  def id
8
6
  @item['id']
9
7
  end
@@ -23,9 +21,7 @@ module Hotchoc
23
21
  def updated_at
24
22
  Time.parse(@item['updated_at'])
25
23
  end
26
-
27
24
  end
28
-
29
25
  end
30
26
  end
31
27
  end
@@ -1,9 +1,7 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
3
  module Blocks
4
-
5
4
  class Image < Hotchoc::Presenters::Blocks::Base
6
-
7
5
  def title
8
6
  @item['content']['title']
9
7
  end
@@ -15,9 +13,7 @@ module Hotchoc
15
13
  def inspect
16
14
  %(#<Hotchoc::Presenters::Blocks::Image: title="#{title}" position="#{position}">)
17
15
  end
18
-
19
16
  end
20
-
21
17
  end
22
18
  end
23
19
  end
@@ -1,9 +1,7 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
3
  module Blocks
4
-
5
4
  class Text < Hotchoc::Presenters::Blocks::Base
6
-
7
5
  def markdown
8
6
  @item['content']['markdown']
9
7
  end
@@ -15,9 +13,7 @@ module Hotchoc
15
13
  def inspect
16
14
  %(#<Hotchoc::Presenters::Blocks::Text: position="#{position}">)
17
15
  end
18
-
19
16
  end
20
-
21
17
  end
22
18
  end
23
19
  end
@@ -1,8 +1,6 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
-
4
3
  class File < Hotchoc::Presenters::Base
5
-
6
4
  def id
7
5
  @item['id']
8
6
  end
@@ -34,7 +32,7 @@ module Hotchoc
34
32
  def thumbnails
35
33
  if @item['thumbnails']
36
34
  @item['thumbnails']['original'].map { |thumbnail| Hotchoc::Presenters::Thumbnail.new(thumbnail) } +
37
- @item['thumbnails']['square'].map { |thumbnail| Hotchoc::Presenters::Thumbnail.new(thumbnail) }
35
+ @item['thumbnails']['square'].map { |thumbnail| Hotchoc::Presenters::Thumbnail.new(thumbnail) }
38
36
  else
39
37
  []
40
38
  end
@@ -55,8 +53,6 @@ module Hotchoc
55
53
  def inspect
56
54
  %(#<Hotchoc::Presenters::File: name="#{name}">)
57
55
  end
58
-
59
56
  end
60
-
61
57
  end
62
58
  end
@@ -1,8 +1,6 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
-
4
3
  class Page < Hotchoc::Presenters::Base
5
-
6
4
  def id
7
5
  @item['id']
8
6
  end
@@ -62,8 +60,6 @@ module Hotchoc
62
60
  def inspect
63
61
  %(#<Hotchoc::Presenters::Page: title="#{title}">)
64
62
  end
65
-
66
63
  end
67
-
68
64
  end
69
65
  end
@@ -1,8 +1,6 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
-
4
3
  class Post < Hotchoc::Presenters::Base
5
-
6
4
  def id
7
5
  @item['id']
8
6
  end
@@ -46,8 +44,6 @@ module Hotchoc
46
44
  def inspect
47
45
  %(#<Hotchoc::Presenters::Post: title="#{title}">)
48
46
  end
49
-
50
47
  end
51
-
52
48
  end
53
49
  end
@@ -1,8 +1,6 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
-
4
3
  class Thumbnail < Hotchoc::Presenters::Base
5
-
6
4
  def name
7
5
  @item['name']
8
6
  end
@@ -30,8 +28,6 @@ module Hotchoc
30
28
  def inspect
31
29
  %(#<Hotchoc::Presenters::Thumbnail:>)
32
30
  end
33
-
34
31
  end
35
-
36
32
  end
37
33
  end
@@ -1,8 +1,6 @@
1
1
  module Hotchoc
2
2
  module Presenters
3
-
4
3
  class Topic < Hotchoc::Presenters::Base
5
-
6
4
  def id
7
5
  @item['id']
8
6
  end
@@ -26,8 +24,6 @@ module Hotchoc
26
24
  def inspect
27
25
  %(#<Hotchoc::Presenters::Topic: name="#{name}">)
28
26
  end
29
-
30
27
  end
31
-
32
28
  end
33
29
  end
data/lib/hotchoc.rb CHANGED
@@ -9,13 +9,13 @@ require 'hotchoc/presenters/post'
9
9
  require 'hotchoc/presenters/thumbnail'
10
10
  require 'hotchoc/presenters/topic'
11
11
 
12
- require 'hotchoc/version'
13
- require 'hotchoc/errors'
14
- require 'hotchoc/api'
15
- require 'hotchoc/fetcher'
16
- require 'hotchoc/configuration'
12
+ require 'hotchoc/client/version'
13
+ require 'hotchoc/client/errors'
14
+ require 'hotchoc/client/api'
15
+ require 'hotchoc/client/fetcher'
16
+ require 'hotchoc/client/configuration'
17
17
  require 'hotchoc/client'
18
18
 
19
19
  module Hotchoc
20
- extend Configuration
20
+ extend Client::Configuration
21
21
  end
@@ -1,61 +1,56 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Hotchoc::API' do
4
-
3
+ describe 'Hotchoc::Client::API' do
5
4
  let(:client) do
6
- Hotchoc::Client.new({
5
+ Hotchoc::Client.new(
7
6
  api_key: 'test',
8
7
  site: 'test'
9
- })
8
+ )
10
9
  end
11
10
 
12
11
  describe 'Albums' do
13
-
14
12
  context 'GET collection' do
15
13
  let(:albums) do
16
14
  JSON.parse(File.read(response_stub('albums')))['albums'].map { |album| Hotchoc::Presenters::Album.new(album) }
17
15
  end
18
16
 
19
- it "returns an array with the albums" do
17
+ it 'returns an array with the albums' do
20
18
  expect(client.get_albums).to have_the_same_items_as albums
21
19
  end
22
20
  end
23
21
  end
24
22
 
25
23
  describe 'Pages' do
26
-
27
24
  context 'GET collection' do
28
25
  let(:pages) do
29
26
  JSON.parse(File.read(response_stub('pages')))['pages'].map { |page| Hotchoc::Presenters::Page.new(page) }
30
27
  end
31
28
 
32
- it "returns an array with the pages" do
29
+ it 'returns an array with the pages' do
33
30
  expect(client.get_pages).to have_the_same_items_as pages
34
31
  end
35
32
  end
36
33
  end
37
34
 
38
35
  describe 'Posts' do
39
-
40
36
  context 'GET collection' do
41
37
  let(:posts) do
42
38
  JSON.parse(File.read(response_stub('posts')))['posts'].map { |post| Hotchoc::Presenters::Post.new(post) }
43
39
  end
44
40
 
45
- it "returns an array with the posts" do
41
+ it 'returns an array with the posts' do
46
42
  expect(client.get_posts).to have_the_same_items_as posts
47
43
  end
48
44
  end
49
45
  end
50
46
 
51
47
  describe 'Topics' do
52
-
53
48
  context 'GET collection' do
54
49
  let(:topics) do
55
50
  JSON.parse(File.read(response_stub('topics')))['topics'].map { |topic| Hotchoc::Presenters::Topic.new(topic) }
56
51
  end
57
52
 
58
- it "returns an array with the topics" do
53
+ it 'returns an array with the topics' do
59
54
  expect(client.get_topics).to have_the_same_items_as topics
60
55
  end
61
56
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Hotchoc::Client::Configuration' do
4
+ after do
5
+ Hotchoc.reset
6
+ end
7
+
8
+ Hotchoc::Client::Configuration::VALID_CONFIG_KEYS.each do |key|
9
+ describe ".#{key}" do
10
+ it "should return the default #{key}" do
11
+ expect(Hotchoc.send(key)).to eq Hotchoc::Client::Configuration.const_get("DEFAULT_#{key.upcase}")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,8 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc' do
4
-
5
4
  it 'should have a version' do
6
- expect(Hotchoc::VERSION).to_not be_nil
5
+ expect(Hotchoc::Client::VERSION).to_not be_nil
7
6
  end
8
7
  end
@@ -1,9 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc::Client' do
4
-
5
4
  before do
6
- @keys = Hotchoc::Configuration::VALID_CONFIG_KEYS
5
+ @keys = Hotchoc::Client::Configuration::VALID_CONFIG_KEYS
7
6
  end
8
7
 
9
8
  describe 'with class configuration' do
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc::Presenters::Album' do
4
-
5
4
  let(:data) do
6
5
  JSON.parse(File.read(response_stub('albums')))['albums'].first
7
6
  end
@@ -59,5 +58,4 @@ describe 'Hotchoc::Presenters::Album' do
59
58
  it 'has an updated_at' do
60
59
  expect(album.updated_at).to be_a(Time)
61
60
  end
62
-
63
61
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc::Presenters::Blocks::Image' do
4
-
5
4
  let(:data) do
6
5
  JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
7
6
  end
@@ -17,5 +16,4 @@ describe 'Hotchoc::Presenters::Blocks::Image' do
17
16
  it 'has an image' do
18
17
  expect(block.image).to be_a(Hotchoc::Presenters::File)
19
18
  end
20
-
21
19
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc::Presenters::Blocks::Text' do
4
-
5
4
  let(:data) do
6
5
  blocks = JSON.parse(File.read(response_stub('pages')))['pages'].first['blocks']
7
6
  blocks.detect { |block| block['type'] == 'text' }
@@ -18,5 +17,4 @@ describe 'Hotchoc::Presenters::Blocks::Text' do
18
17
  it 'has a markdown version' do
19
18
  expect(block.markdown).to be
20
19
  end
21
-
22
20
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc::Presenters::File' do
4
-
5
4
  let(:data) do
6
5
  JSON.parse(File.read(response_stub('albums')))['albums'].first['blocks'].first
7
6
  end
@@ -54,5 +53,4 @@ describe 'Hotchoc::Presenters::File' do
54
53
  it 'has an updated_at' do
55
54
  expect(file.updated_at).to be_a(Time)
56
55
  end
57
-
58
56
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc::Presenters::Page' do
4
-
5
4
  let(:data) do
6
5
  JSON.parse(File.read(response_stub('pages')))['pages'].first
7
6
  end
@@ -67,5 +66,4 @@ describe 'Hotchoc::Presenters::Page' do
67
66
  it 'has an updated_at' do
68
67
  expect(page.updated_at).to be_a(Time)
69
68
  end
70
-
71
69
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Hotchoc::Presenters::Post' do
4
-
5
4
  let(:data) do
6
5
  JSON.parse(File.read(response_stub('posts')))['posts'].first
7
6
  end
@@ -51,5 +50,4 @@ describe 'Hotchoc::Presenters::Post' do
51
50
  it 'has an updated_at' do
52
51
  expect(post.updated_at).to be_a(Time)
53
52
  end
54
-
55
53
  end