Sha256: aeba2c80e13d8b14759fde68d777949f6e0a62cc05cbd4b53f40a1474b96c538

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

require 'test/unit'

require 'pyre'

class TestPyre < Test::Unit::TestCase
  def setup
    @pyre_campfire = Pyre::Campfire.new('pyre')
    @pyre_email    = 'bot@tie-rack.org'
    @pyre_password = 'pyre99bts'
  end
  
  def login
    @pyre_campfire.login(@pyre_email, @pyre_password)
  end
  
  def test_001_subdomain
    assert_equal('pyre', @pyre_campfire.subdomain)
  end
  
  def test_002_uri
    assert_equal('http://pyre.campfirenow.com', @pyre_campfire.uri)
  end
  
  def test_003_agent
    assert_kind_of(WWW::Mechanize, @pyre_campfire.instance_variable_get('@agent'))
  end
  
  def test_004_login
    assert_equal(false, @pyre_campfire.logged_in?)
    login
    assert(@pyre_campfire.logged_in?, 'Campfire#login failed.')
  end
  
  def test_005_login_fails_with_bad_credentials
    assert_equal(false, @pyre_campfire.logged_in?)
    @pyre_campfire.login('not an email', 'not a password')
    assert_equal(false, @pyre_campfire.logged_in?, 'Campfire#login succeeded with bad credentials!')
  end
  
  def test_006_rooms
    login
    rooms = @pyre_campfire.rooms
    assert_kind_of(Array, rooms)
    assert_equal(false, rooms.empty?, 'Rooms returns an empty array.')
  end
  
  def test_007_logout
    login
    assert(@pyre_campfire.logged_in?, 'Campfire#login failed.')
    @pyre_campfire.logout
    assert_equal(false, @pyre_campfire.logged_in?, 'Campfire#logout failed!')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pyre-0.1.0 test/test_pyre_private.rb