sus 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd31357ac07052a2e6c93a7dc674d2245a567644434eaf8e1983dedd7f594be7
4
- data.tar.gz: c33ba038edd7f9c22896a6e3c4b8fe7f8880d4c0e8361c3d44cbd74bba35939f
3
+ metadata.gz: 5223e3220b3a2fbc2263efd27ca457b971241eff48bb667f0a2235cc6de5c98c
4
+ data.tar.gz: 2a6558d6a0cd06527115a569553ded158709b16be0125de5101fcf130ff753b4
5
5
  SHA512:
6
- metadata.gz: bfcd742a489b8ec128cd79ab6d631b1ba6bc45421563eeec51acb476648bc5bb821dc5fccbf0530032e5075879c8271a1be0981825e444d0893a407ca6ebb6fa
7
- data.tar.gz: 6014eff61f90083dbf9210faf64d2c7fec25c67cc8e0afa1721f20d3d730f7d8feea22c36e0db308b5712fea9b5a75433bd01785c0bea5eeb20bdb9a3ac5d7e4
6
+ metadata.gz: 55acd565c40a26bdbb65abd4f8ae491fadcbb2cdab96f341a76f86ae19187beeac32ab562d497f77fb0e40d8ac2c711aeceb5d984b2f9d1b529f3c74d2579cfb
7
+ data.tar.gz: d5872899a88f5e02125655773d57ba11930e31f106ef52c2e9b03d584e808cb761ac614bfc83270e94f7cb5c5aceff559dae9456732a39c38d87bf1e851d40ae
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.5.1"
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,7 +1,7 @@
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.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -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.