Sha256: c6c6ea77e5cc8a07a1866e94de87daac6785c1754f60d90a9e76b7c7ef2372c6

Contents?: true

Size: 1.85 KB

Versions: 3

Compression:

Stored size: 1.85 KB

Contents

require 'spec_helper'

describe Stratify::Instapaper::Presenter do
  describe "#domain" do
    it "returns just the domain of the Instapaper item's URL" do
      activity = Stratify::Instapaper::Activity.new(:url => "http://googledocs.blogspot.com/2011/02/12-new-file-formats-in-google-docs.html")
      presenter = Stratify::Instapaper::Presenter.new(activity)
      presenter.domain.should == "googledocs.blogspot.com"
    end
  end

  describe "summary" do
    it "returns the Instapaper item's title when a title is present" do
      activity = Stratify::Instapaper::Activity.new(:title => "some title")
      presenter = Stratify::Instapaper::Presenter.new(activity)
      presenter.summary.should == "some title"
    end

    it "returns the Instapaper item's URL when the item does not have a title" do
      activity = Stratify::Instapaper::Activity.new(:title => "", :url => "http://example.com")
      presenter = Stratify::Instapaper::Presenter.new(activity)
      presenter.summary.should == "http://example.com"
    end
  end

  describe "details" do
    it "provides the Instapaper item's domain and description" do
      activity = Stratify::Instapaper::Activity.new(:url => "http://nex-3.com/posts/104-haml-and-sass-3-1-are-released", 
                                       :description => "dhh: Great new stuff for Sass 3.1")
      presenter = Stratify::Instapaper::Presenter.new(activity)
      presenter.details.should == "nex-3.com \u2022 dhh: Great new stuff for Sass 3.1"
    end

    it "provides only the Instapaper item's domain when the description is blank" do
      activity = Stratify::Instapaper::Activity.new(:url => "http://nex-3.com/posts/104-haml-and-sass-3-1-are-released", 
                                       :description => "")
      presenter = Stratify::Instapaper::Presenter.new(activity)
      presenter.details.should == "nex-3.com"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stratify-instapaper-0.1.3 spec/stratify-instapaper/presenter_spec.rb
stratify-instapaper-0.1.2 spec/stratify-instapaper/presenter_spec.rb
stratify-instapaper-0.1.0 spec/stratify-instapaper/presenter_spec.rb