diff options
| author | Jesse Morgan <jesse@jesterpm.net> | 2015-02-25 18:47:09 -0800 | 
|---|---|---|
| committer | Jesse Morgan <jesse@jesterpm.net> | 2015-02-25 18:47:09 -0800 | 
| commit | 4e94e31aa0acda54ae962840b57ae42ca6e71185 (patch) | |
| tree | 19fa5fdc8c3bea56fb93463508a81514acd0f604 /test | |
| parent | f031bdc3e5214c699123830d8cc9f9309b792a68 (diff) | |
rails generate scaffold Download
Diffstat (limited to 'test')
| -rw-r--r-- | test/controllers/downloads_controller_test.rb | 49 | ||||
| -rw-r--r-- | test/fixtures/downloads.yml | 15 | ||||
| -rw-r--r-- | test/models/download_test.rb | 7 | 
3 files changed, 71 insertions, 0 deletions
| diff --git a/test/controllers/downloads_controller_test.rb b/test/controllers/downloads_controller_test.rb new file mode 100644 index 0000000..f2c4719 --- /dev/null +++ b/test/controllers/downloads_controller_test.rb @@ -0,0 +1,49 @@ +require 'test_helper' + +class DownloadsControllerTest < ActionController::TestCase +  setup do +    @download = downloads(:one) +  end + +  test "should get index" do +    get :index +    assert_response :success +    assert_not_nil assigns(:downloads) +  end + +  test "should get new" do +    get :new +    assert_response :success +  end + +  test "should create download" do +    assert_difference('Download.count') do +      post :create, download: { description: @download.description, filename: @download.filename, hits: @download.hits, name: @download.name, type: @download.type } +    end + +    assert_redirected_to download_path(assigns(:download)) +  end + +  test "should show download" do +    get :show, id: @download +    assert_response :success +  end + +  test "should get edit" do +    get :edit, id: @download +    assert_response :success +  end + +  test "should update download" do +    patch :update, id: @download, download: { description: @download.description, filename: @download.filename, hits: @download.hits, name: @download.name, type: @download.type } +    assert_redirected_to download_path(assigns(:download)) +  end + +  test "should destroy download" do +    assert_difference('Download.count', -1) do +      delete :destroy, id: @download +    end + +    assert_redirected_to downloads_path +  end +end diff --git a/test/fixtures/downloads.yml b/test/fixtures/downloads.yml new file mode 100644 index 0000000..cfcc392 --- /dev/null +++ b/test/fixtures/downloads.yml @@ -0,0 +1,15 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: +  name: MyString +  filename: MyString +  type:  +  description: MyText +  hits: 1 + +two: +  name: MyString +  filename: MyString +  type:  +  description: MyText +  hits: 1 diff --git a/test/models/download_test.rb b/test/models/download_test.rb new file mode 100644 index 0000000..471c300 --- /dev/null +++ b/test/models/download_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class DownloadTest < ActiveSupport::TestCase +  # test "the truth" do +  #   assert true +  # end +end | 
