5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 22:56:21 +00:00
panel/test/models/post_test.rb

45 lines
901 B
Ruby
Raw Permalink Normal View History

2019-03-26 15:32:20 +00:00
# frozen_string_literal: true
2018-04-27 18:48:26 +00:00
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
2019-05-30 15:52:12 +00:00
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
2018-04-27 18:48:26 +00:00
end