Sha256: da7247f81d996a66911cf68f4765d7168d73b455e570c86e54126b36b1377b88
Contents?: true
Size: 1.31 KB
Versions: 5
Compression:
Stored size: 1.31 KB
Contents
require 'test_helper' class ExtrTest < ActiveSupport::TestCase #include Rack::Test::Methods def call_rails(env_params={}) @request = ActionDispatch::TestRequest.new(env_params) @request['REQUEST_METHOD'] = "POST" @request.host = "localhost" @request.port = 3000 @request.request_uri = Extr::Config::ROUTER_PATH @request['PATH_INFO'] = Extr::Config::ROUTER_PATH @request['HTTP_ACCEPT'] = 'application/json' #p @response = Dummy::Application.routes.call(@request.env) #@response = (env.delete(:app) || Dummy::Application.routes).call(env).to_a end test "assert_extr_core_structure" do assert_kind_of Module, Extr assert_kind_of String, Extr::Config::ROUTER_PATH end test "no_ext_direct_request_by_get" do call_rails test_body = '{"bar":"foo"}' callback = 'foo' app = lambda { |env| [200, {'Content-Type' => 'application/json'}, [test_body]] } body = Extr::Router.new(app, Extr::Config::ROUTER_PATH).call(@request).to_a p body #p body #body.should.equal ["#{callback}(#{test_body})"] #call_rails #assert_equal 404, @response.first #assert_match Extr::Config::ROUTER_PATH #assert_response :missing end test "make post" do #get "#{Extr::Config::ROUTER_PATH}" #get "#{Extr::Config::ROUTER_PATH}" #assert_response 404 end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
extr-1.0.4 | test/extr_test.rb |
extr-1.0.3 | test/extr_test.rb |
extr-1.0.2 | test/extr_test.rb |
extr-1.0.1 | test/extr_test.rb |
extr-1.0.0 | test/extr_test.rb |