Skip to content

Commit

Permalink
Pass isPassingTests to repo.tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lazamar committed Mar 28, 2016
1 parent 8bca53b commit 08ba93c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function Controller() {
throw new Error('Invalid Object returned by Repositories.get()');
}

return repo.isPassingTests();
return repo.tests.isPassing();
})
.then(function (passingTests) {
var status = {
Expand Down
16 changes: 16 additions & 0 deletions src/js/repo-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,22 @@ function RepoTests(repo) {
return this;
}


/**
* Whether the current repository is passing the tests or not.
* It returns a promise which will be resolved into a boolean value.
* If there are no tests the result will be false
* @method isPassing
* @return {Promise[Boolean]}
*/
RepoTests.prototype.isPassing = function isPassing() {
return this.getLastLog()
.then(function (log) {
if (!log) { return false; }
return log.success;
});
};

/**
* If the file for the last test is test12.log, it returns 12.
* @method getNumberOfLast
Expand Down
15 changes: 0 additions & 15 deletions src/js/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,6 @@ function Repository(username, repoName, repositoriesPath) {
return this;
}

/**
* Whether the current repository is passing the tests or not.
* It returns a promise which will be resolved into a boolean value.
* If there are no tests the result will be false
* @method isPassingTests
* @return {Promise[Boolean]}
*/
Repository.prototype.isPassingTests = function isPassingTests() {
return this.tests.getLastLog()
.then(function (log) {
if (!log) { return false; }
return log.success;
});
};

Repository.prototype.isFree = function isFree() {
console.log('get state: ' + this.getState());
return (this.getState() === 'free');
Expand Down

0 comments on commit 08ba93c

Please sign in to comment.