Ivan - Fix issues with mail templating and add it to ruby tests [skip ci]

This commit is contained in:
ivan 2016-07-27 00:44:07 -03:00
parent 4ccbd75759
commit 3f01526814
6 changed files with 18 additions and 6 deletions

View File

@ -12,7 +12,7 @@ class MailTemplate extends DataStore {
$bean = RedBean::findOne(MailTemplate::TABLE, 'type = :type AND language = :language', array(
':type' => $type,
':language' => $globalLanguage
':language' => $globalLanguage->value
));
return ($bean) ? new MailTemplate($bean) : null;
@ -22,6 +22,7 @@ class MailTemplate extends DataStore {
return [
'type',
'subject',
'language',
'body'
];
}

View File

@ -4,7 +4,7 @@ class Setting extends DataStore {
const TABLE = 'setting';
public static function getSetting($name) {
return parent::getDataStore('name', $name);
return parent::getDataStore($name, 'name');
}
public static function getProps() {

View File

@ -5,7 +5,7 @@ include_once 'tests/__mocks__/ResponseMock.php';
include_once 'tests/__mocks__/ControllerMock.php';
include_once 'tests/__mocks__/SessionMock.php';
include_once 'tests/__mocks__/UserMock.php';
include_once 'models/ERRORS.php';
include_once 'data/ERRORS.php';
include_once 'controllers/user/login.php';

View File

@ -8,6 +8,7 @@ require './libs.rb'
require './scripts.rb'
# TESTS
require './system/init-settings.rb'
require './user/signup.rb'
require './user/login.rb'
require './user/send-recover-password.rb'

View File

@ -1,5 +1,5 @@
def request(path, data)
def request(path, data = {})
uri = URI('http://localhost:8080' + path)
response = Net::HTTP.post_form(uri, data)
@ -8,8 +8,8 @@ end
class Database
def initialize()
mysqlUser = ENV['MYSQL_USER'] || 'root';
mysqlPass = ENV['MYSQL_PASSWORD'] || '';
mysqlUser = ENV['MYSQL_USER'] || 'root'
mysqlPass = ENV['MYSQL_PASSWORD'] || ''
@connection = Mysql.new('localhost', mysqlUser , mysqlPass, 'development')
end

View File

@ -0,0 +1,10 @@
describe '/system/init-settings' do
it 'should initialize correctly' do
result = request('/system/init-settings')
lang = $database.getRow('setting', 'language', 'name')
(result['status']).should.equal('success')
(lang['value']).should.equal('en')
end
end