mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 18:06:23 +00:00
44 lines
901 B
Ruby
44 lines
901 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'test_helper'
|
|
|
|
class PostTest < ActiveSupport::TestCase
|
|
setup do
|
|
@user = Usuaria.find('f@kefir.red')
|
|
@site = @user.sites.select { |s| s.name == 'cyber-women.com' }.first
|
|
@post = @site.posts.sample
|
|
end
|
|
|
|
test 'El post no es nuevo si ya existe' do
|
|
assert_not @post.new?
|
|
end
|
|
|
|
test 'El post está traducido' do
|
|
assert @post.translated?
|
|
end
|
|
|
|
test 'El post tiene un título' do
|
|
assert String, @post.title.class
|
|
end
|
|
|
|
test 'El post tiene una fecha' do
|
|
assert DateTime, @post.date.class
|
|
end
|
|
|
|
test 'Es obvio que un post recién cargado es válido' do
|
|
assert @post.valid?
|
|
end
|
|
|
|
test 'El post se puede borrar' do
|
|
path = @post.path
|
|
|
|
assert @post.destroy
|
|
assert_not File.exist?(path)
|
|
|
|
post = @site.posts_for(@post.collection).find do |p|
|
|
p.path == @post.path
|
|
end
|
|
|
|
assert_not post
|
|
end
|
|
end
|