segmentio/analytics.js-integrations — pull request #222 by lancejpollard (2014-06-17 22:02:36+00:00)
Title: refactor tests to dsl

@ianstormtaylor @yields here is how the tests start to look with the new stuff. also ran into some new cases and tried some stuff. let me know what you think!

What should we do for these cases?

---

```js
it('should call #load', function(){
test
.initialize()
.called(adroll.load);
});
```

Should it be `called(adroll.load)` or `called(test.load)`, or even `called('load')`?

How about for this case, should we just leave `assert` or built it into `test`?

```js
it('should test window.__adroll', function(){
assert(!test.loaded());
window.__adroll = {};
assert(test.loaded());
});
```

---

```js
beforeEach(function(){
test.initialize();
test.load.restore();
});
```

Should it be chained?

```js
beforeEach(function(){
test
.initialize()
.load.restore();
});
```

That looks weird. But it's like why not chain the first, if we would chain this?

```js
beforeEach(function(){
test
.initialize()
.spy(window.__adroll, 'record_user');
});
```

---

```js
beforeEach(function(){
adroll.options.events = { event: 'segment' };
});
```

Should we use `test` instead, and have the `test.options` object just set to that?

```js
beforeEach(function(){
test.options.events = { event: 'segment' };
});
```

Or maybe even do this, since maybe you never set the `options` directly as a developer (is it always done in the admin panel)?

```js
beforeEach(function(){
test.option('events', { event: 'segment' });
});
```