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

29 lines
570 B
Ruby

require 'test_helper'
class NotesControllerTest < ActionController::TestCase
include Devise::TestHelpers
setup do
@note = notes(:one)
sign_in users(:one)
end
test "should get new" do
get :new, moderation_id: @note.event.id
assert_response :success
end
test "should create note" do
assert_difference('Note.count') do
post :create, moderation_id: @note.event.id, note: {
author: @note.author,
contents: @note.contents,
date: @note.date
}
end
assert_redirected_to moderations_path
end
end