added news updates ui
This commit is contained in:
59
test/functional/news_updates_controller_test.rb
Normal file
59
test/functional/news_updates_controller_test.rb
Normal file
@@ -0,0 +1,59 @@
|
||||
require 'test_helper'
|
||||
|
||||
class NewsUpdatesControllerTest < ActionController::TestCase
|
||||
context "the news updates controller" do
|
||||
setup do
|
||||
@admin = Factory.create(:admin_user)
|
||||
CurrentUser.user = @admin
|
||||
CurrentUser.ip_addr = "127.0.0.1"
|
||||
@news_update = Factory.create(:news_update)
|
||||
end
|
||||
|
||||
teardown do
|
||||
CurrentUser.user = nil
|
||||
CurrentUser.ip_addr = nil
|
||||
end
|
||||
|
||||
context "index action" do
|
||||
should "render" do
|
||||
get :index, {}, :user_id => @admin.id
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "new action" do
|
||||
should "render" do
|
||||
get :new, {}, :user_id => @admin.id
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "edit action" do
|
||||
should "render" do
|
||||
get :edit, {:id => @news_update.id}, {:user_id => @admin.id}
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
context "update action" do
|
||||
should "work" do
|
||||
post :update, {:id => @news_update.id, :news_update => {:message => "zzz"}}, {:user_id => @admin.id}
|
||||
assert_redirected_to(news_updates_path)
|
||||
end
|
||||
end
|
||||
|
||||
context "create action" do
|
||||
should "work" do
|
||||
post :create, {:news_update => {:message => "zzz"}}, {:user_id => @admin.id}
|
||||
assert_redirected_to(news_updates_path)
|
||||
end
|
||||
end
|
||||
|
||||
context "destroy action" do
|
||||
should "work" do
|
||||
post :destroy, {:id => @news_update.id, :format => "js"}, {:user_id => @admin.id}
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user