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

30 lines
598 B
Ruby
Raw Normal View History

2014-02-18 09:28:04 +01:00
require 'test_helper'
# Test the notes life cycle
2014-02-18 09:28:04 +01:00
class NotesControllerTest < ActionController::TestCase
include Devise::TestHelpers
2014-02-18 09:28:04 +01:00
setup do
@note = notes(:one)
sign_in users(:one)
2014-02-18 09:28:04 +01:00
end
test 'should get new' do
get :new, moderation_id: @note.event.id
2014-02-18 09:28:04 +01:00
assert_response :success
end
test 'should create note' do
2014-02-18 09:28:04 +01:00
assert_difference('Note.count') do
post :create, moderation_id: @note.event.id, note: {
author: @note.author,
contents: @note.contents,
date: @note.date
}
2014-02-18 09:28:04 +01:00
end
assert_redirected_to moderations_path
2014-02-18 09:28:04 +01:00
end
end