Sha256: 5fe10b187673b4f93d4fd3cfcd5f6d16b6a82c16fdd208d7295e22a277c57fb8

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

require 'helper'

describe Wayback::Page do

  describe "#==" do
    it "returns true when objects IDs are the same" do
      saved_search = Wayback::Page.new(:id => 1, :name => "foo")
      other = Wayback::Page.new(:id => 1, :name => "bar")
      expect(saved_search == other).to be_true
    end
    it "returns false when objects IDs are different" do
      saved_search = Wayback::Page.new(:id => 1)
      other = Wayback::Page.new(:id => 2)
      expect(saved_search == other).to be_false
    end
    it "returns false when classes are different" do
      saved_search = Wayback::Page.new(:id => 1)
      other = Wayback::Identity.new(:id => 1)
      expect(saved_search == other).to be_false
    end
  end

  describe "to_s" do
    it "returns string when valid" do
      html = Wayback::Page.new(:id => 1, :html => "foo").to_s
      expect(html.class == String).to be_true
      expect(html == "foo").to be_true
    end
    it "returns blank when no HTML" do
      html = Wayback::Page.new(:id => 1).to_s
      expect(html.class == String).to be_true
      expect(html == "").to be_true
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wayback-0.3.1 spec/wayback/page_spec.rb
wayback-0.2.1 spec/wayback/page_spec.rb
wayback-0.2.0 spec/wayback/page_spec.rb
wayback-0.1.0 spec/wayback/page_spec.rb