summaryrefslogtreecommitdiff
path: root/test/controllers/downloads_controller_test.rb
blob: f2c47195e951c702bbdccec1361d08f589b1bc02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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