Sha256: 9337aa2c4fca358f41d62598f6ae009b768f885b14f3661c2896c3946247949a

Contents?: true

Size: 673 Bytes

Versions: 8

Compression:

Stored size: 673 Bytes

Contents

require 'spec_helper'

describe LinkThumbnailer::ImgUrlFilter do

  it { should respond_to :reject? }

  describe ".reject?" do

    let(:img_url_filter) { LinkThumbnailer::ImgUrlFilter.new }

    before do
      LinkThumbnailer.configure {|config| config.blacklist_urls = [
        %r{^http://not_valid\.net/}
      ]}
    end

    context "when img_url does not contain any blacklisted urls" do

      it { expect(img_url_filter.reject?('http://valid.com/foo/bar.png')).to be_false }

    end

    context "when img_url does contain any blacklisted urls" do

      it { expect(img_url_filter.reject?('http://not_valid.net/foo/bar.png')).to be_true }

    end

  end

end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
link_thumbnailer-1.1.2 spec/img_url_filter_spec.rb
link_thumbnailer-1.1.1 spec/img_url_filter_spec.rb
link_thumbnailer-1.1.0 spec/img_url_filter_spec.rb
rcarvalho-link_thumbnailer-1.0.9.1 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.9 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.8 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.7 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.6 spec/img_url_filter_spec.rb