sus 0.5.0 → 0.6.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: fd31357ac07052a2e6c93a7dc674d2245a567644434eaf8e1983dedd7f594be7
4
- data.tar.gz: c33ba038edd7f9c22896a6e3c4b8fe7f8880d4c0e8361c3d44cbd74bba35939f
3
+ metadata.gz: 2eedf780fb01d2963981a6364e0a7ddd9879fd4e99933124c8989f9ccbc10283
4
+ data.tar.gz: 6a477c4bf989ab5ff4a509711d85dc87bfd8298336dc0e211cd7a9183f6cea67
5
5
  SHA512:
6
- metadata.gz: bfcd742a489b8ec128cd79ab6d631b1ba6bc45421563eeec51acb476648bc5bb821dc5fccbf0530032e5075879c8271a1be0981825e444d0893a407ca6ebb6fa
7
- data.tar.gz: 6014eff61f90083dbf9210faf64d2c7fec25c67cc8e0afa1721f20d3d730f7d8feea22c36e0db308b5712fea9b5a75433bd01785c0bea5eeb20bdb9a3ac5d7e4
6
+ metadata.gz: 2d84a319444e5179896f4cc5181dec03b385c66c20157aa6394a3b69c7eb2773e45520e6bef890dab861ea769deb53841949ab3ef762d041e5d74505aaee5205
7
+ data.tar.gz: c33182e1c13956e7fb3d712bb3759bfb4fefd7fff0b5160cf5eb0ac3190cd2a8a519ab32ff82e762ae7ad4000d73b1120c2f7e8967f6b4ee41d82a2401e6b6db
data/bin/sus CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  require_relative '../lib/sus'
4
4
 
5
+ if File.exist?("config/test.rb")
6
+ load("config/test.rb")
7
+ end
8
+
5
9
  def prepare(paths, registry)
6
10
  if paths&.any?
7
11
  paths.each do |path|
@@ -31,4 +35,6 @@ if assertions.failed.any?
31
35
  assertions.failed.each do |failure|
32
36
  failure.output.append(output)
33
37
  end
38
+
39
+ exit(1)
34
40
  end
data/bin/sus-parallel CHANGED
@@ -3,6 +3,10 @@
3
3
  require_relative '../lib/sus'
4
4
  require_relative '../lib/sus/progress'
5
5
 
6
+ if File.exist?("config/test.rb")
7
+ load("config/test.rb")
8
+ end
9
+
6
10
  require 'etc'
7
11
 
8
12
  def prepare(paths, registry)
@@ -85,4 +89,6 @@ if assertions.failed.any?
85
89
  assertions.failed.each do |failure|
86
90
  failure.output.append(output)
87
91
  end
92
+
93
+ exit(1)
88
94
  end
data/lib/sus/describe.rb CHANGED
@@ -7,13 +7,10 @@ module Sus
7
7
 
8
8
  attr_accessor :subject
9
9
 
10
- def self.extended(base)
11
- base.children = Hash.new
12
- end
13
-
14
10
  def self.build(parent, subject, unique: true, &block)
15
11
  base = Class.new(parent)
16
- base.extend(Describe)
12
+ base.singleton_class.prepend(Describe)
13
+ base.children = Hash.new
17
14
  base.subject = subject
18
15
  base.description = subject.to_s
19
16
  base.identity = Identity.nested(parent.identity, base.description, unique: unique)
data/lib/sus/filter.rb CHANGED
@@ -18,7 +18,7 @@ module Sus
18
18
  def insert(identity, context)
19
19
  key = identity.key
20
20
 
21
- if @contexts[key]
21
+ if existing_context = @contexts[key]
22
22
  raise KeyError, "Assigning context to existing key: #{key.inspect}!"
23
23
  else
24
24
  @contexts[key] = context
data/lib/sus/identity.rb CHANGED
@@ -56,7 +56,8 @@ module Sus
56
56
  unless @key
57
57
  key = Array.new
58
58
 
59
- append_unique_key(key)
59
+ # For a specific leaf node, the last part is not unique, i.e. it must be identified explicitly.
60
+ append_unique_key(key, @unique == true ? false : @unique)
60
61
 
61
62
  @key = key.join(':')
62
63
  end
@@ -66,18 +67,18 @@ module Sus
66
67
 
67
68
  protected
68
69
 
69
- def append_unique_key(key)
70
+ def append_unique_key(key, unique = @unique)
70
71
  if @parent
71
72
  @parent.append_unique_key(key)
72
73
  else
73
74
  key << @path
74
75
  end
75
76
 
76
- if @unique == true
77
+ if unique == true
77
78
  # No key is needed because this identity is unique.
78
79
  else
79
- if @unique
80
- key << @unique
80
+ if unique
81
+ key << unique
81
82
  elsif @line
82
83
  key << @line
83
84
  end
data/lib/sus/it.rb CHANGED
@@ -7,7 +7,7 @@ module Sus
7
7
  base = Class.new(parent)
8
8
  base.extend(It)
9
9
  base.description = description
10
- base.identity = Identity.nested(parent.identity, base.description, unique: false)
10
+ base.identity = Identity.nested(parent.identity, base.description)
11
11
 
12
12
  if block_given?
13
13
  base.define_method(:call, &block)
@@ -7,13 +7,10 @@ module Sus
7
7
 
8
8
  attr_accessor :shared
9
9
 
10
- def self.extended(base)
11
- base.children = Hash.new
12
- end
13
-
14
10
  def self.build(parent, shared, unique: false)
15
11
  base = Class.new(parent)
16
- base.extend(ItBehavesLike)
12
+ base.singleton_class.prepend(ItBehavesLike)
13
+ base.children = Hash.new
17
14
  base.description = shared.name
18
15
  base.identity = Identity.nested(parent.identity, base.description, unique: unique)
19
16
  base.class_exec(&shared.block)
data/lib/sus/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sus
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
data/lib/sus/with.rb CHANGED
@@ -8,13 +8,10 @@ module Sus
8
8
  attr_accessor :subject
9
9
  attr_accessor :variables
10
10
 
11
- def self.extended(base)
12
- base.children = Hash.new
13
- end
14
-
15
11
  def self.build(parent, subject, variables, unique: true, &block)
16
12
  base = Class.new(parent)
17
- base.extend(With)
13
+ base.singleton_class.prepend(With)
14
+ base.children = Hash.new
18
15
  base.subject = subject
19
16
  base.description = subject
20
17
  base.identity = Identity.nested(parent.identity, base.description, unique: unique)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-09 00:00:00.000000000 Z
11
+ date: 2021-12-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  - !ruby/object:Gem::Version
71
71
  version: '0'
72
72
  requirements: []
73
- rubygems_version: 3.3.0.dev
73
+ rubygems_version: 3.2.32
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: A fast and scalable test runner.