{"id":19552464,"url":"https://github.com/pixeldroid/spec-ls","last_synced_at":"2026-03-03T01:39:04.001Z","repository":{"id":10503496,"uuid":"12688477","full_name":"pixeldroid/spec-ls","owner":"pixeldroid","description":"a simple spec framework for Loom","archived":false,"fork":false,"pushed_at":"2017-09-18T03:17:20.000Z","size":821,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-26T07:18:56.237Z","etag":null,"topics":["assertions","bdd","behavior-driven-development","describe","expect","expectations","library","loomlib","loomscript","matcher","spec","specification","test-driven-development","test-framework"],"latest_commit_sha":null,"homepage":null,"language":"LoomScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pixeldroid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-08T22:10:27.000Z","updated_at":"2024-10-08T00:37:20.000Z","dependencies_parsed_at":"2022-09-11T02:10:14.753Z","dependency_job_id":null,"html_url":"https://github.com/pixeldroid/spec-ls","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/pixeldroid/spec-ls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixeldroid%2Fspec-ls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixeldroid%2Fspec-ls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixeldroid%2Fspec-ls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixeldroid%2Fspec-ls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pixeldroid","download_url":"https://codeload.github.com/pixeldroid/spec-ls/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixeldroid%2Fspec-ls/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30029705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T00:31:48.536Z","status":"ssl_error","status_checked_at":"2026-03-03T00:30:56.176Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assertions","bdd","behavior-driven-development","describe","expect","expectations","library","loomlib","loomscript","matcher","spec","specification","test-driven-development","test-framework"],"created_at":"2024-11-11T04:18:15.852Z","updated_at":"2026-03-03T01:39:03.971Z","avatar_url":"https://github.com/pixeldroid.png","language":"LoomScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"spec-ls\n=======\n\na simple specification framework for [Loom][loom-sdk]\n\n![spec-ls screenshot](terminal.png)\n\n- [installation](#installation)\n- [usage](#usage)\n- [building](#building)\n- [contributing](#contributing)\n\n\n## installation\n\nDownload the library into its matching sdk folder:\n\n    $ curl -L -o ~/.loom/sdks/sprint34/libs/Spec.loomlib \\\n        https://github.com/pixeldroid/spec-ls/releases/download/v2.0.0/Spec-sprint34.loomlib\n\nTo uninstall, simply delete the file:\n\n    $ rm ~/.loom/sdks/sprint34/libs/Spec.loomlib\n\n\n## usage\n\n### in a nutshell\n\n0. import `Spec`, one or more `Reporter`s, and one or more specifications\n0. add the reporter(s) to an instance of `Spec`\n0. in the specifications, describe the desired behavior of the thing they validate\n  * `Spec.describe()` instantiates a `Thing`\n  * `Thing.should()` declares a requirement function\n    - in the function, `expects()` and `asserts()` validate the requirement\n0. execute the spec to see results from the reporter\n\n### simple example\n\n```ls\npackage\n{\n    import loom.Application;\n\n    import pixeldroid.bdd.Spec;\n    import pixeldroid.bdd.reporters.ConsoleReporter;\n\n    import WidgetSpec;\n\n\n    public class SpecTest extends Application\n    {\n\n        override public function run():void\n        {\n            var spec:Spec = new Spec();\n            spec.addReporter(new ConsoleReporter());\n\n            WidgetSpec.specify(spec);\n\n            spec.execute();\n        }\n    }\n\n\n    import pixeldroid.bdd.Spec;\n    import pixeldroid.bdd.Thing;\n\n    public static class WidgetSpec\n    {\n        private static var it:Thing;\n\n        public static function specify(specifier:Spec):void\n        {\n            it = specifier.describe('Widget');\n\n            it.should('be versioned', be_versioned);\n            it.should('contain three thingamajigs when initialized', have_three_thingamajigs);\n        }\n\n        private static function be_versioned():void\n        {\n            it.expects(Widget.version).toPatternMatch('(%d+).(%d+).(%d+)', 3);\n        }\n\n        private static function have_three_thingamajigs():void\n        {\n            // assert before array access to avoid out-of-bounds error\n            it.asserts(Widget.thingamajigs.length).isEqualTo(3).or('Widget initialized without three thingamajigs');\n            it.expects(Widget.thingamajigs[2]).isTypeOf(Sprocket).or('Third thingamajig not a Sprocket');\n        }\n    }\n\n}\n```\n\n\u003e **TIP**: use [SpecExecutor][SpecExecutor.ls]; it has convenience methods to set reporter formats and seed values. See [SpecTest][SpecTest.ls] for an example.\n\n### expectations\n\nspec-ls provides a set of expectation tests for specifying behavior:\n\n`it.expects(value:Object)`\n\n* `.toBeA(type:Type)`\n* `.toBeEmpty()`\n* `.toBeFalsey()` / `toBeTruthy()`\n* `.toBeGreaterThan(value2:Number)` / `toBeLessThan(value2:Number)`\n* `.toBeNaN()`\n* `.toBeNull()`\n* `.toBePlusOrMinus(absoluteDelta:Number).from(value2:Number)`\n* `.toContain(value2:Object)`\n* `.toEndWith(value2:String)` / `toStartWith(value2:String)`\n* `.toEqual(value2:Object)`\n* `.toPatternMatch(value2:String, matches:Number=1)`\n\nthey are defined in [Matcher.ls][Matcher.ls];\nyou can see them used in the specifications for spec-ls itself: [ExpectationSpec][ExpectationSpec.ls]\n\n### assertions\n\nspec-ls provides a set of assertion tests for mandating test pre-conditions and aborting on violation:\n\n`it.asserts(value:Object)`\n\n* `.isNotNaN().or('value was NaN')`\n* `.isNull().or('value was not null')` / `.isNotNull().or('value was null')`\n* `.isEmpty().or('value was not empty')` / `.isNotEmpty().or('value was empty')`\n* `.isEqualTo(value2).or('value was not equal to value2')` / `.isNotEqualTo(value2).or('value was equal to value2')`\n* `.isGreaterThan(value2).or('value was not greater than value2')`\n* `.isLessThan(value2).or('value was not less than value2')`\n* `.isTypeOf(type).or('value was not a kind of type')`\n\nthey are defined in [Assertion.ls][Assertion.ls];\nyou can see them used in the specifications for spec-ls itself: [AssertionSpec][AssertionSpec.ls]\n\n### reporters\n\nspec-ls ships with three reporters:\n\n* **AnsiReporter** - prints a compact summary to the console using ANSI color codes\n* **ConsoleReporter** - traces the complete results with a minimum of frill\n* **JunitReporter** - writes jUnit style xml summaries for CI systems like Jenkins and Bamboo\n\n..or create your own by implementing the simple [Reporter][Reporter.ls] interface.\n\n### random seed\n\nby default, Spec will execute tests in a different random order every time, to guard against hidden dependencies.\n\nto reproduce the order of a specific run, pass in the same seed value to `Spec.execute()`:\n\n```ls\n        override public function run():void\n        {\n            MySpec.describe();\n\n            Spec.addReporter(new ConsoleReporter());\n\n            var seed:Number = 71387;\n            Spec.execute(seed);\n        }\n```\n\n\n## building\n\nfirst, install [loomtasks][loomtasks]\n\n### compiling from source\n\n    $ rake lib:install\n\nthis will build the Spec library and install it in the currently configured sdk\n\n### running tests\n\n    $ rake test\n\nthis will build the Spec library, install it in the currently configured sdk, build the test app, and run the test app.\n\n\n## contributing\n\nPull requests are welcome!\n\n\n[Assertion.ls]: lib/src/pixeldroid/bdd/Assertion.ls \"Assertion.ls\"\n[AssertionSpec.ls]: test/src/spec/AssertionSpec.ls \"AssertionSpec.ls\"\n[ExpectationSpec.ls]: test/src/spec/ExpectationSpec.ls \"ExpectationSpec.ls\"\n[loom-sdk]: https://github.com/LoomSDK/LoomSDK \"a native mobile app and game framework\"\n[loomtasks]: https://github.com/pixeldroid/loomtasks \"Rake tasks for working with loomlibs\"\n[Matcher.ls]: lib/src/pixeldroid/bdd/Matcher.ls \"Matcher.ls\"\n[Reporter.ls]: lib/src/pixeldroid/bdd/Reporter.ls \"Reporter.ls\"\n[SpecExecutor.ls]: lib/src/pixeldroid/bdd/SpecExecutor.ls \"SpecExecutor.ls\"\n[SpecTest.ls]: test/src/app/SpecTest.ls \"SpecTest.ls\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixeldroid%2Fspec-ls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixeldroid%2Fspec-ls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixeldroid%2Fspec-ls/lists"}