Sha256: 44b2fd2182babf97fb2e8f0cdad9268b6144d8099098447c9511a87c0efb2eca

Contents?: true

Size: 1.12 KB

Versions: 3

Compression:

Stored size: 1.12 KB

Contents

require 'test_helper'

module SipgateIo
  class EventsControllerTest < ActionController::TestCase
    setup do
      @routes = Engine.routes
    end

    test "create without params gives 500" do
      post :create
      assert_response :error
    end

    test "a new call" do
      post :create, { to: "12345",
                     from: "anonymous",
                     direction: "in",
                     event: "newCall",
                     callId: "55555",
                     user: ["Bob"]
                   }
      assert_response :success
    end

    test "a new call with missing to/from" do
      post :create, { direction: "in",
                     event: "newCall",
                     callId: "55555",
                     user: ["Bob"]
                   }
      assert_response :error
    end

    test "a new call with invalid to/from" do
      post :create, { to: "",
                     from: "peter",
                     direction: "in",
                     event: "newCall",
                     callId: "55555",
                     user: ["Bob"]
                   }
      assert_response :error
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sipgate_io-0.3.0 test/controllers/sipgate_io/events_controller_test.rb
sipgate_io-0.2.0 test/controllers/sipgate_io/events_controller_test.rb
sipgate_io-0.1.6 test/controllers/sipgate_io/events_controller_test.rb