Sha256: 41797e9794c7ed7976a1ee8b6c3f39989cf58e9044b45d4c4dd8c83a1b44e695

Contents?: true

Size: 1 KB

Versions: 10

Compression:

Stored size: 1 KB

Contents

require File.dirname(__FILE__) + "/../spec_helper"

describe 'Ping::Pinger with Test::Unit' do
  before do
    # avoid mocking constructor until we need it for something
    @pinger = Ping::Pinger.allocate
    class << @pinger
      attr_writer :response
    end
  end

  def test_pingback_url_nil
    @pinger.response = mock('response')
    @pinger.response.stub!(:body).and_return('')
    @pinger.response.stub!(:[]).and_return(nil)
    assert_nil @pinger.pingback_url
  end

  # TODO: why do we assume that we can XML attribute order?
  def test_pingback_url_from_body
    @pinger.response = mock('response')
    @pinger.response.stub!(:body).and_return('<link rel="pingback" href="foo" />')
    @pinger.response.stub!(:[]).and_return(nil)
    assert_equal 'foo', @pinger.pingback_url
  end

  def test_pingback_url
    @pinger.response = mock('response')
    @pinger.response.stub!(:body).and_return('')
    @pinger.response.stub!(:[]).and_return(:x_pingback)
    assert_equal :x_pingback, @pinger.pingback_url
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
typo-5.0.3.98.1 spec/models/ping_pinger_spec.rb
typo-5.0.3.98 spec/models/ping_pinger_spec.rb
typo-5.1.2 spec/models/ping_pinger_spec.rb
typo-5.1.1 spec/models/ping_pinger_spec.rb
typo-5.1.3 spec/models/ping_pinger_spec.rb
typo-5.1.98 spec/models/ping_pinger_spec.rb
typo-5.1 spec/models/ping_pinger_spec.rb
typo-5.2 spec/models/ping_pinger_spec.rb
typo-5.2.98 spec/models/ping_pinger_spec.rb
typo-5.3 spec/models/ping_pinger_spec.rb