pic_vert_app/test/functional/tiny_urls_controller_test.rb
2013-01-08 23:28:47 +01:00

51 lines
1.3 KiB
Ruby

# -*- encoding : utf-8 -*-
require 'test_helper'
class TinyUrlsControllerTest < ActionController::TestCase
setup do
@tiny_url = tiny_urls(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:tiny_urls)
end
test "should get new" do
get :new
assert_response :success
end
test "should create tiny_url" do
assert_difference('TinyUrl.count') do
post :create, tiny_url: { nbr_views: @tiny_url.nbr_views, slug: @tiny_url.slug, start_at: @tiny_url.start_at, stop_at: @tiny_url.stop_at, url: @tiny_url.url }
end
assert_redirected_to tiny_url_path(assigns(:tiny_url))
end
test "should show tiny_url" do
get :show, id: @tiny_url
assert_response :success
end
test "should get edit" do
get :edit, id: @tiny_url
assert_response :success
end
test "should update tiny_url" do
put :update, id: @tiny_url, tiny_url: { nbr_views: @tiny_url.nbr_views, slug: @tiny_url.slug, start_at: @tiny_url.start_at, stop_at: @tiny_url.stop_at, url: @tiny_url.url }
assert_redirected_to tiny_url_path(assigns(:tiny_url))
end
test "should destroy tiny_url" do
assert_difference('TinyUrl.count', -1) do
delete :destroy, id: @tiny_url
end
assert_redirected_to tiny_urls_path
end
end