Sha256: 06427c457568b218e2cf0019e94621b773a814911e297fb5658d9c4ecc6db644

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

require_relative '../../spec_helper'
require 'imgurapi'

describe Imgurapi::Image do

  it 'creates an Image with the fields provided' do
    image = Imgurapi::Image.new(a: 1, b: 2)

    expect(image.a).to eq 1
    expect(image.b).to eq 2
  end

  it 'returns a download URL' do
    image = Imgurapi::Image.new(id: 'hash')

    expect(image.url).to eq "http://i.imgur.com/hash.jpg"
    expect(image.url(size: :random_size)).to eq "http://i.imgur.com/hash.jpg"
    expect(image.url(size: :small_square)).to eq "http://i.imgur.com/hashs.jpg"
    expect(image.url(size: :large_thumbnail, use_ssl: false)).to eq "http://i.imgur.com/hashl.jpg"
    expect(image.url(use_ssl: true)).to eq "https://i.imgur.com/hash.jpg"
    expect(image.url(size: :large_thumbnail, use_ssl: true)).to eq "https://i.imgur.com/hashl.jpg"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
imgurapi-3.2.2 spec/imgurapi/models/image_spec.rb
imgurapi-3.2.1 spec/imgurapi/models/image_spec.rb