Sha256: 0d2be56ba882ecb4988fd5c8a619247a5593d5ab7c40e55ed9e9614cc71f08b9

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

require "rubygems"
require "bundler/setup"
require "ruby-transmitsms"
require "test/unit"
require "vcr"

VCR.configure do |c|
  c.cassette_library_dir = "fixtures/vcr_cassettes"
  c.hook_into :webmock
end

class KeywordsApiTest < Test::Unit::TestCase

  def setup()
    @api = KeywordsApi.new("15ad266c538fb36c4d90f01055aef494", "moose")
  end

  def test_add_keyword()
    VCR.use_cassette("keywords_api_add_keyword") do
      response = @api.add_keyword("NEWS", 61422222222)

      assert response.code == 200
      assert response.body["keyword"] == "NEWS"
      assert response.body["number"] == 61422222222
      assert response.body["status"] == "open"
      assert response.body["error"]["code"] == "SUCCESS"
      assert response.body["error"]["description"] == "OK"
    end
  end

  def test_edit_keyword()
    VCR.use_cassette("keywords_api_edit_keyword") do
      response = @api.edit_keyword("NEWS", 61422222222)

      assert response.code == 200
      assert response.body["keyword"] == "NEWS"
      assert response.body["number"] == 61422222222
      assert response.body["status"] == "open"
      assert response.body["error"]["code"] == "SUCCESS"
      assert response.body["error"]["description"] == "OK"
    end
  end

  def test_get_keyword()
    VCR.use_cassette("keywords_api_get_keywords") do
      response = @api.get_keywords(61422222222)

      assert response.code == 200
      assert response.body["keywords_total"] == 6
      assert response.body["keywords"].length == 6
      assert response.body["error"]["code"] == "SUCCESS"
      assert response.body["error"]["description"] == "OK"
    end
  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
tsms-0.1.3 spec/keywords_api_spec.rb
ruby-transmitsms-0.1.3 spec/keywords_api_spec.rb
ruby-transmitsms-0.1.2 spec/keywords_api_spec.rb
ruby-transmitsms-0.1.1 spec/keywords_api_spec.rb
ruby-transmitsms-0.1.0 spec/keywords_api_spec.rb
ruby-transmitsms-0.0.1 spec/keywords_api_spec.rb