fix(specs): Fix specs for environment config

This commit is contained in:
Ben Gotow 2015-10-02 15:31:05 -07:00
parent 7ae4c8209d
commit b8635bdd24
2 changed files with 6 additions and 8 deletions

View file

@ -5,17 +5,15 @@ Section: Guides
Order: 7
---
# Writing specs
Nylas uses [Jasmine](http://jasmine.github.io/1.3/introduction.html) as its spec framework. As a package developer, you can write specs using Jasmine 1.3 and get some quick wins. Jasmine specs can be run in N1 directly from the Developer menu, and the test environment provides you with helpful stubs. You can also require your own test framework, or use Jasmine for integration tests and your own framework for your existing business logic.
This documentation describes using [Jasmine 1.3](http://jasmine.github.io/1.3/introduction.html) to write specs for a Nylas package.
#### Running Specs
### Running Specs
You can run your package specs from `Developer > Run Package Specs...`. Once you've opened the spec window, you can see output and re-run your specs by clicking `Reload Specs`.
#### Writing Specs
### Writing Specs
To create specs, place `js`, `coffee`, or `cjsx` files in the `spec` directory of your package. Spec files must end with the `-spec` suffix.

View file

@ -15,18 +15,18 @@ describe "NylasApiEnvironmentStore", ->
spyOn(atom, "inDevMode").andReturn true
spyOn(atom.config, "get").andReturn undefined
store = new storeConstructor()
expect(atom.config.set).toHaveBeenCalledWith("env", "staging")
expect(atom.config.set).toHaveBeenCalledWith("env", "production")
it "initializes with the correct default in production", ->
spyOn(atom, "inDevMode").andReturn false
spyOn(atom.config, "get").andReturn undefined
store = new storeConstructor()
expect(atom.config.set).toHaveBeenCalledWith("env", "staging")
expect(atom.config.set).toHaveBeenCalledWith("env", "production")
describe "when setting the environment", ->
it "sets from the desired action", ->
Actions.changeAPIEnvironment("production")
expect(atom.config.set).toHaveBeenCalledWith("env", "production")
Actions.changeAPIEnvironment("staging")
expect(atom.config.set).toHaveBeenCalledWith("env", "staging")
it "throws if the env is invalid", ->
expect( -> Actions.changeAPIEnvironment("bad")).toThrow()