ghostbuster 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -36,7 +36,7 @@ namespace :test do
36
36
  task :non_working do
37
37
  print "non_working_ghost ... "
38
38
  Dir.chdir("test/non_working_ghost") do
39
- matcher = [/0 success, 7 failure, 1 pending/, /Bad link traversal\s+Assert location failed: Excepted http:\/\/127\.0\.0\.1:4567\/not-correct, got http:\/\/127\.0\.0\.1:4567\//, /Form input not equal\s+Assert first for selector #out did not meet expectations/, /To an invalid URL\s+The request for http:\/\/127\.0\.0\.1:this-url-is-invalid failed/, /This test will explode!\s+I hate you!/, /This test has no succeed\s+This test took too long/]
39
+ matcher = [/0 success, 8 failure, 1 pending/, /Bad link traversal\s+Assert location failed: Excepted http:\/\/127\.0\.0\.1:4567\/not-correct, got http:\/\/127\.0\.0\.1:4567\//, /Form input not equal\s+Assert first for selector #out did not meet expectations/, /To an invalid URL\s+The request for http:\/\/127\.0\.0\.1:this-url-is-invalid failed/, /This test will explode!\s+I hate you!/, /This test has no succeed\s+This test took too long/, /This test has a custom assertion name\s+Assert first "custom assertion name" did not meet expectations/]
40
40
  fork {
41
41
  ENV['BUNDLE_GEMFILE'] = File.expand_path("./Gemfile")
42
42
  `bundle install`
@@ -143,7 +143,8 @@ class Body
143
143
  opts = {}
144
144
  test = @test
145
145
  @test.assert opts, (withValue) ->
146
- alerter = if test.getLastError()? then "" else "alert('Assert count for selector #{selector} did not meet expectations, last count is '+count);"
146
+ assertionDescription = if opts.name then "\"#{opts.name}\"" else "for selector #{selector}"
147
+ alerter = if test.getLastError()? then "" else "alert('Assert count #{assertionDescription} did not meet expectations, last count is '+count);"
147
148
  eval "
148
149
  var evaluator = function() {
149
150
  try {
@@ -171,7 +172,8 @@ class Body
171
172
  test = @test
172
173
  location = @test.runner.normalizePath(path)
173
174
  @test.assert opts, (withValue) ->
174
- alerter = if test.getLastError()? then "" else "alert('Assert location failed: Excepted #{location}, got '+currentLocation);"
175
+ assertionDescription = if opts.name then " \"#{opts.name}\"" else ""
176
+ alerter = if test.getLastError()? then "" else "alert('Assert location#{assertionDescription} failed: Excepted #{location}, got '+currentLocation);"
175
177
  eval "
176
178
  var fn = function() {
177
179
  var currentLocation = window.location.href;
@@ -191,7 +193,8 @@ class Body
191
193
  opts = {}
192
194
  test = @test
193
195
  @test.assert opts, (withValue) ->
194
- alerter = if test.getLastError()? then "" else "alert('Assert first for selector #{selector} did not meet expectations');"
196
+ assertionDescription = if opts.name then "\"#{opts.name}\"" else "for selector #{selector}"
197
+ alerter = if test.getLastError()? then "" else "alert('Assert first #{assertionDescription} did not meet expectations');"
195
198
  eval "
196
199
  var evaluator = function() {
197
200
  try {
@@ -218,6 +221,7 @@ class Body
218
221
  assertionCallback = opts
219
222
  opts = {}
220
223
  @test.assert opts, (withValue) ->
224
+ assertionDescription = if opts.name then "\"#{opts.name}\"" else "for selector #{selector}"
221
225
  eval "
222
226
  var evaluator = function() {
223
227
  try {
@@ -226,7 +230,7 @@ class Body
226
230
  if (list.length == 0) throw('list is empty');
227
231
  for (var i=0; i != list.length; i++) {
228
232
  if (!assertionCallback(list[i], i)) {
229
- alert('Assert all for selector #{selector} on item '+i+' didn\\'t meet expectations');
233
+ alert('Assert all #{assertionDescription} on item '+i+' didn\\'t meet expectations');
230
234
  return false;
231
235
  }
232
236
  }
data/lib/ghostbuster.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'fileutils'
2
4
  require 'digest/md5'
3
5
 
@@ -1,3 +1,3 @@
1
1
  class Ghostbuster
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
@@ -8,6 +8,12 @@ phantom.test.add "This test has no succeed", ->
8
8
  @get '/form', ->
9
9
  "so, like, this test sucks"
10
10
 
11
+ phantom.test.add "This test has a custom assertion name", ->
12
+ @get '/form', ->
13
+ @body.assertFirst '#out', name: "custom assertion name", (out) ->
14
+ out.innerHTML == 'this definitely is NOT my input'
15
+ @succeed()
16
+
11
17
  phantom.test.add "This test sets its max test duration too low", total: 1, ->
12
18
  @get '/form', ->
13
19
  @wait 2, ->
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghostbuster
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 2
10
- version: 0.3.2
9
+ - 3
10
+ version: 0.3.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Josh Hull
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-08 00:00:00 -07:00
18
+ date: 2011-09-12 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency