Sha256: e878d80951e8ffab20f2d65e2d41fe894feefbb7b9083dc3b105e6be889b60a4

Contents?: true

Size: 665 Bytes

Versions: 8

Compression:

Stored size: 665 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 { img_url_filter.reject?('http://valid.com/foo/bar.png').should be_false }

    end

    context "when img_url does contain any blacklisted urls" do

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

    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
link_thumbnailer-1.0.5 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.4 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.3 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.2 spec/img_url_filter_spec.rb
link_thumbnailer-1.0.0 spec/img_url_filter_spec.rb
link_thumbnailer-0.0.6 spec/img_url_filter_spec.rb
link_thumbnailer-0.0.5 spec/img_url_filter_spec.rb
link_thumbnailer-0.0.4 spec/img_url_filter_spec.rb