import Ember from 'ember';
import {
  module,
  test
} from 'qunit';
import startApp from 'superhero/tests/helpers/start-app';
import data from '../fixtures/characters';

var application, server;

module('Acceptance: Characters', {
  beforeEach: function() {
    application = startApp();
    var characters = data();

    server = new Pretender(function() {
      this.get('/v1/public/characters', function(request) {
        return [
          200,
          {"Content-Type": "application/json"},
          JSON.stringify(characters)
        ];
      });
    });

  },

  afterEach: function() {
    Ember.run(application, 'destroy');
  }
});

test('visiting /characters should show a list of characters', function(assert) {
  visit('/characters');

  andThen(function() {
    assert.equal(currentURL(), '/characters');
    assert.equal(find('div.character-card').length, 20, 'The page should have 20 characters');
  });
});

test('Clicking the next page button should load a new page of characters', function(assert) {
  visit('/characters');

  andThen(function() {
    click('button.button-next-page');
  });

  andThen(function() {
    assert.equal(currentURL(), '/characters?offset=20');
  });
});

@@ -408,24 +408,78 @@
 (request) %7B%0A
+       var responseData = JSON.stringify(characters);%0A
         retu
@@ -560,34 +560,20 @@
     
-JSON.stringify(characters)
+responseData
 %0A   
@@ -1224,22 +1224,117 @@
 ffset=20');%0A
+    assert.equal(find('div.character-card').length, 20, 'The page should have 20 characters');%0A
   %7D);%0A%7D);%0A

Add next page response test