Commit 9da1928faae709f958504451a724d1d555421573
1 parent
9f8d50e9
Exists in
master
and in
4 other branches
Use phantomjs for jasmine tests. Fixed broken one
Showing
2 changed files
with
32 additions
and
35 deletions
Show diff stats
spec/javascripts/stat_graph_contributors_util_spec.js
@@ -3,10 +3,10 @@ describe("ContributorsStatGraphUtil", function () { | @@ -3,10 +3,10 @@ describe("ContributorsStatGraphUtil", function () { | ||
3 | describe("#parse_log", function () { | 3 | describe("#parse_log", function () { |
4 | it("returns a correctly parsed log", function () { | 4 | it("returns a correctly parsed log", function () { |
5 | var fake_log = [ | 5 | var fake_log = [ |
6 | - {author: "Karlo Soriano", date: "2013-05-09", additions: 471}, | ||
7 | - {author: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 6, deletions: 1}, | ||
8 | - {author: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 19, deletions: 3}, | ||
9 | - {author: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 29, deletions: 3}] | 6 | + {author_email: "karlo@email.com", author_name: "Karlo Soriano", date: "2013-05-09", additions: 471}, |
7 | + {author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 6, deletions: 1}, | ||
8 | + {author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 19, deletions: 3}, | ||
9 | + {author_email: "dzaporozhets@email.com", author_name: "Dmitriy Zaporozhets", date: "2013-05-08", additions: 29, deletions: 3}] | ||
10 | 10 | ||
11 | var correct_parsed_log = { | 11 | var correct_parsed_log = { |
12 | total: [ | 12 | total: [ |
@@ -15,11 +15,11 @@ describe("ContributorsStatGraphUtil", function () { | @@ -15,11 +15,11 @@ describe("ContributorsStatGraphUtil", function () { | ||
15 | by_author: | 15 | by_author: |
16 | [ | 16 | [ |
17 | { | 17 | { |
18 | - author: "Karlo Soriano", | 18 | + author_name: "Karlo Soriano", author_email: "karlo@email.com", |
19 | "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} | 19 | "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} |
20 | }, | 20 | }, |
21 | { | 21 | { |
22 | - author: "Dmitriy Zaporozhets", | 22 | + author_name: "Dmitriy Zaporozhets",author_email: "dzaporozhets@email.com", |
23 | "2013-05-08": {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} | 23 | "2013-05-08": {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} |
24 | } | 24 | } |
25 | ] | 25 | ] |
@@ -112,10 +112,10 @@ describe("ContributorsStatGraphUtil", function () { | @@ -112,10 +112,10 @@ describe("ContributorsStatGraphUtil", function () { | ||
112 | 112 | ||
113 | describe("#add_author", function () { | 113 | describe("#add_author", function () { |
114 | it("adds an author field to the collection", function () { | 114 | it("adds an author field to the collection", function () { |
115 | - var fake_author = "Author" | 115 | + var fake_author = { author_name: "Author", author_email: 'fake@email.com' } |
116 | var fake_collection = {} | 116 | var fake_collection = {} |
117 | ContributorsStatGraphUtil.add_author(fake_author, fake_collection) | 117 | ContributorsStatGraphUtil.add_author(fake_author, fake_collection) |
118 | - expect(fake_collection[fake_author].author).toEqual("Author") | 118 | + expect(fake_collection[fake_author.author_name].author_name).toEqual("Author") |
119 | }) | 119 | }) |
120 | }) | 120 | }) |
121 | 121 | ||
@@ -153,30 +153,35 @@ describe("ContributorsStatGraphUtil", function () { | @@ -153,30 +153,35 @@ describe("ContributorsStatGraphUtil", function () { | ||
153 | describe("#get_author_data", function () { | 153 | describe("#get_author_data", function () { |
154 | it("returns the log by author sorted by specified field", function () { | 154 | it("returns the log by author sorted by specified field", function () { |
155 | var fake_parsed_log = { | 155 | var fake_parsed_log = { |
156 | - total: [{date: "2013-05-09", additions: 471, deletions: 0, commits: 1}, | ||
157 | - {date: "2013-05-08", additions: 54, deletions: 7, commits: 3}], | ||
158 | - by_author:[ | ||
159 | - { | ||
160 | - author: "Karlo Soriano", | ||
161 | - "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} | ||
162 | - }, | ||
163 | - { | ||
164 | - author: "Dmitriy Zaporozhets", | ||
165 | - "2013-05-08": {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} | 156 | + total: [ |
157 | + {date: "2013-05-09", additions: 471, deletions: 0, commits: 1}, | ||
158 | + {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} | ||
159 | + ], | ||
160 | + by_author: [ | ||
161 | + { | ||
162 | + author_name: "Karlo Soriano", author_email: "karlo@email.com", | ||
163 | + "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} | ||
164 | + }, | ||
165 | + { | ||
166 | + author_name: "Dmitriy Zaporozhets", author_email: "dzaporozhets@email.com", | ||
167 | + "2013-05-08": {date: "2013-05-08", additions: 54, deletions: 7, commits: 3} | ||
168 | + } | ||
169 | + ] | ||
166 | } | 170 | } |
167 | - ]} | ||
168 | - var correct_author_data = [{author:"Dmitriy Zaporozhets",dates:{"2013-05-08":3},deletions:7,additions:54,"commits":3}, | ||
169 | - {author:"Karlo Soriano",dates:{"2013-05-09":1},deletions:0,additions:471,commits:1}] | 171 | + var correct_author_data = [ |
172 | + {author_name:"Dmitriy Zaporozhets",author_email:"dzaporozhets@email.com",dates:{"2013-05-08":3},deletions:7,additions:54,"commits":3}, | ||
173 | + {author_name:"Karlo Soriano",author_email:"karlo@email.com",dates:{"2013-05-09":1},deletions:0,additions:471,commits:1} | ||
174 | + ] | ||
170 | expect(ContributorsStatGraphUtil.get_author_data(fake_parsed_log, "commits")).toEqual(correct_author_data) | 175 | expect(ContributorsStatGraphUtil.get_author_data(fake_parsed_log, "commits")).toEqual(correct_author_data) |
171 | }) | 176 | }) |
172 | }) | 177 | }) |
173 | 178 | ||
174 | describe("#parse_log_entry", function () { | 179 | describe("#parse_log_entry", function () { |
175 | it("adds the corresponding info from the log entry to the author", function () { | 180 | it("adds the corresponding info from the log entry to the author", function () { |
176 | - var fake_log_entry = { author: "Karlo Soriano", | 181 | + var fake_log_entry = { author_name: "Karlo Soriano", author_email: "karlo@email.com", |
177 | "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} | 182 | "2013-05-09": {date: "2013-05-09", additions: 471, deletions: 0, commits: 1} |
178 | } | 183 | } |
179 | - var correct_parsed_log = {author:"Karlo Soriano",dates:{"2013-05-09":1},deletions:0,additions:471,commits:1} | 184 | + var correct_parsed_log = {author_name:"Karlo Soriano",author_email:"karlo@email.com",dates:{"2013-05-09":1},deletions:0,additions:471,commits:1} |
180 | expect(ContributorsStatGraphUtil.parse_log_entry(fake_log_entry, 'commits', null)).toEqual(correct_parsed_log) | 185 | expect(ContributorsStatGraphUtil.parse_log_entry(fake_log_entry, 'commits', null)).toEqual(correct_parsed_log) |
181 | }) | 186 | }) |
182 | }) | 187 | }) |
@@ -197,4 +202,4 @@ describe("ContributorsStatGraphUtil", function () { | @@ -197,4 +202,4 @@ describe("ContributorsStatGraphUtil", function () { | ||
197 | }) | 202 | }) |
198 | 203 | ||
199 | 204 | ||
200 | -}) | ||
201 | \ No newline at end of file | 205 | \ No newline at end of file |
206 | +}) |
spec/javascripts/support/jasmine_helper.rb
1 | -#Use this file to set/override Jasmine configuration options | ||
2 | -#You can remove it if you don't need it. | ||
3 | -#This file is loaded *after* jasmine.yml is interpreted. | ||
4 | -# | ||
5 | -#Example: using a different boot file. | ||
6 | -#Jasmine.configure do |config| | ||
7 | -# @config.boot_dir = '/absolute/path/to/boot_dir' | ||
8 | -# @config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] } | ||
9 | -#end | ||
10 | -# | ||
11 | - | 1 | +Jasmine.configure do |config| |
2 | + config.browser = :phantomjs | ||
3 | +end |