Sha256: 4249938d69a20778f91315d1b7ff08e970786e0034132fc972063aac2024bf8b

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

require 'spec_helper'

describe LinkThumbnailer::Configuration do

  let(:instance) { described_class.new }

  it { expect(instance.redirect_limit).to         eq(3) }
  it { expect(instance.user_agent).to             eq('link_thumbnailer') }
  it { expect(instance.verify_ssl).to             eq(true) }
  it { expect(instance.http_open_timeout).to      eq(5) }
  it { expect(instance.http_read_timeout).to      eq(5) }
  it { expect(instance.blacklist_urls).to_not     be_empty }
  it { expect(instance.attributes).to             eq([:title, :images, :description, :videos, :favicon]) }
  it { expect(instance.graders).to_not            be_empty }
  it { expect(instance.description_min_length).to eq(25) }
  it { expect(instance.positive_regex).to_not     be_nil }
  it { expect(instance.negative_regex).to_not     be_nil }
  it { expect(instance.image_limit).to            eq(5) }
  it { expect(instance.image_stats).to            eq(true) }

  describe "#http_timeout" do
    it { expect(instance.method(:http_timeout)).to eq(instance.method(:http_open_timeout)) }
    it { expect(instance.method(:http_timeout=)).to eq(instance.method(:http_open_timeout=)) }
  end

  describe '.config' do

    it { expect(LinkThumbnailer.config).to be_a(described_class) }

  end

  describe '.configure' do

    before do
      LinkThumbnailer.stub(:config).and_return(instance)
    end

    context 'when block given' do

      it 'yields' do
        expect(LinkThumbnailer).to receive(:configure).and_yield(instance)
        LinkThumbnailer.configure {|config|}
      end

    end

    context 'when no block given' do

      it 'does nothing' do
        expect(LinkThumbnailer.configure).to be_nil
      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
link_thumbnailer-2.6.1 spec/configuration_spec.rb
link_thumbnailer-2.6.0 spec/configuration_spec.rb
link_thumbnailer-2.5.2 spec/configuration_spec.rb
link_thumbnailer-2.5.1 spec/configuration_spec.rb