Sha256: 4a32b6b90cdf1a2c78a7f7af21831e32dd670cfcf4010176c72d4c6040033f52

Contents?: true

Size: 1.05 KB

Versions: 23

Compression:

Stored size: 1.05 KB

Contents

require "spec_helper"

class TestEngine
  def self.===(uri)
    true
  end
end

describe Onebox::Matcher do

  describe "oneboxed" do

    describe "with a path" do
      let(:url) { "http://party.time.made.up-url.com/beep/boop" }
      let(:matcher) { Onebox::Matcher.new(url) }

      it "finds an engine" do
        matcher.stubs(:ordered_engines).returns([TestEngine])
        matcher.oneboxed.should_not be_nil
      end
    end

    describe "without a path" do
      let(:url) { "http://party.time.made.up-url.com/" }
      let(:matcher) { Onebox::Matcher.new(url) }

      it "doesn't find an engine" do
        matcher.stubs(:ordered_engines).returns([TestEngine])
        matcher.oneboxed.should be_nil
      end
    end

    describe "without a path but has a query string" do
      let(:url) { "http://party.time.made.up-url.com/?article_id=1234" }
      let(:matcher) { Onebox::Matcher.new(url) }

      it "it finds an engine" do
        matcher.stubs(:ordered_engines).returns([TestEngine])
        matcher.oneboxed.should_not be_nil
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
onebox-1.5.3 spec/lib/onebox/matcher_spec.rb
onebox-1.5.2 spec/lib/onebox/matcher_spec.rb
onebox-1.5.1 spec/lib/onebox/matcher_spec.rb
onebox-1.5.0 spec/lib/onebox/matcher_spec.rb
onebox-1.4.9 spec/lib/onebox/matcher_spec.rb
onebox-1.4.8 spec/lib/onebox/matcher_spec.rb
onebox-1.4.7 spec/lib/onebox/matcher_spec.rb
onebox-1.4.5 spec/lib/onebox/matcher_spec.rb
onebox-1.4.4 spec/lib/onebox/matcher_spec.rb
onebox-1.4.3 spec/lib/onebox/matcher_spec.rb
onebox-1.4.2 spec/lib/onebox/matcher_spec.rb
onebox-1.4.1 spec/lib/onebox/matcher_spec.rb
onebox-1.4.0 spec/lib/onebox/matcher_spec.rb
onebox-1.3.9 spec/lib/onebox/matcher_spec.rb
onebox-1.3.8 spec/lib/onebox/matcher_spec.rb
onebox-1.3.7 spec/lib/onebox/matcher_spec.rb
onebox-1.3.6 spec/lib/onebox/matcher_spec.rb
onebox-1.3.5 spec/lib/onebox/matcher_spec.rb
onebox-1.3.4 spec/lib/onebox/matcher_spec.rb
onebox-1.3.3 spec/lib/onebox/matcher_spec.rb