agenda-libre-ruby/test/controllers/moderations_controller_test.rb

38 lines
814 B
Ruby

require 'test_helper'
class ModerationsControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
@moderation = events :one
sign_in users(:one)
end
test 'should edit event' do
put :update, id: @moderation, event: {
title: 'hello world',
related_region: regions(:region_one)
}
assert_redirected_to moderations_path
end
test 'should accept event' do
put :accept, id: @moderation
assert assigns(:moderation).is_moderated?
assert_empty assigns(:moderation).errors
assert_redirected_to moderations_path
end
test 'should reject event' do
assert_difference 'Event.count', -1 do
delete :destroy, id: @moderation
end
assert_empty assigns(:moderation).errors
assert_redirected_to moderations_path
end
end