5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 06:41:42 +00:00
panel/test/models/site_test.rb

43 lines
1.1 KiB
Ruby
Raw Normal View History

2018-04-27 18:48:26 +00:00
require 'test_helper'
class SiteTest < ActiveSupport::TestCase
setup do
@user = Usuaria.find('f@kefir.red')
@path = File.join(Site.site_path_for(@user), 'cyber-women.com')
reset_git_repo(@path)
@site = @user.sites.select { |s| s.name == 'cyber-women.com' }.first
@site.read
end
test "El directorio es un sitio jekyll" do
assert Site.jekyll?(@path)
end
test 'Un directorio se puede cargar como un sitio Jekyll' do
jekyll = Site.load_jekyll @path
assert_equal Jekyll::Site, jekyll.class
end
test 'Los artículos no están ordenados si a alguno le falta orden' do
assert_not @site.ordered?
assert @site.reorder_collection!
assert @site.ordered?
end
2018-04-30 18:51:39 +00:00
test 'No podemos poner órdenes arbitrarios' do
total = @site.posts.count
new_order = Hash[total.times.map { |i| [i.to_s,rand(total)] }]
assert_not @site.reorder_collection('posts', new_order)
end
test 'Si les damos un orden alternativo los reordenamos' do
total = @site.posts.count
order = total.times.map { |i| i.to_s }
new_order = Hash[order.zip(order.shuffle)]
assert @site.reorder_collection('posts', new_order)
end
2018-04-27 18:48:26 +00:00
end