Sha256: b09d66061e59dfdf3114d5651e87fa1a4ef4057e8a4d229f1ad945c600955518

Contents?: true

Size: 785 Bytes

Versions: 1

Compression:

Stored size: 785 Bytes

Contents

require 'spec_helper'

describe Zemanta::Enhancer do
  context "enhance" do
    let(:input) { "Here be dragons: Inca trail to Machu Picchu, Machu Pichu" }

    it "returns string" do
      stub_zemanta_enhancer!
      Zemanta::Enhancer.new(input).enhance.should be_a String
    end

    it "converts keywords to links" do
      stub_zemanta_enhancer!
      Zemanta::Enhancer.new(input).enhance.scan('<a').should have(2).elements
    end

    describe "no_duplicates option" do
      it "doesn't use the same link multiple times" do
        stub_zemanta_enhancer!
        input = "I like Machu Pichu. Machu Pichu? Yeah, Machu Pichu"
        output = Zemanta::Enhancer.new(input, no_duplicates: true).enhance
        output.scan('<a').should have(1).elements
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zemanta_client-0.0.5 spec/zemanta/enhancer_spec.rb