diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/fixtures/assets.yml | 7 | ||||
| -rw-r--r-- | test/functional/assets_controller_test.rb | 45 | ||||
| -rw-r--r-- | test/unit/asset_test.rb | 8 | ||||
| -rw-r--r-- | test/unit/helpers/assets_helper_test.rb | 4 |
4 files changed, 64 insertions, 0 deletions
diff --git a/test/fixtures/assets.yml b/test/fixtures/assets.yml new file mode 100644 index 0000000..5bf0293 --- /dev/null +++ b/test/fixtures/assets.yml | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html | ||
| 2 | |||
| 3 | # one: | ||
| 4 | # column: value | ||
| 5 | # | ||
| 6 | # two: | ||
| 7 | # column: value | ||
diff --git a/test/functional/assets_controller_test.rb b/test/functional/assets_controller_test.rb new file mode 100644 index 0000000..7b838cc --- /dev/null +++ b/test/functional/assets_controller_test.rb | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class AssetsControllerTest < ActionController::TestCase | ||
| 4 | test "should get index" do | ||
| 5 | get :index | ||
| 6 | assert_response :success | ||
| 7 | assert_not_nil assigns(:assets) | ||
| 8 | end | ||
| 9 | |||
| 10 | test "should get new" do | ||
| 11 | get :new | ||
| 12 | assert_response :success | ||
| 13 | end | ||
| 14 | |||
| 15 | test "should create asset" do | ||
| 16 | assert_difference('Asset.count') do | ||
| 17 | post :create, :asset => { } | ||
| 18 | end | ||
| 19 | |||
| 20 | assert_redirected_to asset_path(assigns(:asset)) | ||
| 21 | end | ||
| 22 | |||
| 23 | test "should show asset" do | ||
| 24 | get :show, :id => assets(:one).to_param | ||
| 25 | assert_response :success | ||
| 26 | end | ||
| 27 | |||
| 28 | test "should get edit" do | ||
| 29 | get :edit, :id => assets(:one).to_param | ||
| 30 | assert_response :success | ||
| 31 | end | ||
| 32 | |||
| 33 | test "should update asset" do | ||
| 34 | put :update, :id => assets(:one).to_param, :asset => { } | ||
| 35 | assert_redirected_to asset_path(assigns(:asset)) | ||
| 36 | end | ||
| 37 | |||
| 38 | test "should destroy asset" do | ||
| 39 | assert_difference('Asset.count', -1) do | ||
| 40 | delete :destroy, :id => assets(:one).to_param | ||
| 41 | end | ||
| 42 | |||
| 43 | assert_redirected_to assets_path | ||
| 44 | end | ||
| 45 | end | ||
diff --git a/test/unit/asset_test.rb b/test/unit/asset_test.rb new file mode 100644 index 0000000..58aba76 --- /dev/null +++ b/test/unit/asset_test.rb | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class AssetTest < ActiveSupport::TestCase | ||
| 4 | # Replace this with your real tests. | ||
| 5 | test "the truth" do | ||
| 6 | assert true | ||
| 7 | end | ||
| 8 | end | ||
diff --git a/test/unit/helpers/assets_helper_test.rb b/test/unit/helpers/assets_helper_test.rb new file mode 100644 index 0000000..ae50bff --- /dev/null +++ b/test/unit/helpers/assets_helper_test.rb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class AssetsHelperTest < ActionView::TestCase | ||
| 4 | end | ||
