simple_bdd 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -0
- data/lib/simple_bdd/version.rb +1 -1
- data/lib/simple_bdd.rb +10 -1
- data/spec/pending_feature_spec.rb +31 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2563a3bf2a35ea7ac7f31270833b6fe27b7fb33a
|
4
|
+
data.tar.gz: e8a8cd3214239544fbac50bbc470b4dfd5225734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d96c689534b38d9f6ae26b66705478fb68c05fe6a6aec419bff07851f1e4077eadae43fb012bf4e3d2f302c9fbdf10bc4a61f87727566d5180f681992371581
|
7
|
+
data.tar.gz: a6d7b3bcbbfea5da2e40738584d336ea9f442e24b1be9c6f5b4b614b91f1fe02b8d14dc78fbbe3541fd6fc70271da46961289a32abf64c5442430d25a6bc409a
|
data/README.md
CHANGED
@@ -64,6 +64,13 @@ You'll need to require SimpleBDD in the spec helper and include it into your tes
|
|
64
64
|
config.include SimpleBdd
|
65
65
|
end
|
66
66
|
|
67
|
+
By default, SimpleBDD marks specs pending on missing step implementations.
|
68
|
+
You can change this behavior to raise an error instead in the spec helper:
|
69
|
+
|
70
|
+
RSpec.configure do |config|
|
71
|
+
config.raise_error_on_missing_step_implementation = true
|
72
|
+
end
|
73
|
+
|
67
74
|
## Contributing
|
68
75
|
|
69
76
|
1. Fork it
|
data/lib/simple_bdd/version.rb
CHANGED
data/lib/simple_bdd.rb
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
require "simple_bdd/version"
|
2
2
|
|
3
3
|
module SimpleBdd
|
4
|
+
class StepNotImplemented < StandardError; end
|
5
|
+
|
6
|
+
RSpec.configuration.add_setting(:raise_error_on_missing_step_implementation,
|
7
|
+
default: false) if defined?(::RSpec)
|
8
|
+
|
4
9
|
%w[Given When Then And Also But].each do |method|
|
5
10
|
define_method(method) do |message|
|
6
11
|
method_name = methodize(message)
|
7
12
|
if respond_to? method_name || !defined?(::RSpec)
|
8
13
|
send method_name
|
9
14
|
else
|
10
|
-
|
15
|
+
if RSpec.configuration.raise_error_on_missing_step_implementation?
|
16
|
+
raise StepNotImplemented, method_name
|
17
|
+
else
|
18
|
+
pending(method_name)
|
19
|
+
end
|
11
20
|
end
|
12
21
|
end
|
13
22
|
|
@@ -12,9 +12,37 @@ describe "Pending features in rspec" do
|
|
12
12
|
|
13
13
|
subject { SimpleBddExample.new }
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
context "when raise_error_on_missing_step_implementation is true" do
|
16
|
+
before(:each) do
|
17
|
+
@raise_error = RSpec.configuration.raise_error_on_missing_step_implementation
|
18
|
+
RSpec.configuration.raise_error_on_missing_step_implementation = true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "raises an error on missing step implementations" do
|
22
|
+
expect {
|
23
|
+
subject.Given "I have not defined a step"
|
24
|
+
}.to raise_error SimpleBdd::StepNotImplemented
|
25
|
+
end
|
26
|
+
|
27
|
+
after(:each) do
|
28
|
+
RSpec.configuration.raise_error_on_missing_step_implementation = @raise_error
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "when raise_error_on_missing_step_implementation is false" do
|
33
|
+
before(:each) do
|
34
|
+
@raise_error = RSpec.configuration.raise_error_on_missing_step_implementation
|
35
|
+
RSpec.configuration.raise_error_on_missing_step_implementation = false
|
36
|
+
end
|
37
|
+
|
38
|
+
it "makes the step pending" do
|
39
|
+
subject.should_receive(:pending).with("i_have_not_defined_a_step")
|
40
|
+
expect { subject.Given "I have not defined a step" }.to_not raise_error
|
41
|
+
end
|
42
|
+
|
43
|
+
after(:each) do
|
44
|
+
RSpec.configuration.raise_error_on_missing_step_implementation = @raise_error
|
45
|
+
end
|
18
46
|
end
|
19
47
|
|
20
48
|
it "should still raise NoMethodError in code under test" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_bdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robbie Clutton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|