Sha256: 4234c3a05947eee17d65a0e963ef6f3a1d907f36a0132db7fd3d819d6b1992c5

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'test/unit'
require 'shoulda'
require 'mocha'

require File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib', 'kindling')

def fixture_file(filename)
  return '' if filename == ''
  file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
  File.read(file_path)
end

TEST_SUBDOMAIN = 'testsubdomain'
TEST_API_TOKEN = '787654567654323456789098765432345678765432'
TEST_ROOM_ID = 206877
TEST_ROOM_NAME = 'Room 3'

def stub_rooms_request(resp, ssl = false)
  response = mock('Net::HTTPResponse', resp)
  Kindling::Request.expects(:get).with("#{ssl ? 'https' : 'http'}://#{TEST_SUBDOMAIN}.campfirenow.com/rooms.json", {:basic_auth => {:password => 'x', :username => "#{TEST_API_TOKEN}"}}).returns(response)
end

def stub_send_message_request(message, resp, ssl = false)
  response = mock('Net::HTTPResponse', resp)  
  Kindling::Request.expects(:post).with(
    "#{ssl ? 'https' : 'http'}://#{TEST_SUBDOMAIN}.campfirenow.com/room/#{TEST_ROOM_ID}/speak.json", 
    :body => {:message => {:body => message, :type => "Textmessage"}}.to_json, 
    :basic_auth => {:password => 'x', :username => "#{TEST_API_TOKEN}"}).returns(response)
end



Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kindling-1.0.1 test/test_helper.rb