Namespace
Methods
S
T
Instance Public methods
setup()
# File actionpack/test/controller/webservice_test.rb, line 24
def setup
  @controller = TestController.new
  @integration_session = nil
end
test_check_parameters()
# File actionpack/test/controller/webservice_test.rb, line 29
def test_check_parameters
  with_test_route_set do
    get "/"
    assert_equal '', @controller.response.body
  end
end
test_dasherized_keys_as_json()
# File actionpack/test/controller/webservice_test.rb, line 78
def test_dasherized_keys_as_json
  with_test_route_set do
    post "/?full=1", '{"first-key":{"sub-key":"..."}}', 'CONTENT_TYPE' => 'application/json'
    assert_equal 'action, controller, first-key(sub-key), full', @controller.response.body
    assert_equal "...", @controller.params['first-key']['sub-key']
  end
end
test_parsing_json_doesnot_rescue_exception()
# File actionpack/test/controller/webservice_test.rb, line 86
def test_parsing_json_doesnot_rescue_exception
  with_test_route_set do
    with_params_parsers Mime::JSON => Proc.new { |data| raise Interrupt } do
      assert_raises(Interrupt) do
        post "/", '{"title":"JSON"}}', 'CONTENT_TYPE' => 'application/json'
      end
    end
  end
end
test_post_json()
# File actionpack/test/controller/webservice_test.rb, line 36
def test_post_json
  with_test_route_set do
    post "/", '{"entry":{"summary":"content..."}}', 'CONTENT_TYPE' => 'application/json'

    assert_equal 'entry', @controller.response.body
    assert @controller.params.has_key?(:entry)
    assert_equal 'content...', @controller.params["entry"]['summary']
  end
end
test_put_json()
# File actionpack/test/controller/webservice_test.rb, line 46
def test_put_json
  with_test_route_set do
    put "/", '{"entry":{"summary":"content..."}}', 'CONTENT_TYPE' => 'application/json'

    assert_equal 'entry', @controller.response.body
    assert @controller.params.has_key?(:entry)
    assert_equal 'content...', @controller.params["entry"]['summary']
  end
end
test_register_and_use_json_simple()
# File actionpack/test/controller/webservice_test.rb, line 56
def test_register_and_use_json_simple
  with_test_route_set do
    with_params_parsers Mime::JSON => Proc.new { |data| ActiveSupport::JSON.decode(data)['request'].with_indifferent_access } do
      post "/", '{"request":{"summary":"content...","title":"JSON"}}',
        'CONTENT_TYPE' => 'application/json'

      assert_equal 'summary, title', @controller.response.body
      assert @controller.params.has_key?(:summary)
      assert @controller.params.has_key?(:title)
      assert_equal 'content...', @controller.params["summary"]
      assert_equal 'JSON', @controller.params["title"]
    end
  end
end
test_use_json_with_empty_request()
# File actionpack/test/controller/webservice_test.rb, line 71
def test_use_json_with_empty_request
  with_test_route_set do
    assert_nothing_raised { post "/", "", 'CONTENT_TYPE' => 'application/json' }
    assert_equal '', @controller.response.body
  end
end