Sha256: 9d447742e9e83d2de680833976b5db84349928de74c58e0bc86411e23d97c7c7

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require 'test_helper'

class SiringaControllerTest < ActionController::TestCase

  tests Siringa::SiringaController

  def setup
  end

  def teardown
  end

  test "load_definition action passing existing factory" do
    get :load_definition, { definition: "initial", use_route: "siringa" }
    assert_response :success
  end

  test "load_definition action passing a factory that doesn't exist" do
    get :load_definition, { definition: "papapa", use_route: "siringa" }
    assert_response :method_not_allowed
  end

  test "load_definition action passing arguments" do
    get :load_definition, {
      definition: "definition_with_arguments",
      siringa_args: { name: 'Robb Stark' },
      use_route: "siringa"
    }
    assert_response :success
  end

  test "load_definition action returning JSON response" do
    get :load_definition, {
      definition: "definition_with_return",
      siringa_args: { name: 'Ned' },
      use_route: "siringa"
    }
    assert body['id']
    assert_equal 'Ned', body['name']
    assert_equal 'Stark', body['surname']
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
siringa-0.1.0 test/controllers/siringa_controller_test.rb
siringa-0.0.9 test/controllers/siringa_controller_test.rb
siringa-0.0.8 test/controllers/siringa_controller_test.rb