Skip to content
Snippets Groups Projects
Commit ceeea4f5 authored by Lucas Gabriel Lima's avatar Lucas Gabriel Lima
Browse files

created tests for tagging learning objects

parent 0a9b7a68
No related branches found
No related tags found
No related merge requests found
require 'test_helper'
class V1::LearningObjectsControllerTest < ActionController::TestCase
tests V1::LearningObjectsController
include Devise::TestHelpers
test 'should user tagging a learning object' do
auth_request users(:jack)
tag = tags(:tag_three).name
post :tagging, id: learning_objects(:user_lo).id, tag: { name: tag, owner_id: users(:jack).id, owner_type: 'User' }
p learning_objects(:user_lo).errors.full_messages
assert_response :created
end
test 'should user untagging a learning object' do
auth_request users(:jack)
tag = tags(:tag_three).name
post :untagging, id: learning_objects(:user_lo).id, tag: { name: tag, owner_id: users(:jack).id, owner_type: 'User' }
assert_response :ok
end
test 'should institution tagging a learning object' do
auth_request users(:jack)
institution = institutions(:ufpr)
institution.users << users(:jack)
tag = tags(:tag_one).name
post :tagging, id: learning_objects(:institution_lo).id, tag: { name: tag, owner_id: users(:jack).id, owner_type: 'User' }
assert_response :created
end
test 'should institution untagging a learning object' do
auth_request users(:jack)
institution = institutions(:ufpr)
institution.users << users(:jack)
tag = tags(:tag_one).name
post :untagging, id: learning_objects(:institution_lo).id, tag: { name: tag, owner_id: users(:jack).id, owner_type: 'User' }
assert_response :ok
end
private
def ensure_learning_object_is_persisted!(learning_object)
learning_object.save!
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment