Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'test_helper'
- class Admin::BlogsControllerTest < ActionController::TestCase
- context "Admin Blogs controller" do
- context "on GET to :new" do
- setup do
- get :new
- end
- should_respond_with :success
- should_assign_to :current_blog
- should_render_template :new
- should_render_a_form
- end
- context "on POST to :create" do
- setup do
- post :create, :blog => {:title => 'Blog', :description => "saldjf"}
- end
- teardown do
- Blog.destroy_all
- end
- should_redirect_to "Admin::Blog#show" do
- blog = Blog.first
- admin_blog_path(blog)
- end
- should "create blog" do
- assert Blog.exists?(:title => 'Blog')
- end
- end
- context "on GET to :show" do
- setup do
- current_blog = Factory(:blog)
- get :show, :id => current_blog.id
- end
- should_respond_with :success
- should_assign_to :current_blog
- should_render_template :show
- end
- end
- end
Add Comment
Please, Sign In to add comment