lopata 0.1.13 → 0.1.17

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.
data/lib/lopata.rb CHANGED
@@ -1,74 +1,123 @@
1
- require 'lopata/id'
2
- require 'lopata/configuration'
3
- require 'lopata/environment'
4
- require 'lopata/scenario_builder'
5
- require 'lopata/scenario'
6
- require 'lopata/step'
7
- require 'lopata/shared_step'
8
-
9
- # Namespace for all Lopata code.
10
- module Lopata
11
- # Define the scenario.
12
- # @see Lopata::ScenarioBuilder.define
13
- def self.define(*args, &block)
14
- Lopata::ScenarioBuilder.define(*args, &block)
15
- end
16
-
17
- # Skip scenario definition. Option to temporary ignore scenario
18
- def self.xdefine(*args, &block)
19
- end
20
-
21
- # Register the shared step
22
- #
23
- # @example
24
- # Lopata.shared_step 'test user' do
25
- # setup { @user = create(:user) }
26
- # end
27
- #
28
- # Shared step may be used in scenarios by name:
29
- # @example
30
- # Lopata.define 'user' do
31
- # setup 'test user'
32
- #
33
- # it 'exists' do
34
- # expect(@user).to_not be_nil
35
- # end
36
- # end
37
- # @param name [String] shared step unique name
38
- # @param block [Block] shared step action sequence definition
39
- def self.shared_step(name, &block)
40
- Lopata::SharedStep.register(name, &block)
41
- end
42
-
43
- # Yields the global configuration to a block.
44
- # @yield [Lopata::Configuration] global configuration
45
- #
46
- # @example
47
- # Lopata.configure do |config|
48
- # config.before_scenario 'setup test user'
49
- # end
50
- # @see Lopata::Configuration
51
- def self.configure(&block)
52
- yield Lopata.configuration
53
- end
54
-
55
- # Returns global configuration object.
56
- # @return [Lopata::Configuration]
57
- # @see Lopata.configure
58
- def self.configuration
59
- @configuration ||= Lopata::Configuration.new
60
- end
61
-
62
- # @private
63
- # Internal container for global non-configuration data.
64
- def self.world
65
- @world ||= Lopata::World.new
66
- end
67
-
68
- # Return global environment object
69
- # @return [Lopata::Environment]
70
- # @see Lopata::Environment
71
- def self.environment
72
- Lopata.configuration.environment
73
- end
74
- end
1
+ require 'lopata/id'
2
+ require 'lopata/configuration'
3
+ require 'lopata/environment'
4
+ require 'lopata/scenario_builder'
5
+ require 'lopata/scenario'
6
+ require 'lopata/step'
7
+ require 'lopata/shared_step'
8
+
9
+ # Namespace for all Lopata code.
10
+ module Lopata
11
+ # Define the scenario.
12
+ # @see Lopata::ScenarioBuilder.define
13
+ def self.define(*args, &block)
14
+ Lopata::ScenarioBuilder.define(*args, &block)
15
+ end
16
+
17
+ # Skip scenario definition. Option to temporary ignore scenario
18
+ def self.xdefine(*args, &block)
19
+ end
20
+
21
+ # Register the shared step
22
+ #
23
+ # @example
24
+ # Lopata.shared_step 'test user' do
25
+ # setup { @user = create(:user) }
26
+ # end
27
+ #
28
+ # Shared step may be used in scenarios by name:
29
+ # @example
30
+ # Lopata.define 'user' do
31
+ # setup 'test user'
32
+ #
33
+ # it 'exists' do
34
+ # expect(@user).to_not be_nil
35
+ # end
36
+ # end
37
+ # @param name [String] shared step unique name
38
+ # @param block [Block] shared step action sequence definition
39
+ def self.shared_step(name, &block)
40
+ Lopata::SharedStep.register(name, &block)
41
+ end
42
+
43
+ # Register the shared step for setup.
44
+ #
45
+ # shared_setup is a shortcat for shared_step 'name' { setup { .. } }. The block will be arrounded into the setup call.
46
+ #
47
+ # @example
48
+ # Lopata.shared_setup 'test user' do
49
+ # @user = create(:user)
50
+ # end
51
+ #
52
+ # Shared step may be used in scenarios by name:
53
+ # @example
54
+ # Lopata.define 'user' do
55
+ # setup 'test user'
56
+ #
57
+ # it 'exists' do
58
+ # expect(@user).to_not be_nil
59
+ # end
60
+ # end
61
+ # @param name [String] shared step unique name
62
+ # @param block [Block] shared setup definition
63
+ def self.shared_setup(name, &block)
64
+ Lopata::SharedStep.register(name) do
65
+ setup(&block)
66
+ end
67
+ end
68
+
69
+ # Register the shared step for context.
70
+ #
71
+ # shared_context is a shortcat for shared_step('name') { context('name') { .. } }. The block will be arrounded into the context call.
72
+ #
73
+ # @example
74
+ # Lopata.shared_context 'calculation' do
75
+ # it('correct') { expect(1 + 1).to eq 2 }
76
+ # it('incorrect') { expect(1 + 2).to eq 4 }
77
+ # end
78
+ #
79
+ # Shared context may be used in scenarios by name:
80
+ # @example
81
+ # Lopata.define 'verify calcuation in context' do
82
+ # verify 'calculation'
83
+ # end
84
+ # @param name [String] shared step unique name, will be used as a context's name
85
+ # @param block [Block] shared context definition
86
+ def self.shared_context(name, &block)
87
+ Lopata::SharedStep.register(name) do
88
+ context(name, &block)
89
+ end
90
+ end
91
+
92
+ # Yields the global configuration to a block.
93
+ # @yield [Lopata::Configuration] global configuration
94
+ #
95
+ # @example
96
+ # Lopata.configure do |config|
97
+ # config.before_scenario 'setup test user'
98
+ # end
99
+ # @see Lopata::Configuration
100
+ def self.configure(&block)
101
+ yield Lopata.configuration
102
+ end
103
+
104
+ # Returns global configuration object.
105
+ # @return [Lopata::Configuration]
106
+ # @see Lopata.configure
107
+ def self.configuration
108
+ @configuration ||= Lopata::Configuration.new
109
+ end
110
+
111
+ # @private
112
+ # Internal container for global non-configuration data.
113
+ def self.world
114
+ @world ||= Lopata::World.new
115
+ end
116
+
117
+ # Return global environment object
118
+ # @return [Lopata::Environment]
119
+ # @see Lopata::Environment
120
+ def self.environment
121
+ Lopata.configuration.environment
122
+ end
123
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lopata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Volochnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-25 00:00:00.000000000 Z
11
+ date: 2021-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -135,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubygems_version: 3.0.3
138
+ rubygems_version: 3.2.15
139
139
  signing_key:
140
140
  specification_version: 4
141
- summary: lopata-0.1.13
141
+ summary: lopata-0.1.17
142
142
  test_files: []