Sha256: 404221d170f8c50dc9dcae77c2c2089c5e8d2ffff9a9a9079334c31bb512b686

Contents?: true

Size: 1.19 KB

Versions: 27

Compression:

Stored size: 1.19 KB

Contents

require 'test_helper'

class NavigationTest < ActionDispatch::IntegrationTest
  def setup
    Bot::Adapter::Test.empty_messages
  end

  test "notify" do
    post "/bot/notify"
    assert_equal 200, status

    post "/bot/notify", {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>true, "from"=>"bnmrrs", "timestamp"=>1452785908454, "type"=>"text", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}]}
    assert_text_response('Hello text!')
  end

  test "notify special types" do
    post "/bot/notify", {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>true, "from"=>"bnmrrs", "timestamp"=>1452785908454, "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}]}
    assert_text_response('Hello scan!')
  end

  test "notify multi types" do
    post "/bot/notify", {"messages"=>[{"body"=>"multi", "readReceiptRequested"=>true, "from"=>"bnmrrs", "timestamp"=>1452785908454, "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}]}
    assert_text_response('Hello multi!')
  end

  def assert_text_response(message)
    assert_equal 200, status
    assert_equal Bot::Adapter::Test.sent_messages.count, 1
    assert_equal Bot::Adapter::Test.sent_messages.first["body"], message
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
bot-0.0.46 test/integration/navigation_test.rb
bot-0.0.45 test/integration/navigation_test.rb
bot-0.0.44 test/integration/navigation_test.rb
bot-0.0.43 test/integration/navigation_test.rb
bot-0.0.42 test/integration/navigation_test.rb
bot-0.0.41 test/integration/navigation_test.rb
bot-0.0.40 test/integration/navigation_test.rb
bot-0.0.39 test/integration/navigation_test.rb
bot-0.0.38 test/integration/navigation_test.rb
bot-0.0.37 test/integration/navigation_test.rb
bot-0.0.35 test/integration/navigation_test.rb
bot-0.0.34 test/integration/navigation_test.rb
bot-0.0.33 test/integration/navigation_test.rb
bot-0.0.32 test/integration/navigation_test.rb
bot-0.0.31 test/integration/navigation_test.rb
bot-0.0.30 test/integration/navigation_test.rb
bot-0.0.29 test/integration/navigation_test.rb
bot-0.0.28 test/integration/navigation_test.rb
bot-0.0.27 test/integration/navigation_test.rb
bot-0.0.26 test/integration/navigation_test.rb