Sha256: f168d5b81604d031f424f3b3cd14dbaf298d6f0e7b424cb66b1096eead175274

Contents?: true

Size: 1.62 KB

Versions: 6

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe LadyJosephine::Concerns::SirTrevorImages do

  let(:article) { Article.new title: "Local man thinks wrestling is real" }

  it 'returns an empty list if the document is empty' do
    expect(article.images). to eq []
  end

  it 'returns an empty list if there is no image' do
    article.content_data_hash = {"data" => [] }
    expect(article.images). to eq []
  end

  it 'returns a list of images if they are present' do
    article.content_data_hash = {"data" => [{
      'type' => 'extended_image',
      'data' => {
        'file' => {
          'url'    => 'http://example.com/file_1.jpg',
          'large'  => { 'url' => 'http://example.com/file_1_large.jpg' },
          'medium' => { 'url' => 'http://example.com/file_1_medium.jpg' },
          'small'  => { 'url' => 'http://example.com/file_1_small.jpg' }
        }
      }
    }, {
      'type' => 'extended_image',
      'data' => {
        'file' => {
          'url'    => 'http://example.com/file_2.jpg',
          'large'  => { 'url' => 'http://example.com/file_2_large.jpg' },
          'medium' => { 'url' => 'http://example.com/file_2_medium.jpg' },
          'small'  => { 'url' => 'http://example.com/file_2_small.jpg' }
        }
      }
    }]}
    expect(article.images). to eq [
      "http://example.com/file_1.jpg",
      "http://example.com/file_1_large.jpg",
      "http://example.com/file_1_medium.jpg",
      "http://example.com/file_1_small.jpg",
      "http://example.com/file_2.jpg",
      "http://example.com/file_2_large.jpg",
      "http://example.com/file_2_medium.jpg",
      "http://example.com/file_2_small.jpg",
    ]
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lady_josephine-0.7.0 spec/models/lady_josephine/concerns/sir_trevor_images_spec.rb
lady_josephine-0.6.3 spec/models/lady_josephine/concerns/sir_trevor_images_spec.rb
lady_josephine-0.6.2 spec/models/lady_josephine/concerns/sir_trevor_images_spec.rb
lady_josephine-0.6.1 spec/models/lady_josephine/concerns/sir_trevor_images_spec.rb
lady_josephine-0.6.0 spec/models/lady_josephine/concerns/sir_trevor_images_spec.rb
lady_josephine-0.5.0 spec/models/lady_josephine/concerns/sir_trevor_images_spec.rb