Sha256: 5a8d588495399af5840bd03579306d111750a6f4d354ca08ddb5d76ae326c40f

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class RemoteCampfireTest < Test::Unit::TestCase
  
  def setup
    # @subdomain = 'domain'
    # @user, @pass = 'email@example.com', 'password'
    @ssl = false
    raise "Set your campfire credentials before running the remote tests" unless @user && @pass && @subdomain
    @campfire = Tinder::Campfire.new @subdomain, :ssl => @ssl
  end
  
  def test_ssl_required
    if @ssl
      campfire = Tinder::Campfire.new @subdomain
      assert_raises(Tinder::SSLRequiredError) do
        campfire.login(@user, @pass)
      end
    end
  end
  
  def test_create_and_delete_room
    assert login
    assert @campfire.logged_in?
    
    room = @campfire.create_room("Testing#{Time.now.to_i}")
    
    assert_instance_of Tinder::Room, room
    assert_not_nil room.id
    
    room.name = "new name"
    assert_equal "new name", room.name
    
    room.destroy
    assert_nil @campfire.find_room_by_name(room.name)
    
    assert @campfire.logout
  ensure
    room.destroy rescue nil
  end
  
  def test_failed_login
    assert_raises(Tinder::Error) { @campfire.login(@user, 'notmypassword') }
    assert !@campfire.logged_in?
  end
  
  def test_find_nonexistent_room
    login
    assert_nil @campfire.find_room_by_name('No Room Should Have This Name')
  end

private

  def login(user = @user, pass = @pass)
    @campfire.login(user, pass)
  end
  
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
theIV-tinder-1.2.2 test/remote/remote_campfire_test.rb
timriley-tinder-1.1.9 test/remote/remote_campfire_test.rb
tinder-0.1.9 test/remote/remote_campfire_test.rb
tinder-0.1.8 test/remote/remote_campfire_test.rb
tinder-1.1.7 test/remote/remote_campfire_test.rb
tinder-1.2.0 test/remote/remote_campfire_test.rb