This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns fizz_buzz.core) | |
| (defn fizz-buzz-number [num] | |
| (let [is-multiple-of? (fn [n] (= 0 (rem num n))) | |
| a-multiple-of-3 (is-multiple-of? 3) | |
| a-multiple-of-5 (is-multiple-of? 5) | |
| a-multiple-of-both (and a-multiple-of-3 | |
| a-multiple-of-5)] | |
| (cond | |
| a-multiple-of-both "FizzBuzz" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns fizz_buzz.core) | |
| (defn fizz-buzz [coll] | |
| (let | |
| [fizz-buzz-number | |
| (fn [num] | |
| (let [is-multiple-of? (fn [n] (= 0 (rem num n))) | |
| a-multiple-of-3 (is-multiple-of? 3) | |
| a-multiple-of-5 (is-multiple-of? 5) | |
| a-multiple-of-both (and a-multiple-of-3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| user=> (range 1 16) | |
| (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) | |
| user=> (defn is-multiple-of? [num n] | |
| #_=> (= 0 (rem n num))) | |
| #'user/is-multiple-of? | |
| user=> (def is-multiple-of-3? | |
| #_=> (partial is-multiple-of? 3)) | |
| #'user/is-multiple-of-3? | |
| user=> (is-multiple-of-3? 3) | |
| true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defn fizz-buzz [coll] | |
| (clojure.string/join | |
| \space | |
| (map #(let [s (str %2 %3) ] | |
| (if (seq s) | |
| s | |
| (str %))) | |
| coll | |
| (cycle [ "" "" "Fizz" ]) | |
| (cycle [ "" "" "" "" "Buzz" ])))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("A project landings list page", function () { | |
| var TestTools = require('./TestTools'), | |
| Navigation = require('./Navigation'), | |
| ptor; | |
| beforeEach(function () { | |
| TestTools.resetTestData(); | |
| ptor = protractor.getInstance(); | |
| ptor.get('/ebo/#/projects/excecutive-education'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("removes a landing", function () { | |
| element.all(by.css('.delete')).first().click(); | |
| ptor.driver.switchTo().alert().then( // <- this fixes the problem | |
| function (alert) { | |
| alert.accept(); | |
| }, | |
| function (error) { | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("removes a landing", function () { | |
| element.all(by.css('.delete')).first().click(); | |
| TestTools.switchToAlertAndAccept(ptor); // <- the fix is now in a helper function | |
| expect( | |
| element.all( | |
| by.repeater('landing in project.landings')).count() | |
| ).toBe(5); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe("A project landings list page", function () { | |
| var TestTools = require('./TestTools'), | |
| Navigation = require('./Navigation'), | |
| ptor; | |
| beforeEach(function () { | |
| TestTools.resetTestData(); | |
| ptor = protractor.getInstance(); | |
| ptor.get('/ebo/#/projects/excecutive-education'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("shows a new 'autoresponder' mailing", function () { | |
| element(by.css('.dropdown .new_mailings')).click(); // <- this fixes it | |
| element(by.css('#new_ma')) | |
| .click().then(function () { | |
| expect(ptor.getCurrentUrl()) | |
| .toMatch( | |
| '/projects/excecutive-education/new-mailing/ma' | |
| ); | |
| } | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it("shows a new 'autoresponder' mailing", function () { | |
| TestTools.clickDropdownOption( // <- helper | |
| '.dropdown .new_mailings', '#new_ma' | |
| ).then(function () { | |
| expect(ptor.getCurrentUrl()) | |
| .toMatch( | |
| '/projects/excecutive-education/new-mailing/ma' | |
| ); | |
| } | |
| ); |