sutty/test/models/site/config_test.rb

42 lines
920 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class ConfigText < ActiveSupport::TestCase
setup do
@rol = create :rol
@site = @rol.site
@usuarie = @rol.usuarie
end
teardown do
@site.destroy
end
test 'se puede leer' do
assert @site.config.is_a?(Site::Config)
assert_equal @site, @site.config.site
assert @site.config.plugins.count.positive?
end
test 'se puede escribir' do
assert_nothing_raised do
@site.config.name = 'Test'
@site.config.lang = 'es'
end
2019-07-30 21:07:08 +00:00
assert @site.config.write(@usuarie)
config = Site::Config.new(@site)
assert_equal 'Test', config.name
assert_equal 'es', config.lang
2019-07-30 21:07:08 +00:00
assert_equal I18n.t('sites.repository.config'),
@site.repository.rugged.head.target.message
end
test 'se puede obtener información' do
assert @site.config.fetch('noexiste', true)
assert @site.config.fetch('sass', false)
end
end