rspec-steps 2.0.1 → 2.1.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
  SHA1:
3
- metadata.gz: fd276211aacdfac79c2bb9787cef0207af76b10f
4
- data.tar.gz: 5e293bebcd74fcc6fb1ac848ba3e72a40b8e3d86
3
+ metadata.gz: a1ee490834a493e6f722e519813ffc94f2a7ff3a
4
+ data.tar.gz: 1b50c820064433d490b8c432831c59fe78c519c4
5
5
  SHA512:
6
- metadata.gz: 485c15bc0322a7b7dc35a82bd78c08b722b0d0bed06ba21c756196b1bc94d221462f04158c21f56385591c6c9b548d5c4958907bb57c55ed7b03a830090e7ff4
7
- data.tar.gz: 552f83918ebba943bbd5653abb757a4ba6ca599db99518707b62ce2a0b9d2fa454eb083dbbb42fb2e7f67eaf686f805e849053de7371b0f08f408b179ce49a81
6
+ metadata.gz: bf075795e1fa4b62627665c5274fdc85a278b2f4a8d9207b276fdb0812df796e185325d6068086f57b0043f8d2a03f5dca399cea235d461908364b5632a36710
7
+ data.tar.gz: 22b96a1f27fc89e821858790e2903e8ef5db388af8f4ed3e0009aefe194577512c0c0c4006e1f1b956a5ddbeb444c58d6a4d54ebf356c68b824e8224030c5492
data/doc/README CHANGED
@@ -89,6 +89,10 @@ there's a :step hook), this shift *no longer* applies to config.before _et al_
89
89
  -- you'll need to use config.before :each to run around each step. This is the
90
90
  primary change to the Steps interface that called for a major version bump.
91
91
 
92
+ If you're migrating a project from a previous version: be sure that any
93
+ dependency on Waterpig is at least at 0.12. Then remove any `before :step`
94
+ calls in spec support files.
95
+
92
96
  ## Advanced stuff: shared steps
93
97
 
94
98
  If you have (for example) two user stories that share the same first N steps but then
@@ -8,6 +8,9 @@ module RSpec::Steps
8
8
  describer = @describer
9
9
 
10
10
  RSpec.describe(*describer.group_args, describer.metadata) do
11
+ describer.modules.each do |mod|
12
+ mod.apply(self)
13
+ end
11
14
  describer.let_list.each do |letter|
12
15
  letter.define_on(describer.step_list, self)
13
16
  end
@@ -3,9 +3,9 @@ require 'rspec-steps/step'
3
3
  require 'rspec-steps/hook'
4
4
  require 'rspec-steps/step-list'
5
5
  require 'rspec-steps/lets'
6
+ require 'rspec-steps/modules'
6
7
 
7
8
  module RSpec::Steps
8
-
9
9
  class Describer
10
10
  def initialize(args, metadata, &block)
11
11
  @group_args = args
@@ -17,9 +17,10 @@ module RSpec::Steps
17
17
  @step_list = StepList.new
18
18
  @hooks = []
19
19
  @let_list = []
20
+ @modules = []
20
21
  instance_eval(&block)
21
22
  end
22
- attr_reader :group_args, :let_list, :step_list, :hooks, :metadata
23
+ attr_reader :group_args, :modules, :let_list, :step_list, :hooks, :metadata
23
24
 
24
25
  def step(*args, &action)
25
26
  metadata = {}
@@ -45,8 +46,18 @@ module RSpec::Steps
45
46
  SharedSteps[name] = Describer.new(args, {:caller => caller}, &block)
46
47
  end
47
48
 
49
+ def include(mod)
50
+ @modules << ModuleInclusion.new(mod)
51
+ end
52
+
53
+ def extend(mod)
54
+ @modules << ModuleExtension.new(mod)
55
+ end
56
+
48
57
  def perform_steps(name)
49
58
  describer = SharedSteps.fetch(name)
59
+ @modules += describer.modules
60
+ @let_list += describer.let_list
50
61
  @hooks += describer.hooks
51
62
  @step_list += describer.step_list
52
63
  end
@@ -23,7 +23,7 @@ module RSpec::Steps
23
23
  name = args.first
24
24
  raise "shared step lists need a String for a name" unless name.is_a? String
25
25
  raise "there is already a step list named #{name}" if SharedSteps.has_key?(name)
26
- SharedSteps[name] = Describer.new(*args, &block)
26
+ SharedSteps[name] = Describer.new(*args, {:caller => caller}, &block)
27
27
  end
28
28
  end
29
29
  extend DSL
@@ -0,0 +1,23 @@
1
+ module RSpec::Steps
2
+ class ModuleExtension
3
+ def initialize(mod)
4
+ @mod = mod
5
+ end
6
+
7
+ def apply(target)
8
+ mod = @mod
9
+ target.instance_eval { extend mod }
10
+ end
11
+ end
12
+
13
+ class ModuleInclusion
14
+ def initialize(mod)
15
+ @mod = mod
16
+ end
17
+
18
+ def apply(target)
19
+ mod = @mod
20
+ target.instance_eval { include mod }
21
+ end
22
+ end
23
+ end
@@ -19,6 +19,29 @@ describe RSpec::Core::ExampleGroup do
19
19
  end
20
20
  end
21
21
 
22
+ it "should handle inclusion and extension with modules" do
23
+ module Testing
24
+ def something
25
+ 42
26
+ end
27
+ end
28
+
29
+ group = nil
30
+ sandboxed do
31
+ group = RSpec.steps "Test Steps" do
32
+ include Testing
33
+ extend Testing
34
+
35
+ it("accesses a method from a module"){ expect(something).to eq 42 }
36
+ end
37
+ group.run
38
+ end
39
+
40
+ group.examples.each do |example|
41
+ expect(example.metadata[:execution_result].status).to eq(:passed)
42
+ end
43
+ end
44
+
22
45
  it "should define let blocks correctly" do
23
46
  group = nil
24
47
  sandboxed do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-steps
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Judson Lester
@@ -9,61 +9,68 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-09-21 00:00:00.000000000 Z
12
+ date: 2015-12-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: corundum
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
18
+ - - '>='
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.4.0
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ">="
25
+ - - '>='
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.4.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: metric_fu
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: 4.11.1
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: 4.11.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ">="
46
+ - - '>='
47
47
  - !ruby/object:Gem::Version
48
48
  version: '3.0'
49
- - - "<"
49
+ - - <
50
50
  - !ruby/object:Gem::Version
51
51
  version: '3.99'
52
52
  type: :runtime
53
53
  prerelease: false
54
54
  version_requirements: !ruby/object:Gem::Requirement
55
55
  requirements:
56
- - - ">="
56
+ - - '>='
57
57
  - !ruby/object:Gem::Version
58
58
  version: '3.0'
59
- - - "<"
59
+ - - <
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.99'
62
- description: |2
63
- I don't like Cucumber. I don't need plain text stories. My clients either
64
- read code or don't read any test documents, so Cucumber is mostly useless to me.
65
- But often, especially in full integration tests, it would be nice to have
66
- steps in a test.
62
+ description: |2+
63
+ A minimal implementation of integration testing within RSpec.
64
+ Allows you to build sequential specs, each with a description,
65
+ but where state is maintained between tests and before/after actions are only
66
+ triggered at the beginning and end of the entire sequence. Cool things you
67
+ can do with this:
68
+
69
+ * Build multi-step user stories in plain RSpec syntax. Locate the point of
70
+ failure quickly, and break up large integrations into sensible steps
71
+ * Speed up groups of related tests by running your factories only once before
72
+ the whole group.
73
+
67
74
  email:
68
75
  - judson@lrdesign.com
69
76
  - evan@lrdesign.com
@@ -313,6 +320,7 @@ files:
313
320
  - lib/rspec-steps/dsl.rb
314
321
  - lib/rspec-steps/hook.rb
315
322
  - lib/rspec-steps/lets.rb
323
+ - lib/rspec-steps/modules.rb
316
324
  - lib/rspec-steps/monkeypatching.rb
317
325
  - lib/rspec-steps/step-list.rb
318
326
  - lib/rspec-steps/step-result.rb
@@ -329,21 +337,21 @@ licenses:
329
337
  metadata: {}
330
338
  post_install_message:
331
339
  rdoc_options:
332
- - "--inline-source"
333
- - "--main"
340
+ - --inline-source
341
+ - --main
334
342
  - doc/README
335
- - "--title"
336
- - rspec-steps-2.0.1 RDoc
343
+ - --title
344
+ - rspec-steps-2.1.0 RDoc
337
345
  require_paths:
338
346
  - lib/
339
347
  required_ruby_version: !ruby/object:Gem::Requirement
340
348
  requirements:
341
- - - ">="
349
+ - - '>='
342
350
  - !ruby/object:Gem::Version
343
351
  version: '0'
344
352
  required_rubygems_version: !ruby/object:Gem::Requirement
345
353
  requirements:
346
- - - ">="
354
+ - - '>='
347
355
  - !ruby/object:Gem::Version
348
356
  version: '0'
349
357
  requirements: []