Sha256: af2a012f82786f6c666ddb6e05fce50e87f6a2b466ee4135c8088902968b173a
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
require 'test_helper' class Admin::SnippetsControllerTest < ActionController::TestCase def test_index get :index assert_template 'index' end def test_show get :show, :id => Snippet.first assert_template 'show' end def test_new get :new assert_template 'new' end def test_create_invalid Snippet.any_instance.stubs(:valid?).returns(false) post :create assert_template 'new' end def test_create_valid Snippet.any_instance.stubs(:valid?).returns(true) post :create assert_redirected_to admin_snippet_url(assigns(:snippet)) end def test_edit get :edit, :id => Snippet.first assert_template 'edit' end def test_update_invalid Snippet.any_instance.stubs(:valid?).returns(false) put :update, :id => Snippet.first assert_template 'edit' end def test_update_valid Snippet.any_instance.stubs(:valid?).returns(true) put :update, :id => Snippet.first assert_redirected_to admin_snippet_url(assigns(:snippet)) end def test_destroy snippet = Snippet.first delete :destroy, :id => snippet assert_redirected_to admin_snippets_url assert !Snippet.exists?(snippet.id) end end
Version data entries
15 entries across 15 versions & 1 rubygems