simple_bdd 0.0.5 → 0.0.6

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: 38a859d56adb2b287bbfe19b519710a991678c66
4
- data.tar.gz: 6a503535bc2943ed9bed7ce759f855ee6c740106
3
+ metadata.gz: ddea2617ea76a8759d41af6c9fe3856697e0c87e
4
+ data.tar.gz: 93411bfde2e6c997fd3d031c0a40f8ce23d3998f
5
5
  SHA512:
6
- metadata.gz: c5a8da1fd6a829039fe69e8bd2d2f3b464629c2cbe647a323f4a695151288a927fec9fba1a21e08e72818c1462cff4a6166b0af2c296aa34e95e779ac0ec94a3
7
- data.tar.gz: 709b89f255a1799089a7036f6f0b303637ac8ac71a796f43f3914cbbb20cd92fccfe9465abbdc6dd0b19d5b44873c7d235804791831f05c2f0ab73dca66b0bfb
6
+ metadata.gz: 4c359e91b53df2715bbec30916a2cc6c029a07097ffc3203ef35a1d227553fa2a39a0fcdd7f332dc07a5f966ccdd6aa81f4a7f91dcb0056f861e54a0d4e4103f
7
+ data.tar.gz: 384e798b2c537ed118e8f14d937a46f21fcea407b1f7bdaa97b586780fdfe78595773ad103ef6fcc807e2697326a7628416593bbe361f28d9d09cb1ddef4f191
data/README.md CHANGED
@@ -19,13 +19,41 @@ Or install it yourself as:
19
19
 
20
20
  ## Usage
21
21
 
22
- The following will call the 'something_happens' method in scope of the current class or module.
22
+ ### Standard Usage
23
+
24
+ The following will call commented method in scope of the current class or module. (Every RSpec ```describe``` block is an anonymous class.)
23
25
 
24
26
  [Gg]iven "Some state" # calls some_state
25
27
  [Ww]hen "this happens" # calls this_happens
26
- [Tt]hen "this change occurs" #calls this_change_occurs
27
- [Aa]nd "this other side effect happens" #this_other_side_effect_happens
28
-
28
+ [Tt]hen "this change occurs" # calls this_change_occurs
29
+ [Bb]ut "this other thing still happens" # calls this_other_thing_still_happens
30
+ [Aa]nd "this other side effect happens" # calls this_other_side_effect_happens
31
+
32
+ ## Behavior Usage
33
+
34
+ Some additional methods allow you to group related behaviors in your tests:
35
+
36
+ Given "Admin is signed in"
37
+
38
+ behavior "admin can manage widgets" do
39
+ When "Admin views all widgets"
40
+ Then "Admin sees the first widget"
41
+ end
42
+
43
+ behavior "admin can manage factories" do
44
+ When "Admin views all factories"
45
+ Then "Admin sees the first factory"
46
+ end
47
+
48
+ Any of the following names can be substituted for ```behavior``` above:
49
+
50
+ * and_by
51
+ * behaves_like
52
+ * behavior
53
+ * behaviour
54
+ * by
55
+ * it_also
56
+
29
57
  ## RSpec
30
58
 
31
59
  You'll need to require SimpleBDD in the spec helper and include it into your tests like so:
@@ -1,3 +1,3 @@
1
1
  module SimpleBdd
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/simple_bdd.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require "simple_bdd/version"
2
2
 
3
3
  module SimpleBdd
4
- %w[Given When Then And Also].each do |method|
4
+ %w[Given When Then And Also But].each do |method|
5
5
  define_method(method) do |message|
6
6
  method_name = methodize(message)
7
7
  if respond_to? method_name || !defined?(::RSpec)
@@ -25,7 +25,7 @@ module SimpleBdd
25
25
  end
26
26
 
27
27
  %w[behavior behaviour behaves_like by and_by it_also].each do |method|
28
- define_method(method) do |&block|
28
+ define_method(method) do |*, &block|
29
29
  block.call
30
30
  end
31
31
  end
@@ -7,8 +7,8 @@ end
7
7
  describe SimpleBddExample do
8
8
  let(:subject) { SimpleBddExample.new }
9
9
 
10
- describe "#given, #when, #then, #and, #also" do
11
- ["given", "when", "then", "and", "Given", "When", "Then", "And", "Also", "also"].each do |method|
10
+ describe "#given, #when, #then, #and, #also, #but" do
11
+ ["given", "when", "then", "and", "Given", "When", "Then", "And", "Also", "also", "But", "but"].each do |method|
12
12
  it "calls the method after translating the string" do
13
13
  subject.should_receive(:something)
14
14
  subject.send(method, "something")
@@ -39,7 +39,7 @@ describe SimpleBddExample do
39
39
  describe "##{method}" do
40
40
  it 'calls the block' do
41
41
  called = false
42
- subject.send(method) do
42
+ subject.send(method, "an unused parameter") do
43
43
  called = true
44
44
  end
45
45
 
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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robbie Clutton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-25 00:00:00.000000000 Z
11
+ date: 2013-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec