Sha256: a9c9acc021923ac56fd8374832892864c1c8f4ff290ac23f472630899274c11b
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
require 'spec_helper' describe ImageBoss::Client do let(:service) { 'https://service.imageboss.me' } let(:client_args) {{ domain: 'https://myassets.com' }} let(:operation_args) { [:cover, width: 100, height: 100] } subject { described_class.new(**client_args) } context 'initialize' do it { expect(subject.instance_variable_get(:@domain)).to eq client_args[:domain] } end context 'path' do let(:path) { subject .path('/assets/img01.jpg') } let(:image_url) { path.operation(*operation_args) } context 'cover' do it { expect(image_url).to eq "#{service}/cover/100x100/https://myassets.com/assets/img01.jpg" } context 'with options' do let(:operation_args) { [:cover, width: 100, height: 100, options: { grayscale: true, blur: 2.0 } ] } it { expect(image_url).to eq "#{service}/cover/100x100/grayscale:true,blur:2.0/https://myassets.com/assets/img01.jpg" } end context 'mode' do let(:operation_args) { [:cover, mode: :entropy, width: 100, height: 100 ] } it { expect(image_url).to eq "#{service}/cover:entropy/100x100/https://myassets.com/assets/img01.jpg" } context 'with options' do let(:operation_args) { [:cover, mode: :entropy, width: 100, height: 100, options: { grayscale: true, blur: 2.0 } ] } it { expect(image_url).to eq "#{service}/cover:entropy/100x100/grayscale:true,blur:2.0/https://myassets.com/assets/img01.jpg" } end end end context 'width' do let(:operation_args) { [:width, width: 100 ] } it { expect(image_url).to eq "#{service}/width/100/https://myassets.com/assets/img01.jpg" } end context 'height' do let(:operation_args) { [:height, height: 200 ] } it { expect(image_url).to eq "#{service}/height/200/https://myassets.com/assets/img01.jpg" } end context 'cdn' do let(:operation_args) { [:cdn] } it { expect(image_url).to eq "#{service}/cdn/https://myassets.com/assets/img01.jpg" } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
imageboss-rb-1.0.0 | spec/imageboss/client_spec.rb |