mirror of
https://github.com/michaelachrisco/ReadOnlyTraitLaravel.git
synced 2024-10-31 21:33:23 -07:00
Merge pull request #57 from michaelachrisco/56-add-context-to-kahlan
feat(spec): Testing users should have more context
This commit is contained in:
commit
276836059b
2 changed files with 179 additions and 164 deletions
|
@ -19,9 +19,19 @@ jobs:
|
|||
- run: sudo composer self-update
|
||||
- run: composer install -n --prefer-dist --no-plugins
|
||||
- run: ./vendor/bin/kahlan -reporter=verbose
|
||||
build_php_version_83:
|
||||
docker:
|
||||
- image: cimg/php:8.3.0
|
||||
working_directory: ~/ReadOnlyTraitLaravel
|
||||
steps: # a set of executable commands
|
||||
- checkout
|
||||
- run: sudo composer self-update
|
||||
- run: composer install -n --prefer-dist --no-plugins
|
||||
- run: ./vendor/bin/kahlan -reporter=verbose
|
||||
workflows:
|
||||
version: 2
|
||||
build:
|
||||
jobs:
|
||||
- build_php_version_81
|
||||
- build_php_version_82
|
||||
- build_php_version_83
|
||||
|
|
|
@ -4,11 +4,13 @@ require_once('src/ReadOnlyTrait.php');
|
|||
use MichaelAChrisco\ReadOnly\ReadOnlyException;
|
||||
use MichaelAChrisco\ReadOnly\ReadOnlyTrait;
|
||||
|
||||
class User extends Illuminate\Database\Eloquent\Model {
|
||||
class User extends Illuminate\Database\Eloquent\Model
|
||||
{
|
||||
use ReadOnlyTrait;
|
||||
}
|
||||
|
||||
describe("User", function () {
|
||||
context("When User calls unsupported method", function () {
|
||||
describe("::create()", function () {
|
||||
it("is expected to throw ReadOnlyException", function () {
|
||||
expect(
|
||||
|
@ -163,6 +165,7 @@ describe("User", function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
class MockModel
|
||||
{
|
||||
|
@ -183,6 +186,7 @@ class UserReadOnlyNotActive extends MockModel
|
|||
}
|
||||
|
||||
describe("UserReadOnlyNotActive", function () {
|
||||
context("When UserReadOnlyNotActive calls unsupported method and isActive is true", function () {
|
||||
describe("::create()", function () {
|
||||
it("expects `create()` to be toBeTruthy", function () {
|
||||
$user = new UserReadOnlyNotActive;
|
||||
|
@ -190,3 +194,4 @@ describe("UserReadOnlyNotActive", function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue