Sha256: 041e4a4629f4b72251091b8125a0977ab2e55230fece013a38df8ea576f79e41

Contents?: true

Size: 1.05 KB

Versions: 19

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path 'test_helper', File.dirname(__FILE__)

class TestTw < MiniTest::Test

  def setup
    @client = Tw::Client.new
    @client.auth
  end

  def user?(str)
    return false unless str.kind_of? String
    str =~ /^[a-zA-Z0-9_]+$/
  end

  def response?(arr)
    return false unless arr.kind_of? Array
    arr.each do |i|
      return false if !(i.id.class == Fixnum and
                        (user? i.user or (user? i.user[:to] and user? i.user[:from])) and
                        i.text.kind_of? String and
                        i.time.kind_of? Time)
    end
    return true
  end
  
  def test_mentions
    assert response? @client.mentions
  end

  def test_home_timeline
    assert response? @client.home_timeline
  end

  def test_search
    assert response? @client.search('ruby')
  end

  def test_user_timeline
    assert response? @client.user_timeline 'shokai'
  end

  def test_list_timeline
    assert response? @client.list_timeline('shokai', 'tw-user')
  end

  def test_direct_message
    assert response? @client.direct_messages
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
tw-1.0.10 test/test_tw.rb
tw-1.0.9 test/test_tw.rb
tw-1.0.8 test/test_tw.rb
tw-1.0.7 test/test_tw.rb
tw-1.0.6 test/test_tw.rb
tw-1.0.5 test/test_tw.rb
tw-1.0.4 test/test_tw.rb
tw-1.0.3 test/test_tw.rb
tw-1.0.2 test/test_tw.rb
tw-1.0.1 test/test_tw.rb
tw-1.0.0 test/test_tw.rb
tw-0.5.2 test/test_tw.rb
tw-0.5.1 test/test_tw.rb
tw-0.5.0 test/test_tw.rb
tw-0.4.9 test/test_tw.rb
tw-0.4.8 test/test_tw.rb
tw-0.4.7 test/test_tw.rb
tw-0.4.6 test/test_tw.rb
tw-0.4.5 test/test_tw.rb