superbara 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3909dad114b84f3a1f3ff199b87b279ab4ffdd37123d1d9cfaef699cf14fcafb
4
- data.tar.gz: 31755ae0ce8e2b79ac5b53edf42d580610fdf402611d7b20179cad39bb815d96
3
+ metadata.gz: 2238d76a17abb6017288ec127e19d7e38da5a3a450aab924ccab843358408b82
4
+ data.tar.gz: d197b4816a25d7af7d3846bfd46410091e6aa6dceb3d513991868ea995f51f8f
5
5
  SHA512:
6
- metadata.gz: cf7aa8ff7792e5b427fc55e7cce7a9847e6c112b65fe8eff1f1975efa9cbf4733d4b031d1bfa79ffb604c6512529015e5f9836e42f81f47db5e49c78c38a6614
7
- data.tar.gz: 6bdea68e00631dbf1f21f2548256770ca3ce165442f46ba48e30046017f9cf4051feb7da726dcd203741847f942213e614baa2ccbc5a2204e723e56c73271f02
6
+ metadata.gz: b9519813335ccff5a615278d1cc00c838af1855d32fa78df72c741b13c8d3893a8eb8e940daa8d4a67a4fb3a32d41b807fa71d09735c147e25efdd9d513a71fd
7
+ data.tar.gz: bfc6174d941af1012e1361a24bf3531cc3ef841d0ad6d3aaf582df0ec19f15fc0eb06afaf86c6639e9bf8642324d84109fa3aa3ab8941f305ae0867e74a0cb42
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- superbara (0.11.1)
4
+ superbara (0.12.0)
5
5
  binding_of_caller (~> 0.8, >= 0.8.0)
6
6
  capybara (~> 3.1, >= 3.1.0)
7
7
  colorize (~> 0.8, >= 0.8.1)
data/bin/tests CHANGED
@@ -44,4 +44,17 @@ if [ "$exit_status" != 1 ]; then
44
44
  exit 1
45
45
  fi
46
46
 
47
+ SUPERBARA_TAGS=example exe/superbara run tests/tags
48
+
49
+ set +e
50
+ SUPERBARA_TAGS=fails exe/superbara run tests/tags
51
+ exit_status=$?
52
+ set -e
53
+
54
+ if [ "$exit_status" != 1 ]; then
55
+ echo "err! tests/tags when fails"
56
+ exit 1
57
+ fi
58
+
59
+
47
60
  echo "success!"
data/lib/superbara.rb CHANGED
@@ -231,6 +231,7 @@ require_relative "superbara/cli"
231
231
  require_relative "superbara/context"
232
232
  require_relative "superbara/web"
233
233
  require_relative "superbara/errors/not_desired_tag_error"
234
+ require_relative "superbara/errors/export_stops_error"
234
235
 
235
236
  trap "SIGINT" do
236
237
  puts "
@@ -23,14 +23,31 @@ sleep 0.0001
23
23
  Superbara.main.instance_eval "@#{k} = #{eval}"
24
24
  end
25
25
 
26
+ not_desired_tag_error_occurred = false
27
+ export_stops_error = nil
26
28
  begin
27
29
  load path, true
28
- rescue Superbara::Errors::NotDesiredTagError
29
- Superbara.output " ..skipped due to tag not found"
30
+ rescue Superbara::Errors::ExportStopsError => ex
31
+ export_stops_error = ex
32
+ rescue Superbara::Errors::NotDesiredTagError => ex
33
+ not_desired_tag_error_occurred = true
34
+ test_tags = Marshal.load(ex.message).join(",")
35
+ allowed_tags = Superbara.config.tags.join(",")
36
+ Superbara.output " ..skipped due to test tags (#{test_tags}) not found in current tags: #{allowed_tags}"
37
+ ensure
38
+ params.each_pair do |k,v|
39
+ Superbara.main.instance_eval "remove_instance_variable '@#{k}'"
40
+ end
30
41
  end
31
42
 
32
- params.each_pair do |k,v|
33
- Superbara.main.instance_eval "remove_instance_variable '@#{k}'"
43
+ if export_stops_error
44
+ # sending it forward for run to return what's inside
45
+ raise export_stops_error
46
+ end
47
+
48
+ if not_desired_tag_error_occurred
49
+ # FAKENEWS: sending it forward for run to return false
50
+ raise Superbara::Errors::NotDesiredTagError
34
51
  end
35
52
  end
36
53
 
data/lib/superbara/dsl.rb CHANGED
@@ -86,6 +86,10 @@ return Array.from(
86
86
  e.click
87
87
  end
88
88
 
89
+ def export(e)
90
+ raise Superbara::Errors::ExportStopsError, Marshal.dump(e)
91
+ end
92
+
89
93
  @@once_runs = []
90
94
  def run(what, once: false, **params, &block)
91
95
  if once
@@ -117,9 +121,12 @@ return Array.from(
117
121
  Superbara.project_path = File.dirname(better_what)
118
122
  end
119
123
 
120
- error_happened = false
124
+ export_object = nil
121
125
  begin
122
126
  Superbara.current_context.__superbara_load(better_what, params)
127
+ rescue Superbara::Errors::NotDesiredTagError
128
+ rescue Superbara::Errors::ExportStopsError => ex
129
+ export_object = Marshal.load ex.message
123
130
  rescue Exception => ex
124
131
  if ENV["SUPERBARA_ON_ERROR"] == "continue"
125
132
  colored_output = " ERROR: ".colorize(:red)
@@ -135,11 +142,7 @@ return Array.from(
135
142
 
136
143
  Superbara.project_path = old_project_path
137
144
 
138
- if error_happened
139
- false
140
- else
141
- true
142
- end
145
+ export_object
143
146
  end
144
147
 
145
148
  def visit(visit_uri_or_domain_or_path)
@@ -234,7 +237,7 @@ return Array.from(
234
237
  return value
235
238
  end
236
239
  else
237
- raise Superbara::Errors::NotDesiredTagError
240
+ raise Superbara::Errors::NotDesiredTagError, Marshal.dump(tags)
238
241
  end
239
242
  end
240
243
 
@@ -0,0 +1,6 @@
1
+ module Superbara
2
+ module Errors
3
+ class ExportStopsError < StandardError
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Superbara
2
- VERSION = "0.11.1"
2
+ VERSION = "0.12.0"
3
3
  end
@@ -2,14 +2,14 @@ first = run "first_failing"
2
2
  second = run "second_ok"
3
3
  third = run "third_failing"
4
4
 
5
- assert do
6
- first == false
5
+ assert "first" do
6
+ first == nil
7
7
  end
8
8
 
9
- assert do
10
- second == true
9
+ assert "second" do
10
+ second == "second"
11
11
  end
12
12
 
13
- assert do
14
- third == false
13
+ assert "third" do
14
+ third == nil
15
15
  end
@@ -0,0 +1 @@
1
+ export "second"
@@ -1,3 +1,5 @@
1
1
  tag "example", "block" do
2
2
  visit "example.com"
3
3
  end
4
+
5
+ export "block"
@@ -0,0 +1,8 @@
1
+ tag "fails"
2
+
3
+ unless ENV["SUPERBARA_TAGS"]
4
+ puts "SUPERBARA_TAGS not defined, returning before fail."
5
+ return
6
+ end
7
+
8
+ asdf
@@ -0,0 +1,16 @@
1
+ simple = run "simple"
2
+ block = run "block"
3
+ notags = run "notags"
4
+ fails = run "fails"
5
+
6
+ assert "simple" do
7
+ simple == "simple"
8
+ end
9
+
10
+ assert "block" do
11
+ block == "block"
12
+ end
13
+
14
+ assert "notags" do
15
+ notags == "notags"
16
+ end
@@ -0,0 +1,3 @@
1
+ visit "example.com"
2
+
3
+ export "notags"
@@ -1,3 +1,6 @@
1
1
  tag "example", "simple"
2
2
 
3
3
  visit "example.com"
4
+
5
+ export "simple"
6
+ asdf # must not reach here
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: superbara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matti Paksula
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-06 00:00:00.000000000 Z
11
+ date: 2018-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -318,9 +318,6 @@ files:
318
318
  - examples/login-and-logout/using-params/main.rb
319
319
  - examples/sites/pharos.sh/main.rb
320
320
  - examples/sites/vr.fi/helsinki-tampere/main.rb
321
- - examples/tags/block.rb
322
- - examples/tags/main.rb
323
- - examples/tags/simple.rb
324
321
  - exe/superbara
325
322
  - lib/capybara_monkey.rb
326
323
  - lib/pry_monkey.rb
@@ -331,6 +328,7 @@ files:
331
328
  - lib/superbara/config.rb
332
329
  - lib/superbara/context.rb
333
330
  - lib/superbara/dsl.rb
331
+ - lib/superbara/errors/export_stops_error.rb
334
332
  - lib/superbara/errors/not_desired_tag_error.rb
335
333
  - lib/superbara/helpers.rb
336
334
  - lib/superbara/rspec.rb
@@ -357,6 +355,11 @@ files:
357
355
  - tests/run/has_instance_variables.rb
358
356
  - tests/run/has_no_instance_variables.rb
359
357
  - tests/run/main.rb
358
+ - tests/tags/block.rb
359
+ - tests/tags/fails.rb
360
+ - tests/tags/main.rb
361
+ - tests/tags/notags.rb
362
+ - tests/tags/simple.rb
360
363
  - vendor/chromedriver/linux64/.gitkeep
361
364
  - vendor/chromedriver/linux64/chromedriver
362
365
  - vendor/chromedriver/mac64/.gitkeep
@@ -1,2 +0,0 @@
1
- run "simple"
2
- run "block"