riiif 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0aaf0ae50831c1b402852fee520e6a4a0c9b8760
4
- data.tar.gz: 141b672ec9ce926ae80d139febb926a82d607cc2
3
+ metadata.gz: 83e09f8e63165428baf455b3547e78819582ec2f
4
+ data.tar.gz: 2bb3a70107f4e4ab94c2561e4ab316b7b360beaa
5
5
  SHA512:
6
- metadata.gz: 3729b7972bea7cfea2d4f1c21b75ad3c974b54c2307a1ab63e297a7b06cf5e5dc9efb9bc919a6c8b5c3e7d04dc9030866e10e2c0fc368dc8a2b1bc4518dd0b4f
7
- data.tar.gz: ee0acb8006038a89caceb49cd4216ce08d3f65136ca38f5aff3ed2391bd0fb17ced7a48075e7f65565d3d0b600f199c004d2ee0e027b0ad80f3ff9ba48ecf338
6
+ metadata.gz: 77d9392212565fe905219e1811dea64d8c090e2d5121508286936876b959915c1d9548463085c601e719adbcb7862d3f4cc6b830c2fbec6a23915f07789ca83b
7
+ data.tar.gz: 5a2a9866ac295b9a0739f43dcf3209b31c659a279a0afad4d6a7c804e4d8faf27237828363c219d9260f04669191cc5ed5e97d11ddb14a3b17476457b824bdd1
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-01-24 17:33:24 -0500 using RuboCop version 0.47.0.
3
+ # on 2017-04-11 15:07:00 -0500 using RuboCop version 0.47.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -24,53 +24,24 @@ Lint/UselessAssignment:
24
24
  Exclude:
25
25
  - 'app/models/riiif/file.rb'
26
26
 
27
- # Offense count: 4
27
+ # Offense count: 5
28
28
  Metrics/AbcSize:
29
- Max: 38
29
+ Max: 29
30
30
 
31
31
  # Offense count: 1
32
- # Configuration parameters: CountComments.
33
- Metrics/ClassLength:
34
- Max: 103
35
-
36
- # Offense count: 2
37
32
  Metrics/CyclomaticComplexity:
38
33
  Max: 8
39
34
 
40
- # Offense count: 68
35
+ # Offense count: 96
41
36
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
42
37
  # URISchemes: http, https
43
38
  Metrics/LineLength:
44
- Max: 120
39
+ Max: 117
45
40
 
46
- # Offense count: 7
41
+ # Offense count: 6
47
42
  # Configuration parameters: CountComments.
48
43
  Metrics/MethodLength:
49
- Max: 21
50
-
51
- # Offense count: 1
52
- # Cop supports --auto-correct.
53
- Performance/RedundantMatch:
54
- Exclude:
55
- - 'lib/riiif/file_system_file_resolver.rb'
56
-
57
- # Offense count: 3
58
- # Cop supports --auto-correct.
59
- # Configuration parameters: EnforcedHashRocketStyle, SupportedHashRocketStyles, EnforcedColonStyle, SupportedColonStyles, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
60
- # SupportedHashRocketStyles: key, separator, table
61
- # SupportedColonStyles: key, separator, table
62
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
63
- Style/AlignHash:
64
- Exclude:
65
- - 'lib/riiif/routes.rb'
66
-
67
- # Offense count: 1
68
- # Cop supports --auto-correct.
69
- # Configuration parameters: EnforcedStyle, SupportedStyles.
70
- # SupportedStyles: braces, no_braces, context_dependent
71
- Style/BracesAroundHashParameters:
72
- Exclude:
73
- - 'app/models/riiif/image.rb'
44
+ Max: 18
74
45
 
75
46
  # Offense count: 1
76
47
  # Configuration parameters: EnforcedStyle, SupportedStyles.
@@ -79,12 +50,6 @@ Style/ClassAndModuleChildren:
79
50
  Exclude:
80
51
  - 'lib/riiif/rails/routes.rb'
81
52
 
82
- # Offense count: 1
83
- # Cop supports --auto-correct.
84
- Style/ColonMethodCall:
85
- Exclude:
86
- - 'lib/riiif/http_file_resolver.rb'
87
-
88
53
  # Offense count: 14
89
54
  Style/Documentation:
90
55
  Exclude:
@@ -102,35 +67,3 @@ Style/Documentation:
102
67
  - 'lib/riiif/nil_authorization_service.rb'
103
68
  - 'lib/riiif/rails/routes.rb'
104
69
  - 'lib/riiif/routes.rb'
105
-
106
- # Offense count: 2
107
- # Cop supports --auto-correct.
108
- Style/EmptyLines:
109
- Exclude:
110
- - 'app/models/riiif/image.rb'
111
- - 'lib/riiif/http_file_resolver.rb'
112
-
113
- # Offense count: 5
114
- # Cop supports --auto-correct.
115
- # Configuration parameters: EnforcedStyle, SupportedStyles.
116
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
117
- Style/EmptyLinesAroundClassBody:
118
- Exclude:
119
- - 'app/models/riiif/file.rb'
120
- - 'app/models/riiif/image.rb'
121
- - 'lib/riiif/http_file_resolver.rb'
122
-
123
- # Offense count: 5
124
- # Cop supports --auto-correct.
125
- Style/EmptyLinesAroundMethodBody:
126
- Exclude:
127
- - 'app/models/riiif/file.rb'
128
- - 'app/models/riiif/image.rb'
129
- - 'lib/riiif/rails/routes.rb'
130
-
131
- # Offense count: 1
132
- # Cop supports --auto-correct.
133
- # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
134
- Style/ExtraSpacing:
135
- Exclude:
136
- - 'lib/riiif/routes.rb'
data/README.md CHANGED
@@ -28,17 +28,17 @@ And then execute:
28
28
  Or install it yourself as:
29
29
 
30
30
  $ gem install riiif
31
-
31
+
32
32
  ## Configure
33
33
 
34
34
  ### Images on the servers file system.
35
35
 
36
- By default Riiif is set to load images from the filesystem using the Riiif::FileSystemFileResolver.
36
+ By default Riiif is set to load images from the filesystem using the Riiif::FileSystemFileResolver.
37
37
  You can configure how this resolver finds the files by setting this property:
38
38
  ```
39
39
  Riiif::Image.file_resolver.base_path = '/opt/repository/images/'
40
40
  ```
41
- When the Id passed in is "foo_image", then it will look for an image file using this glob:
41
+ When the Id passed in is "foo_image", then it will look for an image file using this glob:
42
42
  ```
43
43
  /opt/repository/images/foo_image.{png,jpg,tiff,jp,jp2}
44
44
  ```
@@ -65,7 +65,7 @@ By default the cache is located in `tmp/network_files`. You can set the cache pa
65
65
 
66
66
  ## Usage
67
67
 
68
- Add the routes to your application by inserting the following line into `config/routes.rb`
68
+ Add the routes to your application by inserting the following line into `config/routes.rb`
69
69
  ```
70
70
  mount Riiif::Engine => '/image-service', as: 'riiif'
71
71
  ```
@@ -87,12 +87,21 @@ It is prefereable that you use the provided route helpers to build these URIs. H
87
87
  image_tag(Riiif::Engine.routes.url_helpers.image_path(file_id, size: ',600'))
88
88
  ```
89
89
 
90
- ### Using a default image
90
+ ### Using default images for missing and unauthorized requests
91
+
92
+ If there is a request for an id that doesn't exist, a 404 will be
93
+ returned. You can optionally return an image with this 404 by setting
94
+ this in your initializer:
95
+
96
+ ```ruby
97
+ Riiif.not_found_image = 'path/to/image.png'
98
+ ```
91
99
 
92
- If there is a request for an id that doesn't exist, a 404 will be returned. You can optionally return an image with this 404 by setting this in your initializer:
100
+ If the request is unauthorized, a 401 will be returned, and a custom
101
+ error image can also be configured.
93
102
 
94
103
  ```ruby
95
- Riiif::not_found_image = 'path/to/image.png'
104
+ Riiif.unauthorized_image = 'path/to/unauthorized_image.png'
96
105
  ```
97
106
 
98
107
  You can do this to create a default Riiif::Image to use (useful for passing "missing" images to openseadragon_collection_viewer):
@@ -103,7 +112,7 @@ Riiif::Image.new('no_image', Riiif::File.new(Riiif.not_found_image))
103
112
 
104
113
  ## Authorization
105
114
 
106
- The controller will call an authorization service with the controller context. This service must have a method `can?(action, image)` which returns a boolean. The default service is the `RIIIF::NilAuthrorizationService` which permits all requests.
115
+ The controller will call an authorization service with the controller context. This service must have a method `can?(action, image)` which returns a boolean. The default service is the `RIIIF::NilAuthrorizationService` which permits all requests.
107
116
 
108
117
  In this example we've dissallowed all requests:
109
118
 
@@ -129,14 +138,14 @@ Create an initializer like this in `config/initializers/riiif_initializer.rb`
129
138
  Riiif::Image.file_resolver = Riiif::HTTPFileResolver.new
130
139
 
131
140
  # This tells RIIIF how to resolve the identifier to a URI in Fedora
132
- Riiif::Image.file_resolver.id_to_uri = lambda do |id|
141
+ Riiif::Image.file_resolver.id_to_uri = lambda do |id|
133
142
  ActiveFedora::Base.id_to_uri(CGI.unescape(id)).tap do |url|
134
143
  logger.info "Riiif resolved #{id} to #{url}"
135
144
  end
136
145
  end
137
146
 
138
147
  # In order to return the info.json endpoint, we have to have the full height and width of
139
- # each image. If you are using hydra-file_characterization, you have the height & width
148
+ # each image. If you are using hydra-file_characterization, you have the height & width
140
149
  # cached in Solr. The following block directs the info_service to return those values:
141
150
  Riiif::Image.info_service = lambda do |id, file|
142
151
  # id will look like a path to a pcdm:file
@@ -155,6 +164,11 @@ def logger
155
164
  Rails.logger
156
165
  end
157
166
 
167
+ # Note that this is translated to an `expires` argument to the
168
+ # ActiveSupport::Cache::Store in use, by default the host application's
169
+ # Rails.cache. Some cache stores may not automatically purge expired content,
170
+ # such as the default FileStore.
171
+ # http://guides.rubyonrails.org/caching_with_rails.html#cache-stores
158
172
  Riiif::Engine.config.cache_duration_in_days = 30
159
173
  ```
160
174
  #### Special note for Passenger and Apache users
@@ -18,7 +18,7 @@ module Riiif
18
18
  status = :not_found
19
19
  end
20
20
 
21
- image = not_found_image unless status == :ok
21
+ image = error_image(status) unless status == :ok
22
22
 
23
23
  data = image.render(image_request_params)
24
24
  headers['Access-Control-Allow-Origin'] = '*'
@@ -88,9 +88,22 @@ module Riiif
88
88
  response.headers['Link'] = "<#{LEVEL1}>;rel=\"profile\""
89
89
  end
90
90
 
91
- def not_found_image
92
- raise "Not found image doesn't exist" unless Riiif.not_found_image
93
- model.new(image_id, Riiif::File.new(Riiif.not_found_image))
91
+ # @param [Symbol] err E.g., :not_found, :unauthorized
92
+ # @return [Image]
93
+ def error_image(err)
94
+ # rubocop:disable Lint/HandleExceptions
95
+ begin
96
+ image = Riiif.send("#{err}_image")
97
+ rescue NoMethodError
98
+ end
99
+ # rubocop:enable Lint/HandleExceptions
100
+
101
+ if image.nil?
102
+ raise ImageNotFoundError,
103
+ "Riiif.#{err}_image is not configured; assign it to an image path in your RIIIF initializer"
104
+ end
105
+
106
+ model.new(image_id, Riiif::File.new(image))
94
107
  end
95
108
 
96
109
  CONTEXT = '@context'.freeze
@@ -20,7 +20,6 @@ module Riiif
20
20
  end
21
21
 
22
22
  def self.create(ext = nil, _validate = true, &block)
23
-
24
23
  tempfile = Tempfile.new(['mini_magick', ext.to_s.downcase])
25
24
  tempfile.binmode
26
25
  block.call(tempfile)
@@ -28,7 +27,6 @@ module Riiif
28
27
  image = new(tempfile.path, tempfile)
29
28
  ensure
30
29
  tempfile.close if tempfile
31
-
32
30
  end
33
31
 
34
32
  # @param [Transformation] transformation
@@ -1,10 +1,10 @@
1
1
  require 'digest/md5'
2
2
  module Riiif
3
3
  class Image
4
-
5
- class_attribute :file_resolver, :info_service, :authorization_service
4
+ class_attribute :file_resolver, :info_service, :authorization_service, :cache
6
5
  self.file_resolver = FileSystemFileResolver.new
7
6
  self.authorization_service = NilAuthorizationService
7
+ self.cache = Rails.cache
8
8
 
9
9
  # this is the default info service
10
10
  # returns a hash with the original image dimensions.
@@ -12,7 +12,7 @@ module Riiif
12
12
  # example:
13
13
  # {:height=>390, :width=>600}
14
14
  self.info_service = lambda do |id, image|
15
- Rails.cache.fetch(cache_key(id, { info: true }), compress: true, expires_in: expires_in) do
15
+ cache.fetch(cache_key(id, info: true), compress: true, expires_in: expires_in) do
16
16
  image.info
17
17
  end
18
18
  end
@@ -36,7 +36,7 @@ module Riiif
36
36
  # @param [ActiveSupport::HashWithIndifferentAccess] args
37
37
  def render(args)
38
38
  options = decode_options!(args)
39
- Rails.cache.fetch(Image.cache_key(id, options), compress: true, expires_in: Image.expires_in) do
39
+ cache.fetch(Image.cache_key(id, options), compress: true, expires_in: Image.expires_in) do
40
40
  image.extract(options)
41
41
  end
42
42
  end
@@ -53,11 +53,11 @@ module Riiif
53
53
  Riiif::Engine.config.cache_duration_in_days.days
54
54
  end
55
55
 
56
-
57
56
  def cache_key(id, options)
58
57
  str = options.to_h.merge(id: id).delete_if { |_, v| v.nil? }.to_s
59
- # Use a MD5 digest to ensure the keys aren't too long.
60
- Digest::MD5.hexdigest(str)
58
+ # Use a MD5 digest to ensure the keys aren't too long, and a prefix
59
+ # to avoid collisions with other components in shared cache.
60
+ 'riiif:' + Digest::MD5.hexdigest(str)
61
61
  end
62
62
  end
63
63
 
@@ -93,7 +93,6 @@ module Riiif
93
93
 
94
94
  def validate_format!(format)
95
95
  raise InvalidAttributeError, "Unsupported format: #{format}" unless OUTPUT_FORMATS.include?(format)
96
-
97
96
  end
98
97
 
99
98
  def decode_region(region)
@@ -3,14 +3,14 @@ module Riiif
3
3
  attr_writer :input_types
4
4
 
5
5
  def pattern(id)
6
- raise ArgumentError, "Invalid characters in id `#{id}`" unless /^[\w\-:]+$/.match(id)
6
+ raise ArgumentError, "Invalid characters in id `#{id}`" unless id =~ /^[\w\-:]+$/
7
7
  ::File.join(base_path, "#{id}.{#{input_types.join(',')}}")
8
8
  end
9
9
 
10
10
  private
11
11
 
12
12
  def input_types
13
- @input_types ||= %w(png jpg tiff jp jp2)
13
+ @input_types ||= %w(png jpg tif tiff jp2)
14
14
  end
15
15
  end
16
16
  end
@@ -3,7 +3,6 @@ require 'active_support/core_ext/file/atomic'
3
3
 
4
4
  module Riiif
5
5
  class HTTPFileResolver
6
-
7
6
  # Set a lambda that maps the first parameter (id) to a URL
8
7
  # Example:
9
8
  #
@@ -16,8 +15,8 @@ module Riiif
16
15
  attr_accessor :basic_auth_credentials
17
16
  attr_accessor :cache_path
18
17
 
19
- def initialize
20
- @cache_path = 'tmp/network_files'
18
+ def initialize(cache_path: 'tmp/network_files')
19
+ @cache_path = cache_path
21
20
  end
22
21
 
23
22
  def find(id)
@@ -64,7 +63,7 @@ module Riiif
64
63
  benchmark("Riiif downloaded #{url}") do
65
64
  ::File.atomic_write(file_name, cache_path) do |local|
66
65
  begin
67
- Kernel::open(url, download_opts) do |remote|
66
+ Kernel.open(url, download_opts) do |remote|
68
67
  while chunk = remote.read(8192)
69
68
  local.write(chunk)
70
69
  end
@@ -88,13 +87,11 @@ module Riiif
88
87
  end
89
88
  end
90
89
 
91
-
92
90
  protected
93
91
 
94
92
  def uri(id)
95
93
  raise 'Must set the id_to_uri lambda' if id_to_uri.nil?
96
94
  id_to_uri.call(id)
97
95
  end
98
-
99
96
  end
100
97
  end
@@ -6,7 +6,6 @@ module ActionDispatch::Routing
6
6
  options = resources.extract_options!
7
7
 
8
8
  Riiif::Routes.new(self, options.merge(resource: resources.first)).draw
9
-
10
9
  end
11
10
  end
12
11
  end
data/lib/riiif/routes.rb CHANGED
@@ -18,12 +18,12 @@ module Riiif
18
18
  route_prefix = options[:at]
19
19
  route_prefix ||= "/#{options[:as]}" if options[:as]
20
20
  get "#{route_prefix}/:id/:region/:size/:rotation/:quality.:format" => 'riiif/images#show',
21
- constraints: { rotation: ALLOW_DOTS, size: SIZES },
22
- defaults: { format: 'jpg', rotation: '0', region: 'full', quality: 'default', model: resource },
23
- as: options[:as] || 'image'
21
+ constraints: { rotation: ALLOW_DOTS, size: SIZES },
22
+ defaults: { format: 'jpg', rotation: '0', region: 'full', quality: 'default', model: resource },
23
+ as: options[:as] || 'image'
24
24
 
25
25
  get "#{route_prefix}/:id/info.json" => 'riiif/images#info',
26
- defaults: { format: 'json', model: resource },
26
+ defaults: { format: 'json', model: resource },
27
27
  as: [options[:as], 'info'].compact.join('_')
28
28
 
29
29
  # This doesn't work presently
data/lib/riiif/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Riiif
2
- VERSION = '1.4.0'.freeze
2
+ VERSION = '1.4.1'.freeze
3
3
  end
@@ -16,23 +16,41 @@ describe Riiif::ImagesController do
16
16
  rotation: '0', quality: 'default', format: 'jpg' }
17
17
  expect(response).to be_successful
18
18
  expect(response.body).to eq 'IMAGEDATA'
19
+ expect(response.headers['Content-Type']).to eq 'image/jpeg'
19
20
  expect(response.headers['Link']).to eq '<http://iiif.io/api/image/2/level1.json>;rel="profile"'
20
21
  expect(response.headers['Access-Control-Allow-Origin']).to eq '*'
21
- expect(response.headers['Cache-Control']).to eq 'max-age=31557600, private'
22
+ expect(response.headers['Cache-Control']).to eq "max-age=#{1.year.to_i}, private"
22
23
  end
23
24
 
24
25
  context 'with an unauthorized image' do
25
26
  let(:auth) { double('no auth service', can?: false) }
26
- let(:not_found_image) { double('not_found_image', render: 'test data') }
27
+
27
28
  before do
28
29
  allow(controller).to receive(:authorization_service).and_return(auth)
29
- allow(controller).to receive(:not_found_image).and_return(not_found_image)
30
30
  end
31
- it 'renders 401' do
32
- get :show, params: { id: 'abcd1234', action: 'show', region: 'full', size: 'full',
33
- rotation: '0', quality: 'default', format: 'jpg' }
34
- expect(response.body).to eq 'test data'
35
- expect(response.code).to eq '401'
31
+
32
+ context 'with Riiif::unauthorized_image configured' do
33
+ before do
34
+ allow(controller).to receive(:error_image).with(:unauthorized).and_return(unauthorized_image)
35
+ end
36
+
37
+ let(:unauthorized_image) { double('unauthorized_image', render: 'test data') }
38
+
39
+ it 'renders 401 and renders the unauthorized_image' do
40
+ get :show, params: { id: 'abcd1234', action: 'show', region: 'full', size: 'full',
41
+ rotation: '0', quality: 'default', format: 'jpg' }
42
+ expect(response.body).to eq 'test data'
43
+ expect(response.code).to eq '401'
44
+ end
45
+ end
46
+
47
+ context 'with Riiif::unauthorized_image left to nil' do
48
+ it 'gives a helpful error' do
49
+ expect do
50
+ get :show, params: { id: 'abcd1234', action: 'show', region: 'full', size: 'full',
51
+ rotation: '0', quality: 'default', format: 'jpg' }
52
+ end.to raise_error(Riiif::ImageNotFoundError)
53
+ end
36
54
  end
37
55
  end
38
56
 
@@ -49,11 +67,10 @@ describe Riiif::ImagesController do
49
67
 
50
68
  context 'with a nonexistent image' do
51
69
  it "errors when a default image isn't sent" do
52
- expect(Riiif::Image).to receive(:new).with('bad_id').and_raise(OpenURI::HTTPError.new('fail', StringIO.new))
53
70
  expect do
54
71
  get :show, params: { id: 'bad_id', action: 'show', region: 'full', size: 'full',
55
72
  rotation: '0', quality: 'default', format: 'jpg' }
56
- end.to raise_error(StandardError)
73
+ end.to raise_error(Riiif::ImageNotFoundError)
57
74
  end
58
75
 
59
76
  context 'with a default image set' do
@@ -116,7 +133,7 @@ describe Riiif::ImagesController do
116
133
  expect(response.headers['Link']).to eq '<http://iiif.io/api/image/2/level1.json>;rel="profile"'
117
134
  expect(response.headers['Content-Type']).to eq 'application/ld+json; charset=utf-8'
118
135
  expect(response.headers['Access-Control-Allow-Origin']).to eq '*'
119
- expect(response.headers['Cache-Control']).to eq 'max-age=31557600, private'
136
+ expect(response.headers['Cache-Control']).to eq "max-age=#{1.year.to_i}, private"
120
137
  end
121
138
 
122
139
  context 'with an unauthorized image' do
@@ -13,7 +13,7 @@ describe Riiif::FileSystemFileResolver do
13
13
  end
14
14
  end
15
15
 
16
- context 'when the file is found' do
16
+ context 'when a jpeg2000 file is found' do
17
17
  let(:id) { 'world' }
18
18
  it 'returns the jpeg2000 file' do
19
19
  expect(subject.path).to eq resolver.root + '/spec/samples/world.jp2'
@@ -21,6 +21,30 @@ describe Riiif::FileSystemFileResolver do
21
21
  end
22
22
  end
23
23
 
24
+ describe '#input_types' do
25
+ subject { described_class.new.send(:input_types) }
26
+
27
+ it 'includes jp2 extension' do
28
+ expect(subject).to include 'jp2'
29
+ end
30
+
31
+ it 'includes jpg extension' do
32
+ expect(subject).to include 'jpg'
33
+ end
34
+
35
+ it 'includes tif extension' do
36
+ expect(subject).to include 'tif'
37
+ end
38
+
39
+ it 'includes tiff extension' do
40
+ expect(subject).to include 'tiff'
41
+ end
42
+
43
+ it 'includes png extension' do
44
+ expect(subject).to include 'png'
45
+ end
46
+ end
47
+
24
48
  describe '#pattern' do
25
49
  subject { resolver.pattern(id) }
26
50
 
@@ -31,9 +55,9 @@ describe Riiif::FileSystemFileResolver do
31
55
  end
32
56
  end
33
57
 
34
- context 'with colins' do
58
+ context 'with colons' do
35
59
  let(:id) { 'fo:baz' }
36
- it 'accepts ids with colins' do
60
+ it 'accepts ids with colons' do
37
61
  expect { subject }.not_to raise_error
38
62
  end
39
63
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Riiif::Image do
4
- before { Rails.cache.clear }
4
+ before { Riiif::Image.cache.clear }
5
5
  let(:filename) { File.expand_path('spec/samples/world.jp2') }
6
6
  subject { described_class.new('world') }
7
7
  describe 'happy path' do
@@ -53,7 +53,7 @@ RSpec.describe Riiif::Image do
53
53
 
54
54
  context 'when the rendered image is in the cache' do
55
55
  subject { described_class.new('Cave_26,_Ajanta') }
56
- before { allow(Rails.cache).to receive(:fetch).and_return('expected') }
56
+ before { allow(Riiif::Image.cache).to receive(:fetch).and_return('expected') }
57
57
 
58
58
  it 'does not fetch the file' do
59
59
  expect(described_class.file_resolver).not_to receive(:find)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riiif
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-11 00:00:00.000000000 Z
11
+ date: 2017-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
204
  version: '0'
205
205
  requirements: []
206
206
  rubyforge_project:
207
- rubygems_version: 2.6.10
207
+ rubygems_version: 2.6.12
208
208
  signing_key:
209
209
  specification_version: 4
210
210
  summary: A rails engine that support IIIF requests