netzke-testing 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +19 -0
  3. data/README.md +50 -2
  4. data/app/assets/javascripts/netzke/testing/helpers/actions.js.coffee +39 -10
  5. data/app/assets/javascripts/netzke/testing/helpers/expectations.js.coffee +4 -0
  6. data/app/assets/javascripts/netzke/testing/helpers/grid.js.coffee +42 -9
  7. data/app/assets/javascripts/netzke/testing.js +1 -0
  8. data/app/views/layouts/netzke/testing.html.erb +9 -5
  9. data/config/routes.rb +0 -2
  10. data/lib/netzke/testing/engine.rb +1 -0
  11. data/lib/netzke/testing/helpers.rb +7 -10
  12. data/lib/netzke/testing/version.rb +1 -1
  13. data/lib/netzke/testing.rb +4 -0
  14. data/netzke-testing.gemspec +0 -8
  15. data/spec/rails_app/config/application.rb +1 -1
  16. data/spec/rails_app/config/boot.rb +1 -2
  17. data/spec/rails_app/config/initializers/netzke_testing.rb +0 -1
  18. data/spec/rails_app/log/development.log +1509 -0
  19. data/spec/rails_app/log/test.log +411 -0
  20. data/spec/rails_app/tmp/cache/assets/development/sprockets/1ec8d2bd73a25dacc03b06d7e561bab0 +0 -0
  21. data/spec/rails_app/tmp/cache/assets/development/sprockets/20a089c0481b352f5ba6b7b8746b7213 +0 -0
  22. data/spec/rails_app/tmp/cache/assets/development/sprockets/28b9c9af951daba56bcdc86b45c3b7ed +0 -0
  23. data/spec/rails_app/tmp/cache/assets/development/sprockets/3055607d4a01c24bb30f86d38b66be76 +0 -0
  24. data/spec/rails_app/tmp/cache/assets/development/sprockets/364f56c42953643bff73d0d14051f406 +0 -0
  25. data/spec/rails_app/tmp/cache/assets/development/sprockets/48d1d24065c75bfe3bbf00f303e233d0 +0 -0
  26. data/spec/rails_app/tmp/cache/assets/development/sprockets/4d2a90e455a595f51101e7e94572384e +0 -0
  27. data/spec/rails_app/tmp/cache/assets/development/sprockets/5da2225b8b1ca6c070d06b98bbb94452 +0 -0
  28. data/spec/rails_app/tmp/cache/assets/development/sprockets/71ff3ab765090b6daa27969f6eb56fd0 +0 -0
  29. data/spec/rails_app/tmp/cache/assets/development/sprockets/7250cf6654022ff231aed2eaa0ce7b5f +0 -0
  30. data/spec/rails_app/tmp/cache/assets/development/sprockets/78fe20223c36898325a9c4b2c5b9523f +0 -0
  31. data/spec/rails_app/tmp/cache/assets/development/sprockets/83ea57e5cb665b7643248a9129870519 +0 -0
  32. data/spec/rails_app/tmp/cache/assets/development/sprockets/8411ea481fc20d345affc9abebbea601 +0 -0
  33. data/spec/rails_app/tmp/cache/assets/development/sprockets/89f9660384238597a59e787c66e0b2cd +0 -0
  34. data/spec/rails_app/tmp/cache/assets/development/sprockets/8aac9881e31c9e101aee1d7b926c9b5d +0 -0
  35. data/spec/rails_app/tmp/cache/assets/development/sprockets/8ffe76c9f2babb34fe924c4bc1fb9b58 +0 -0
  36. data/spec/rails_app/tmp/cache/assets/development/sprockets/91bc8d8ad6e413fa5ab8aba410a129a3 +0 -0
  37. data/spec/rails_app/tmp/cache/assets/development/sprockets/9ae207cbf1388d2848f50413af97e3ca +0 -0
  38. data/spec/rails_app/tmp/cache/assets/development/sprockets/9b26c4899cfc5eefc7ae82ccf78e667d +0 -0
  39. data/spec/rails_app/tmp/cache/assets/development/sprockets/9e77b3a6bf069240e43173f9cc6e8e8a +0 -0
  40. data/spec/rails_app/tmp/cache/assets/development/sprockets/a9e045ed0da1e7aeec42ecbaa004f374 +0 -0
  41. data/spec/rails_app/tmp/cache/assets/development/sprockets/b0991ffa51c1c366941a555c3643078a +0 -0
  42. data/spec/rails_app/tmp/cache/assets/development/sprockets/b7732372d38c46ae99328022e1fd86c3 +0 -0
  43. data/spec/rails_app/tmp/cache/assets/development/sprockets/b854cd4c2fe6f12b39294cec2718c44f +0 -0
  44. data/spec/rails_app/tmp/cache/assets/development/sprockets/cc3e6fbec60851d530af0cb3927ae723 +0 -0
  45. data/spec/rails_app/tmp/cache/assets/development/sprockets/d1f64ebeb7f5b9680c8c563659247872 +0 -0
  46. data/spec/rails_app/tmp/cache/assets/development/sprockets/ddf4385a5814c1c034410ffd071fbac4 +0 -0
  47. data/spec/rails_app/tmp/cache/assets/development/sprockets/e032da315be18f628acb87d4f469e052 +0 -0
  48. data/spec/rails_app/tmp/cache/assets/development/sprockets/e3c7e415a4520993c2e0029aedbf4890 +0 -0
  49. data/spec/rails_app/tmp/cache/assets/development/sprockets/ea8bddcc0e2b1aa79353e4a5d62928fb +0 -0
  50. data/spec/rails_app/tmp/cache/assets/development/sprockets/ec52d415f445c961a4df7880d52d434b +0 -0
  51. data/spec/rails_app/tmp/cache/assets/development/sprockets/f3d58f13d1651ab6ed838874cbf4bfbe +0 -0
  52. data/spec/rails_app/tmp/cache/assets/development/sprockets/f64fddc03d06a4d713666e938bf06633 +0 -0
  53. data/spec/rails_app/tmp/cache/assets/test/sprockets/22a1b9d5fc1414cd13555c248420966d +0 -0
  54. data/spec/rails_app/tmp/cache/assets/test/sprockets/3055607d4a01c24bb30f86d38b66be76 +0 -0
  55. data/spec/rails_app/tmp/cache/assets/test/sprockets/4d2a90e455a595f51101e7e94572384e +0 -0
  56. data/spec/rails_app/tmp/cache/assets/test/sprockets/71ff3ab765090b6daa27969f6eb56fd0 +0 -0
  57. data/spec/rails_app/tmp/cache/assets/test/sprockets/7250cf6654022ff231aed2eaa0ce7b5f +0 -0
  58. data/spec/rails_app/tmp/cache/assets/test/sprockets/8aac9881e31c9e101aee1d7b926c9b5d +0 -0
  59. data/spec/rails_app/tmp/cache/assets/test/sprockets/8ffe76c9f2babb34fe924c4bc1fb9b58 +0 -0
  60. data/spec/rails_app/tmp/cache/assets/test/sprockets/91bc8d8ad6e413fa5ab8aba410a129a3 +0 -0
  61. data/spec/rails_app/tmp/cache/assets/test/sprockets/a4418907621c16e75d7854a32069f4e4 +0 -0
  62. data/spec/rails_app/tmp/cache/assets/test/sprockets/b7732372d38c46ae99328022e1fd86c3 +0 -0
  63. data/spec/rails_app/tmp/cache/assets/test/sprockets/e3c7e415a4520993c2e0029aedbf4890 +0 -0
  64. data/spec/rails_app/tmp/cache/assets/test/sprockets/e7f9fbccbb808aa76a460587409e9a23 +0 -0
  65. data/spec/rails_app/{app/assets/javascripts/custom.js → tmp/restart.txt} +0 -0
  66. data/spec/testing_controller_spec.rb +0 -5
  67. metadata +77 -118
  68. data/spec/rails_app/Gemfile +0 -51
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7959dc180ff1c8a5e7bf0c05a1652a5a463c2fe6
4
- data.tar.gz: d3e6da13e9ff90fe4f7053fc801b2fc2a308fcdf
3
+ metadata.gz: 9feeff744c3cbc74c198deb51319964fb2e0651e
4
+ data.tar.gz: 05ba7c189835a774953f40ff549cd353f2d83b40
5
5
  SHA512:
6
- metadata.gz: eb6bee8567e697e89c86280ad59f8b9cacb3a64f61a822ace835e35306ceb2e1bb8d74136fb53e28d362780b4d8febc2405cc68db995dcd171d314be2f725600
7
- data.tar.gz: a35272cec176a529f806cdbacb629d51836c359ead72adab188268f5b30fc739e6fc0daa7cf65d81ee9632064621496b1db75b4a9ffc4f2e9f863120690d07a6
6
+ metadata.gz: 232d64cd3173aa22ab57527cc4dc42d61c4cd4f1faafb7aebb0918ff265a19c2984c4a1b4f85bb223a7314c17a274ef88316cbe8054950d5fc5986801b2d1748
7
+ data.tar.gz: 36149aeed5a102ea7c4841bb67906e689303ca9b4a83feb867bfa354482740bfa76e824c68bda1f9fbc1841070f336050d32d3cf62d37719d08effc1a66633fe
data/Gemfile CHANGED
@@ -1,3 +1,22 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
+
5
+ gem 'rails', '4.2.0'
6
+ gem 'sqlite3'
7
+ gem 'yard'
8
+ gem 'rake'
9
+
10
+ group :test do
11
+ gem 'rspec'
12
+ gem 'rspec-rails'
13
+ gem 'capybara'
14
+ gem 'selenium-webdriver'
15
+ end
16
+
17
+ group :development, :test do
18
+ gem 'byebug'
19
+ gem 'web-console', '~> 2.0'
20
+ gem 'pry-rails'
21
+ gem 'netzke-core', github: 'netzke/netzke-core'
22
+ end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Netzke Testing
1
+ # Netzke Testing [![Gem Version](https://fury-badge.herokuapp.com/rb/netzke-testing.png)](http://badge.fury.io/rb/netzke-testing)
2
2
 
3
3
  This gem helps with development and testing of Netzke components. In parcticular, it helps you with:
4
4
 
@@ -75,6 +75,20 @@ code](https://github.com/netzke/netzke-testing/tree/master/app/assets/javascript
75
75
  implemented helpers (TODO: document them). Also, refer to other Netzke gems source code (like netzke-core and
76
76
  netzke-basepack) to see examples using the helpers.
77
77
 
78
+ ## Adding custom spec helpers
79
+
80
+ You may add (or require, by means of Sprockets) additional helpers in `app/assets/javascripts/netzke/testing.js`, which will be included in the testing template *after* the helpers provided by netzke-testing. For example:
81
+
82
+ // in app/assets/javascripts/netzke/testing.js
83
+ //= require_tree ./testing
84
+
85
+ # in app/assets/javascripts/netzke/testing/grid.js.coffee
86
+ Ext.apply window,
87
+ enableColumnFilter: (column, value) ->
88
+ # ...
89
+
90
+ After this the `enableColumnFilter` helper will be available in your Mocha specs.
91
+
78
92
  ## Testing with selenium webdriver
79
93
 
80
94
  Generate the `netzke_mocha_spec.rb` file that will automatically run the specs that follow a certain naming convention:
@@ -105,10 +119,44 @@ helper provided by the `netzke_testing` gem. Here's an example (in `spec/user_gr
105
119
 
106
120
  The `run_mocha_spec` here will run a Mocha spec from `spec/grid_with_destructive_button.js.coffee`.
107
121
 
108
- You can explicitely specify a component to run the spec on (in order to override the convention):
122
+ You can explicitely specify a component to run the spec on:
109
123
 
110
124
  run_mocha_spec 'grid_with_destructive_button', component: 'UserGrid'
111
125
 
126
+ To investigate the problem in case of a failing Mocha spec, set `stop_on_error` to `true` (this will keep the browser open on the failed spec):
127
+
128
+ run_mocha_spec 'grid_with_destructive_button', stop_on_error: true
129
+
130
+ (in this case you'll have to terminate the specs by pressing `ctrl+c`)
131
+
132
+ ## Setting timeout for longer running JS specs
133
+
134
+ Netzke-testing by default assumes that your specs do not take longer than 5 seconds, and mark them failed if they do. If your spec are as complex as taking longer than that, you can increase this value in an initializer, e.g.:
135
+
136
+ # in config/initializers/netzke.rb
137
+ Netzke::Testing.setup do |config|
138
+ config.js_timeout = 10 # seconds
139
+ end
140
+
141
+ You could also set this in `spec_helper.rb` like this:
142
+
143
+ Netzke::Testing.js_timeout = 10
144
+
145
+ However, keep in mind, that this won't have effect on running specs manually in the browser (by specifying the `spec` URL parameter, as shown above). For this case, you may provide the `timeout` URL paramter (takes precedence over `Netzke::Testing.js_timeout`):
146
+
147
+ http://localhost:3000/netzke/components/UserGrid?spec=user_grid&timeout=10
148
+
149
+ ## Asynchronous helpers
150
+
151
+ Asynchronous helpers like `wait` can either call the provided callback function, or (if none was provided) return a promise, so you can do:
152
+
153
+ wait().
154
+ .then ->
155
+ doSomething()
156
+ wait()
157
+ .then
158
+ doSomeMore()
159
+
112
160
  ## Requirements
113
161
 
114
162
  * Ruby >= 2.0.0
@@ -6,16 +6,22 @@ Ext.Ajax.on 'requestcomplete', ->
6
6
  Netzke.ajaxCount -= 1
7
7
 
8
8
  Ext.apply window,
9
+ # Waits for all AJAX activity to stop, then calls the optional callback. If no callback was specified, returns a
10
+ # promise. The first argument can be a number of milliseconds to wait before starting to listen to the AJAX activity
11
+ # (handy when some Ext method implement a fixed delay before doing something, like triggering a column filter after it
12
+ # was set).
13
+ #
9
14
  # Examples:
10
15
  #
11
16
  # wait ->
12
17
  # afterAllAjaxActivityIsStopped()
13
18
  #
14
- # wait 2000, ->
15
- # afterTwoSeconds()
19
+ # wait 200, ->
20
+ # waitsAtLeast200MsBeforeCallingThis()
21
+ #
22
+ # wait().then -> doSomething()
16
23
  wait: () ->
17
- if typeof arguments[0] == 'function'
18
- callback = arguments[0]
24
+ waitInCycle = (callback) ->
19
25
  i = 0
20
26
  id = setInterval ->
21
27
  i += 1
@@ -26,12 +32,35 @@ Ext.apply window,
26
32
  # this way we ensure another 20ms cycle before we issue a callback
27
33
  i = 100 if Netzke.ajaxCount == 0
28
34
  , 200
29
- else
30
- delay = arguments[0]
31
- callback = arguments[1]
32
- setInterval ->
33
- callback.call()
34
- , delay
35
+
36
+ # wait ->
37
+ # callbackAsParameter()
38
+ if typeof arguments[0] == 'function'
39
+ return waitInCycle arguments[0]
40
+
41
+ if Ext.isNumber(arguments[0])
42
+
43
+ # wait 50, ->
44
+ # waitAtLeast50Seconds()
45
+ if Ext.isFunction(arguments[1])
46
+ delay = arguments[0]
47
+ callback = arguments[1]
48
+ setInterval ->
49
+ waitInCycle(resolve)
50
+ , delay
51
+ return null
52
+
53
+ # wait(50).then ->
54
+ # waitAtLeast50ThenResolve()
55
+ else
56
+ console.log("1", 1)
57
+ delay = arguments[0]
58
+ return new Promise (resolve, reject) ->
59
+ setInterval ->
60
+ waitInCycle(resolve)
61
+ , delay
62
+
63
+ return new Promise (resolve, reject) -> waitInCycle resolve
35
64
 
36
65
  click: (cmp) ->
37
66
  if Ext.isString(cmp)
@@ -10,6 +10,10 @@ Ext.apply window,
10
10
  throw cmp + " not found" if Ext.isString(cmp)
11
11
  expect(cmp.isDisabled()).to.be(true)
12
12
 
13
+ expectEnabled: (cmp) ->
14
+ throw cmp + " not found" if Ext.isString(cmp)
15
+ expect(cmp.isDisabled()).to.be(false)
16
+
13
17
  expectInvisibleBodyOf: (cmp) ->
14
18
  throw cmp + " not found" if Ext.isString(cmp)
15
19
  expect(cmp.body.isVisible()).to.be false
@@ -1,9 +1,16 @@
1
1
  Ext.apply window,
2
- grid: (title) ->
3
- if title
4
- Ext.ComponentQuery.query('grid[title="'+title+'"]')[0]
2
+ grid: (value, lookup) ->
3
+ # default to query by title for backwards compatibility
4
+ lookup = lookup || 'title'
5
+ if value && lookup == 'title'
6
+ Ext.ComponentQuery.query('grid[title="'+value+'"]')[0] ||
7
+ Ext.ComponentQuery.query('treepanel[title="'+value+'"]')[0]
8
+ else if value && lookup == 'name'
9
+ Ext.ComponentQuery.query('grid[name="'+value+'"]')[0] ||
10
+ Ext.ComponentQuery.query('treepanel[name="'+value+'"]')[0]
5
11
  else
6
- Ext.ComponentQuery.query('grid{isVisible(true)}')[0]
12
+ Ext.ComponentQuery.query('grid{isVisible(true)}')[0] ||
13
+ Ext.ComponentQuery.query('treepanel{isVisible(true)}')[0]
7
14
 
8
15
  expandRowCombo: (field, params) ->
9
16
  g = g || this.grid()
@@ -36,11 +43,17 @@ Ext.apply window,
36
43
  record.set(key, value)
37
44
 
38
45
  selectAssociation: (attr, value, callback) ->
39
- expandRowCombo attr
40
- wait ->
41
- select value, in: combobox(attr)
42
- # wait ->
43
- callback.call()
46
+ action = (cb) ->
47
+ expandRowCombo attr
48
+ wait ->
49
+ select value, in: combobox(attr)
50
+ cb()
51
+
52
+ if callback
53
+ action(callback)
54
+ else
55
+ new Promise (resolve, reject) ->
56
+ action(resolve)
44
57
 
45
58
  valuesInColumn: (name, params) ->
46
59
  params ?= {}
@@ -51,6 +64,16 @@ Ext.apply window,
51
64
  out.push(if assocValue then assocValue else r.get(name))
52
65
  out
53
66
 
67
+ # Example:
68
+ # valueInCell 'author__name', 2
69
+ valueInCell: (column, row, params) ->
70
+ params ?= {}
71
+ grid = params.in || this.grid()
72
+ r = grid.getStore().getAt(row)
73
+
74
+ assocValue = r.get('meta').associationValues[column]
75
+ if assocValue then assocValue else r.get(column)
76
+
54
77
  selectAllRows: (params) ->
55
78
  params ?= {}
56
79
  grid = params.in || this.grid()
@@ -76,6 +99,7 @@ Ext.apply window,
76
99
  cell.innerHTML
77
100
  )
78
101
 
102
+ # Examples:
79
103
  # selectLastRow()
80
104
  # selectLastRow in: grid('Book')
81
105
  selectLastRow: (params) ->
@@ -83,6 +107,7 @@ Ext.apply window,
83
107
  grid = params.in || this.grid()
84
108
  grid.getSelectionModel().select(grid.getStore().last())
85
109
 
110
+ # Examples:
86
111
  # selectFirstRow()
87
112
  # selectFirstRow in: grid('Book')
88
113
  selectFirstRow: (params) ->
@@ -90,6 +115,14 @@ Ext.apply window,
90
115
  grid = params.in || this.grid()
91
116
  grid.getSelectionModel().select(grid.getStore().first())
92
117
 
118
+ # Examples:
119
+ # selectRow 5
120
+ # selectRow 5, in: grid('Book')
121
+ selectRow: (n, params) ->
122
+ params ?= {}
123
+ grid = params.in || this.grid()
124
+ grid.getSelectionModel().select(n)
125
+
93
126
  # Example:
94
127
  # editLastRow {title: 'Foo', exemplars: 10}
95
128
  editLastRow: ->
@@ -0,0 +1 @@
1
+ // placeholder
@@ -2,20 +2,24 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Netzke Testing</title>
5
- <%= csrf_meta_tag %>
6
5
  <%= load_netzke(minified: false) %>
7
6
 
8
7
  <% if params[:spec] %>
8
+ <%# dependencies %>
9
9
  <%= javascript_include_tag "netzke/testing/expect/expect.js" %>
10
10
  <%= javascript_include_tag "netzke/testing/mocha/mocha.js" %>
11
11
  <%= stylesheet_link_tag "netzke/testing/mocha/mocha.css" %>
12
+
13
+ <%# mocha config %>
12
14
  <script>
13
15
  mocha.setup('bdd');
14
- mocha.setup({ignoreLeaks: true, slow: 500, timeout: 5000});
16
+ mocha.setup({ignoreLeaks: true, slow: 500, timeout: <%= (params[:timeout].to_i || Netzke::Testing.js_timeout) * 1000 %>});
15
17
  Ext.onReady(function(){
16
18
  Netzke.mochaRunner = mocha.run(function(){Netzke.mochaDone = true;});
17
19
  });
18
20
  </script>
21
+
22
+ <%# netzke-testing helpers %>
19
23
  <% if !params["no-helpers"] %>
20
24
  <%= javascript_include_tag "netzke/testing/helpers/actions" %>
21
25
  <%= javascript_include_tag "netzke/testing/helpers/queries" %>
@@ -24,10 +28,10 @@
24
28
  <%= javascript_include_tag "netzke/testing/helpers/form" %>
25
29
  <% end %>
26
30
 
27
- <% for path in Netzke::Testing.custom_js %>
28
- <%= javascript_include_tag path %>
29
- <% end %>
31
+ <%# custom JS (e.g. additional helpers) %>
32
+ <%= javascript_include_tag "netzke/testing" %>
30
33
 
34
+ <%# actual spec %>
31
35
  <%= javascript_include_tag "/netzke/specs/#{params[:spec]}" %>
32
36
  <% end %>
33
37
 
data/config/routes.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  Rails.application.routes.draw do
2
- # get "netzke_testing/components/:component", controller: :netzke_testing, action: :components
3
- # get "netzke_testing/specs"
4
2
  if Rails.env.test? || Rails.env.development?
5
3
  get 'netzke/components/:class' => 'netzke/testing#components', as: :netzke_components
6
4
  get 'netzke/specs/*name' => 'netzke/testing#specs', as: :netzke_specs
@@ -3,6 +3,7 @@ module Netzke
3
3
  class Engine < ::Rails::Engine
4
4
  config.before_initialize do |app|
5
5
  Rails.application.config.assets.precompile += %w(netzke/testing/**/*.*)
6
+ Rails.application.config.assets.precompile += %w(netzke/testing.js)
6
7
  end
7
8
  end
8
9
  end
@@ -7,13 +7,12 @@ module Netzke::Testing::Helpers
7
7
 
8
8
  visit url
9
9
 
10
- # Wait while the test is running
11
- wait_for_javascript
10
+ wait_for_javascript(options[:stop_on_error])
12
11
 
13
- assert_mocha_results
12
+ assert_mocha_results(options[:stop_on_error])
14
13
  end
15
14
 
16
- def wait_for_javascript
15
+ def wait_for_javascript(stop_on_error = false)
17
16
  start = Time.now
18
17
  loop do
19
18
  page.execute_script("return Netzke.mochaDone;") ? break : sleep(0.1)
@@ -23,13 +22,11 @@ module Netzke::Testing::Helpers
23
22
  end
24
23
 
25
24
  rescue Selenium::WebDriver::Error::JavascriptError => e
26
- # give some time for visual examination of the problem
27
- # sleep 5
28
-
25
+ sleep 1.year if stop_on_error
29
26
  raise e
30
27
  end
31
28
 
32
- def assert_mocha_results
29
+ def assert_mocha_results(stop_on_error = false)
33
30
  result = page.execute_script(<<-JS)
34
31
  var runner = Netzke.mochaRunner;
35
32
  var errors = [];
@@ -43,14 +40,14 @@ module Netzke::Testing::Helpers
43
40
  JS
44
41
 
45
42
  if !result["success"]
46
- # give some time for visual examination of the problem
47
- # sleep 500
43
+ sleep 1.year if stop_on_error
48
44
 
49
45
  errors = result["errors"].each_with_index.map do |(title, error), i|
50
46
  "#{i+1}) #{title}\n#{error}\n\n"
51
47
  end
52
48
 
53
49
  raise "Failures:\n#{errors.join}"
50
+ raise "Test failed: #{result["test"]}\n#{result["error"]}"
54
51
  end
55
52
  end
56
53
  end
@@ -1,5 +1,5 @@
1
1
  module Netzke
2
2
  module Testing
3
- VERSION = "0.12.1"
3
+ VERSION = "0.12.2"
4
4
  end
5
5
  end
@@ -15,6 +15,10 @@ module Netzke
15
15
  mattr_accessor :custom_js
16
16
  @@custom_js = []
17
17
 
18
+ # Timeout (seconds) for JS spec execution
19
+ mattr_accessor :js_timeout
20
+ @@js_timeout = 5
21
+
18
22
  def self.rspec_init(rspec_config)
19
23
  @@spec_root = Pathname.new(caller.first).join("../..")
20
24
  rspec_config.include(Netzke::Testing::Helpers)
@@ -18,12 +18,4 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "coffee-script"
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rails", "~> 4.2.0"
24
- spec.add_development_dependency "sqlite3"
25
- spec.add_development_dependency 'capybara'
26
- spec.add_development_dependency 'selenium-webdriver'
27
- spec.add_development_dependency "rspec-rails"
28
- spec.add_development_dependency 'netzke-core', '~> 0.12.0'
29
21
  end
@@ -6,7 +6,7 @@ require 'rails/all'
6
6
  # you've limited to :test, :development, or :production.
7
7
  Bundler.require(*Rails.groups)
8
8
 
9
- require 'netzke-core'
9
+ $LOAD_PATH.unshift(File.expand_path("../../../../lib", __FILE__))
10
10
  require 'netzke-testing'
11
11
 
12
12
  module RailsApp
@@ -1,5 +1,4 @@
1
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
-
1
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
2
  require 'bundler/setup' # Set up gems listed in the Gemfile.
4
3
 
5
4
  $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,4 +1,3 @@
1
1
  Netzke::Testing.setup do |config|
2
- config.custom_js = ['custom.js']
3
2
  config.spec_root = File.expand_path("../../../../..", __FILE__)
4
3
  end