From a5922502d5d1ec053375c07ba12af0475d30adbe Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Sun, 13 Jan 2013 16:39:33 +0000 Subject: gateway tests --- test/functional/gateways_controller_test.rb | 49 +++++++++++++++++++++++++++++ test/unit/gateway_test.rb | 7 +++++ 2 files changed, 56 insertions(+) create mode 100644 test/functional/gateways_controller_test.rb create mode 100644 test/unit/gateway_test.rb (limited to 'test') diff --git a/test/functional/gateways_controller_test.rb b/test/functional/gateways_controller_test.rb new file mode 100644 index 0000000..e0928dd --- /dev/null +++ b/test/functional/gateways_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class GatewaysControllerTest < ActionController::TestCase + setup do + @gateway = gateways(:one) + end + + test "should get index" do + get :index + assert_response :success + assert_not_nil assigns(:gateways) + end + + test "should get new" do + get :new + assert_response :success + end + + test "should create gateway" do + assert_difference('Gateway.count') do + post :create, gateway: @gateway.attributes + end + + assert_redirected_to gateway_path(assigns(:gateway)) + end + + test "should show gateway" do + get :show, id: @gateway.to_param + assert_response :success + end + + test "should get edit" do + get :edit, id: @gateway.to_param + assert_response :success + end + + test "should update gateway" do + put :update, id: @gateway.to_param, gateway: @gateway.attributes + assert_redirected_to gateway_path(assigns(:gateway)) + end + + test "should destroy gateway" do + assert_difference('Gateway.count', -1) do + delete :destroy, id: @gateway.to_param + end + + assert_redirected_to gateways_path + end +end diff --git a/test/unit/gateway_test.rb b/test/unit/gateway_test.rb new file mode 100644 index 0000000..4c40dc9 --- /dev/null +++ b/test/unit/gateway_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class GatewayTest < ActiveSupport::TestCase + def test_should_be_valid + assert Gateway.new.valid? + end +end -- cgit v1.2.3