[Ivan Diaz] - OS-#39 - Fix test issues
This commit is contained in:
parent
953aa52584
commit
108ebd781c
|
@ -1,12 +0,0 @@
|
|||
describe '/user/signup' do
|
||||
it 'should create user in database' do
|
||||
response = request('/user/signup', {
|
||||
'email' => 'steve@jobs.com',
|
||||
'password' => 'custom'
|
||||
})
|
||||
|
||||
userRow = $database.getRow('users', response['data']['userId'])
|
||||
|
||||
(userRow['email']).should.equal('steve@jobs.com')
|
||||
end
|
||||
end
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# DELETE ALL TABLES
|
||||
TABLES=$(mysql -u os_dev -pos_dev os_dev -e "SHOW TABLES IN os_dev;" | awk '{ print $1}' | grep -v '^Tables')
|
||||
|
||||
for t in $TABLES
|
||||
do
|
||||
mysql -u os_dev -pos_dev os_dev -e "DROP TABLE $t"
|
||||
done
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Comment extends DataStore {
|
||||
const TABLE = 'comment';
|
||||
const TABLE = 'comments';
|
||||
|
||||
public static function getProps() {
|
||||
return array(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Ticket extends DataStore {
|
||||
const TABLE = 'ticket';
|
||||
const TABLE = 'tickets';
|
||||
|
||||
public static function getProps() {
|
||||
return array(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
class User extends DataStore {
|
||||
const TABLE = 'user';
|
||||
const TABLE = 'users';
|
||||
|
||||
public static function authenticate($userEmail, $userPassword) {
|
||||
$user = User::getUser($userEmail, 'email');
|
||||
|
@ -19,7 +19,7 @@ class User extends DataStore {
|
|||
);
|
||||
}
|
||||
|
||||
public function getDefaultProperties() {
|
||||
public function getDefaultProps() {
|
||||
return array(
|
||||
'ownTickets' => []
|
||||
);
|
||||
|
|
|
@ -17,16 +17,12 @@ class DataStoreMock extends DataStore {
|
|||
);
|
||||
}
|
||||
|
||||
public function getDefaultProperties() {
|
||||
public function getDefaultProps() {
|
||||
return array(
|
||||
'prop1' => 0,
|
||||
'prop2' => 'hello'
|
||||
);
|
||||
}
|
||||
|
||||
public static function deleteDataStore($dataStore) {
|
||||
return parent::deleteDataStore($dataStore);
|
||||
}
|
||||
}
|
||||
|
||||
class DataStoreTest extends PHPUnit_Framework_TestCase {
|
||||
|
@ -78,9 +74,8 @@ class DataStoreTest extends PHPUnit_Framework_TestCase {
|
|||
}
|
||||
|
||||
public function testDeleteDataStore() {
|
||||
$beanInstance = $this->instance->getBeanInstance();
|
||||
DataStoreMock::deleteDataStore($this->instance);
|
||||
$this->instance->delete();
|
||||
|
||||
$this->assertTrue(RedBean::get('trash')->hasBeenCalledWithArgs($beanInstance));
|
||||
$this->assertTrue(RedBean::get('trash')->hasBeenCalledWithArgs($this->instance->getBeanInstance()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
# DELETE ALL TABLES
|
||||
TABLES=$(mysql -u root development -e "SHOW TABLES IN os_dev;" | awk '{ print $1}' | grep -v '^Tables')
|
||||
|
||||
for t in $TABLES
|
||||
do
|
||||
mysql -u root development -e "DROP TABLE $t"
|
||||
done
|
|
@ -5,6 +5,7 @@ require 'uri'
|
|||
require 'mysql'
|
||||
require 'json'
|
||||
require './libs.rb'
|
||||
require './scripts.rb'
|
||||
|
||||
# TESTS
|
||||
require './user/signup.rb'
|
|
@ -0,0 +1,2 @@
|
|||
./clean_db.sh
|
||||
bacon init.rb
|
|
@ -7,5 +7,6 @@ class Scripts
|
|||
|
||||
if response['status'] === 'fail'
|
||||
raise "Could not create user"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -22,3 +22,4 @@ describe '/user/login' do
|
|||
it 'should fail if already logged in' do
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
describe '/user/signup' do
|
||||
it 'should create user in database' do
|
||||
response = request('/user/signup', {
|
||||
'email' => 'steve@jobs.com',
|
||||
'password' => 'custom'
|
||||
})
|
||||
|
||||
userRow = $database.getRow('users', response['data']['userId'])
|
||||
|
||||
(userRow['email']).should.equal('steve@jobs.com')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue