Sha256: 3ed25b75bbea2f2073305ab88223d7facb11360b0ef1977faf6a9b13c12e4fd5

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 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 = '201712'

def stub_rooms_request(resp)
  response = mock('Net::HTTPResponse', resp)
  Kindling::Request.expects(:get).with("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)
  response = mock('Net::HTTPResponse', resp)  
  Kindling::Request.expects(:post).with(
    "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

2 entries across 2 versions & 1 rubygems

Version Path
kindling-0.0.3 test/test_helper.rb
kindling-0.0.2 test/test_helper.rb