REFACTOR: Use the new format for acceptance tests. (#97)

REFACTOR: Use the new format for acceptance tests. (#97)

diff --git a/test/javascripts/acceptance/adsense-test.js.es6 b/test/javascripts/acceptance/adsense-test.js.es6
index abc6f90..79fdea9 100644
--- a/test/javascripts/acceptance/adsense-test.js.es6
+++ b/test/javascripts/acceptance/adsense-test.js.es6
@@ -1,9 +1,9 @@
 import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
 import groupFixtures from "fixtures/group-fixtures";
 
-acceptance("AdSense", {
-  loggedIn: true,
-  settings: {
+acceptance("AdSense", function(needs) {
+  needs.user();
+  needs.settings({
     no_ads_for_groups: "47",
     no_ads_for_categories: "1",
     adsense_publisher_code: "MYADSENSEID",
@@ -19,8 +19,8 @@ acceptance("AdSense", {
     adsense_nth_post_code: 6,
     adsense_topic_above_post_stream_code: "above_post_stream_ad_unit",
     adsense_topic_above_post_stream_ad_sizes: "728*90 - leaderboard",
-  },
-  site: {
+  });
+  needs.site({
     house_creatives: {
       settings: {
         topic_list_top: "",
@@ -31,74 +31,74 @@ acceptance("AdSense", {
       },
       creatives: {},
     },
-  },
-});
+  });
 
-test("correct number of ads should show", async (assert) => {
-  updateCurrentUser({ staff: false, trust_level: 1 });
-  await visit("/t/280"); // 20 posts
+  test("correct number of ads should show", async (assert) => {
+    updateCurrentUser({ staff: false, trust_level: 1 });
+    await visit("/t/280"); // 20 posts
 
-  assert.equal(
-    find(".google-adsense.adsense-topic-above-post-stream").length,
-    1,
-    "it should render 1 ad"
-  );
+    assert.equal(
+      find(".google-adsense.adsense-topic-above-post-stream").length,
+      1,
+      "it should render 1 ad"
+    );
 
-  const ads = find(".google-adsense.adsense-post-bottom");
-  assert.equal(ads.length, 3, "it should render 3 ads");
-  assert.equal(
-    find("#post_6 + .widget-connector").find(
-      ".google-adsense.adsense-post-bottom"
-    ).length,
-    1,
-    "ad after 6th post"
-  );
-  assert.equal(
-    find("#post_12 + .widget-connector").find(
-      ".google-adsense.adsense-post-bottom"
-    ).length,
-    1,
-    "ad after 12th post"
-  );
-  assert.equal(
-    find("#post_18 + .widget-connector").find(
-      ".google-adsense.adsense-post-bottom"
-    ).length,
-    1,
-    "ad after 18th post"
-  );
-});
+    const ads = find(".google-adsense.adsense-post-bottom");
+    assert.equal(ads.length, 3, "it should render 3 ads");
+    assert.equal(
+      find("#post_6 + .widget-connector").find(
+        ".google-adsense.adsense-post-bottom"
+      ).length,
+      1,
+      "ad after 6th post"
+    );
+    assert.equal(
+      find("#post_12 + .widget-connector").find(
+        ".google-adsense.adsense-post-bottom"
+      ).length,
+      1,
+      "ad after 12th post"
+    );
+    assert.equal(
+      find("#post_18 + .widget-connector").find(
+        ".google-adsense.adsense-post-bottom"
+      ).length,
+      1,
+      "ad after 18th post"
+    );
+  });
 
-test("no ads for trust level 3", async (assert) => {
-  updateCurrentUser({ staff: false, trust_level: 3 });
-  await visit("/t/280");
-  assert.equal(
-    find(".google-adsense.adsense-post-bottom").length,
-    0,
-    "it should render 0 ads"
-  );
-});
+  test("no ads for trust level 3", async (assert) => {
+    updateCurrentUser({ staff: false, trust_level: 3 });
+    await visit("/t/280");
+    assert.equal(
+      find(".google-adsense.adsense-post-bottom").length,
+      0,
+      "it should render 0 ads"
+    );
+  });
 
-test("can omit ads based on groups", async (assert) => {
-  updateCurrentUser({
-    staff: false,
-    trust_level: 1,
-    groups: [groupFixtures["/groups/discourse.json"].group],
+  test("can omit ads based on groups", async (assert) => {
+    updateCurrentUser({
+      staff: false,
+      trust_level: 1,
+      groups: [groupFixtures["/groups/discourse.json"].group],
+    });
+    await visit("/t/280");
+    assert.equal(
+      find(".google-adsense.adsense-post-bottom").length,
+      0,
+      "it should render 0 ads"
+    );
   });
-  await visit("/t/280");
-  assert.equal(
-    find(".google-adsense.adsense-post-bottom").length,
-    0,
-    "it should render 0 ads"
-  );
-});
 
-test("can omit ads based on category", async (assert) => {
-  updateCurrentUser({ staff: false, trust_level: 1 });
-  await visit("/t/28830");
-  assert.equal(
-    find(".google-adsense.adsense-topic-above-post-stream").length,
-    0,
-    "it should render 0 ads"
-  );
+  test("can omit ads based on category", async (assert) => {
+    updateCurrentUser({ staff: false, trust_level: 1 });
+    await visit("/t/28830");
+    assert.equal(
+      find(".google-adsense.adsense-topic-above-post-stream").length,
+      0,
+      "it should render 0 ads"
+    );
+  });
 });
diff --git a/test/javascripts/acceptance/dfp-test.js.es6 b/test/javascripts/acceptance/dfp-test.js.es6
index 51305be..e0ee1f6 100644
--- a/test/javascripts/acceptance/dfp-test.js.es6
+++ b/test/javascripts/acceptance/dfp-test.js.es6
@@ -1,9 +1,9 @@
 import { acceptance, updateCurrentUser } from "helpers/qunit-helpers";
 import groupFixtures from "fixtures/group-fixtures";
 
-acceptance("DFP Ads", {
-  loggedIn: true,
-  settings: {
+acceptance("DFP Ads", function(needs) {
+  needs.user();
+  needs.settings({
     no_ads_for_groups: "47",
     no_ads_for_categories: "1",
     dfp_publisher_id: "MYdfpID",
@@ -19,8 +19,8 @@ acceptance("DFP Ads", {
     dfp_nth_post_code: 6,
     dfp_topic_above_post_stream_code: "list_top_ad_unit",
     dfp_topic_above_post_stream_ad_sizes: "728*90 - leaderboard",
-  },
-  site: {
+  });
+  needs.site({
     house_creatives: {
       settings: {
         topic_list_top: "",
@@ -31,67 +31,67 @@ acceptance("DFP Ads", {
       },
       creatives: {},
     },
-  },
-});
+  });
 
-test("correct number of ads should show", async (assert) => {
-  updateCurrentUser({ staff: false, trust_level: 1 });
-  await visit("/t/280"); // 20 posts
-  const ads = find(".google-dfp-ad.dfp-ad-post-bottom");
-  assert.equal(ads.length, 3, "it should render 3 ads");
-  assert.equal(
-    find("#post_6 + .widget-connector").find(
-      ".google-dfp-ad.dfp-ad-post-bottom"
-    ).length,
-    1,
-    "ad after 6th post"
-  );
-  assert.equal(
-    find("#post_12 + .widget-connector").find(
-      ".google-dfp-ad.dfp-ad-post-bottom"
-    ).length,
-    1,
-    "ad after 12th post"
-  );
-  assert.equal(
-    find("#post_18 + .widget-connector").find(
-      ".google-dfp-ad.dfp-ad-post-bottom"
-    ).length,
-    1,
-    "ad after 18th post"
-  );
-});
+  test("correct number of ads should show", async (assert) => {
+    updateCurrentUser({ staff: false, trust_level: 1 });
+    await visit("/t/280"); // 20 posts
+    const ads = find(".google-dfp-ad.dfp-ad-post-bottom");
+    assert.equal(ads.length, 3, "it should render 3 ads");
+    assert.equal(
+      find("#post_6 + .widget-connector").find(
+        ".google-dfp-ad.dfp-ad-post-bottom"
+      ).length,
+      1,
+      "ad after 6th post"
+    );
+    assert.equal(
+      find("#post_12 + .widget-connector").find(
+        ".google-dfp-ad.dfp-ad-post-bottom"
+      ).length,
+      1,
+      "ad after 12th post"
+    );
+    assert.equal(
+      find("#post_18 + .widget-connector").find(
+        ".google-dfp-ad.dfp-ad-post-bottom"
+      ).length,
+      1,
+      "ad after 18th post"
+    );
+  });
 
-test("no ads for trust level 3", async (assert) => {
-  updateCurrentUser({ staff: false, trust_level: 3 });
-  await visit("/t/280");
-  assert.equal(
-    find(".google-dfp-ad.dfp-ad-post-bottom").length,
-    0,
-    "it should render 0 ads"
-  );
-});
+  test("no ads for trust level 3", async (assert) => {
+    updateCurrentUser({ staff: false, trust_level: 3 });
+    await visit("/t/280");
+    assert.equal(
+      find(".google-dfp-ad.dfp-ad-post-bottom").length,
+      0,
+      "it should render 0 ads"
+    );
+  });
 
-test("can omit ads based on groups", async (assert) => {
-  updateCurrentUser({
-    staff: false,

[... diff too long, it was truncated ...]

GitHub sha: 4bf6420b

This commit appears in #97 which was approved by nlalonde. It was merged by romanrizzi.