Sha256: 96be06e86e932f8fd4af63676c010a7f82e50a942e050e181d1ec65f5c06344c

Contents?: true

Size: 985 Bytes

Versions: 1

Compression:

Stored size: 985 Bytes

Contents

require 'test_helper'

class SiringaControllerTest < ActionController::TestCase

  tests Siringa::SiringaController

  def setup
  end

  def teardown
  end

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

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

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

  test "load action returning JSON response" do
    get :load, {
      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

1 entries across 1 versions & 1 rubygems

Version Path
siringa-0.0.7 test/controllers/siringa_controller_test.rb