Skip to content

Commit

Permalink
Cast values to integers
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Sep 8, 2017
1 parent fe08802 commit b139651
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/services/riiif/size/height.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Size
class Height < Resize
def initialize(info, height)
@image_info = info
@height = height
@height = height.to_i
end

# @return [String] a resize directive for imagemagick to use
Expand Down
2 changes: 1 addition & 1 deletion app/services/riiif/size/width.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Size
class Width < Resize
def initialize(info, width)
@image_info = info
@width = width
@width = width.to_i
end

# @return [String] a resize directive for imagemagick to use
Expand Down
13 changes: 13 additions & 0 deletions spec/services/riiif/size/height_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

RSpec.describe Riiif::Size::Height do
let(:image_info) { double }

context 'when initialized with strings' do
let(:instance) { described_class.new(image_info, '50') }

it 'casts height to an integer' do
expect(instance.height).to eq 50
end
end
end
13 changes: 13 additions & 0 deletions spec/services/riiif/size/width_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

RSpec.describe Riiif::Size::Width do
let(:image_info) { double }

context 'when initialized with strings' do
let(:instance) { described_class.new(image_info, '50') }

it 'casts height to an integer' do
expect(instance.width).to eq 50
end
end
end

0 comments on commit b139651

Please sign in to comment.