ex_aequo_rspex 0.1.0 → 0.1.2

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: 044b062f83ca413f27da7f4a802833bf6659e0db122c17f005b76ad908ebeade
4
- data.tar.gz: 3870469b623ee3ea90922134c4aaa5dba7e8da717f15ea0a30a7a5d86199032d
3
+ metadata.gz: 1830a0eeeebf7c21a62f80d6618b67757f882609dacf27ad29397d6172316331
4
+ data.tar.gz: '074892cee1c504afbf5b9907d68ff4330fbc61b00c9b11cee30e8507a4617c38'
5
5
  SHA512:
6
- metadata.gz: 50c33841f3031ec70041118ee065d824ef3f8cc3c2cce966f9931bc51946a86b16cc18d4b290423c6d60dd6ee0329b48448b06e6acd3bf2730890970e8d776eb
7
- data.tar.gz: c00008945393b987f1105241f0a3274c3aa6da31470d1a3c0e335a1ca25ebca560ff2e0e379307f7e679d28de78d92a6f381631ce4a182f48e10ffd20365d70c
6
+ metadata.gz: e497f05e1f0beaf50f91e269dd0b006928702d521883429fc7d5c44163f5ecfd2c7ce5539d9b0c279d05ba78739120fdb3e1fcabf9c4f071eda6969582371ff7
7
+ data.tar.gz: 7ebce217c25b7e44c3d0ba21862ec6f2ca7f79936c2446e4a0ed3308e9ccc5b619a45ad9e43bed7cf2617a38ddacd74c3e6f5dc4327590fa8d45ef376f48d764
@@ -9,6 +9,12 @@ module ExAequo
9
9
  actual = blk ? instance_eval(&blk) : subject
10
10
  expect(actual).to eq(value)
11
11
  end
12
+ alias_method :it_equals, :it_eq
13
+
14
+ def it_has_ivar(name, value, &blk)
15
+ actual = blk ? instance_eval(&blk) : subject
16
+ expect(actual.instance_variable_get("@#{name}")).to eq(value)
17
+ end
12
18
 
13
19
  def it_is(predicate, *args, &blk)
14
20
  actual = blk ? instance_eval(&blk) : subject
@@ -19,6 +25,11 @@ module ExAequo
19
25
  actual = blk ? instance_eval(&blk) : subject
20
26
  expect(actual).not_to send("be_#{predicate}", *args)
21
27
  end
28
+
29
+ def it_raises(exception, message=nil, &blk)
30
+ expect { blk ? instance_eval(&blk) : subject }
31
+ .to raise_error(exception, message)
32
+ end
22
33
  end
23
34
  end
24
35
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
4
+ module ExAequo
5
+ module RSpex
6
+ module Macros
7
+ module LetMacros
8
+
9
+ def let_alphanumeric_random(name, length: 16)
10
+ let(name) { SecureRandom.alphanumeric(length) }
11
+ end
12
+
13
+ def let_double(name, type)
14
+ let(name) { double(type) }
15
+ end
16
+
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ RSpec.configure do |conf|
23
+ conf.extend ExAequo::RSpex::Macros::LetMacros
24
+ end
25
+ # SPDX-License-Identifier: AGPL-3.0-or-later
@@ -10,6 +10,13 @@ module ExAequo
10
10
  it_eq(value, &blk)
11
11
  end
12
12
  end
13
+ alias_method :it_equals, :it_eq
14
+
15
+ def it_has_ivar(name, value, &blk)
16
+ specify do
17
+ it_has_ivar(name, value, &blk)
18
+ end
19
+ end
13
20
 
14
21
  def it_is(predicate, *args, &blk)
15
22
  specify do
@@ -22,6 +29,12 @@ module ExAequo
22
29
  it_is_not(predicate, *args, &blk)
23
30
  end
24
31
  end
32
+
33
+ def it_raises(exception, message=nil, &blk)
34
+ specify do
35
+ it_raises(exception, message, &blk)
36
+ end
37
+ end
25
38
  end
26
39
  end
27
40
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative 'macros/let_macros'
3
4
  require_relative 'macros/subject_macros'
4
5
  # SPDX-License-Identifier: AGPL-3.0-or-later
@@ -2,7 +2,7 @@
2
2
 
3
3
  module ExAequo
4
4
  module RSpex
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
8
8
  # SPDX-License-Identifier: AGPL-3.0-or-later
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ex_aequo_rspex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
@@ -35,6 +35,7 @@ files:
35
35
  - lib/ex_aequo/rspex/helpers.rb
36
36
  - lib/ex_aequo/rspex/helpers/subject_helpers.rb
37
37
  - lib/ex_aequo/rspex/macros.rb
38
+ - lib/ex_aequo/rspex/macros/let_macros.rb
38
39
  - lib/ex_aequo/rspex/macros/subject_macros.rb
39
40
  - lib/ex_aequo/rspex/version.rb
40
41
  homepage: https://codeberg.org/lab419/rb_ex_aequo_rspex