mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 09:11:41 +00:00
47 lines
1 KiB
Ruby
47 lines
1 KiB
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
require 'test_helper'
|
||
|
|
||
|
module Api
|
||
|
module V1
|
||
|
class PostsControllerTest < ActionDispatch::IntegrationTest
|
||
|
setup do
|
||
|
@rol = create :rol
|
||
|
@site = @rol.site
|
||
|
@usuarie = @rol.usuarie
|
||
|
|
||
|
@site.update_attribute :colaboracion_anonima, true
|
||
|
end
|
||
|
|
||
|
teardown do
|
||
|
@site.destroy
|
||
|
end
|
||
|
|
||
|
test 'primero hay que pedir una cookie' do
|
||
|
get v1_site_invitades_cookie_url(@site)
|
||
|
|
||
|
assert cookies[@site.name]
|
||
|
assert cookies['_sutty_session']
|
||
|
end
|
||
|
|
||
|
test 'solo si el sitio existe' do
|
||
|
site = SecureRandom.hex
|
||
|
|
||
|
get v1_site_invitades_cookie_url(site_id: site)
|
||
|
|
||
|
assert_not cookies[site]
|
||
|
assert_not cookies['_sutty_session']
|
||
|
end
|
||
|
|
||
|
test 'solo si el sitio tiene colaboracion anonima' do
|
||
|
@site.update_attribute :colaboracion_anonima, false
|
||
|
|
||
|
get v1_site_invitades_cookie_url(@site)
|
||
|
|
||
|
assert_not cookies[@site.name]
|
||
|
assert_not cookies['_sutty_session']
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|