rspec-situations 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -15
- data/README.md +29 -13
- data/lib/rspec/situations.rb +2 -2
- data/lib/rspec/situations/configure.rb +2 -2
- data/lib/rspec/situations/instance_extensions.rb +1 -1
- data/lib/rspec/situations/situation.rb +1 -1
- data/lib/rspec/situations/version.rb +1 -1
- metadata +49 -1
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,20 @@ Using Rspec Situations
|
|
6
6
|
Using Rspec Situations is super simple.
|
7
7
|
|
8
8
|
|
9
|
+
In your Gemfile:
|
10
|
+
```ruby
|
11
|
+
group :development, :testing do
|
12
|
+
gem 'rspec-situations'
|
13
|
+
end
|
14
|
+
```
|
15
|
+
|
16
|
+
|
17
|
+
In your spec_helper.rb:
|
18
|
+
```ruby
|
19
|
+
require 'rspec/situations'
|
20
|
+
```
|
21
|
+
|
22
|
+
|
9
23
|
Define a situation with the 'situation' method.
|
10
24
|
Add a symbol key to identify the situation, and add an optional description if you like, and pass in a block creating the situation.
|
11
25
|
|
@@ -15,23 +29,25 @@ Describe a set of 1 or more situations with the 'describe_situation' method, and
|
|
15
29
|
|
16
30
|
```ruby
|
17
31
|
describe Apple do
|
18
|
-
|
32
|
+
subject( :apple ){ create :apple }
|
19
33
|
|
20
|
-
|
21
|
-
|
34
|
+
situation( :bought ){ subject.bought_by = create :user }
|
35
|
+
situation( :red ){ subject.color = :red }
|
22
36
|
|
23
|
-
|
37
|
+
situation( :one_yr_old, 'a year old' ) do # With optional description
|
38
|
+
subject.created_at = 1.years.ago
|
39
|
+
end
|
24
40
|
|
25
|
-
|
26
|
-
|
27
|
-
|
41
|
+
describe_situation :bought, :red do
|
42
|
+
it{ should be_tasty }
|
43
|
+
end
|
28
44
|
|
29
|
-
|
30
|
-
|
31
|
-
|
45
|
+
desribe_situation :bought, :one_yr_old, 'bought a year ago' do # With optional description
|
46
|
+
it{ should_not be_tasty }
|
47
|
+
end
|
32
48
|
|
33
|
-
|
34
|
-
|
35
|
-
|
49
|
+
describe_situation :bought, :one_yr_old do
|
50
|
+
it{ should_not be_tasty }
|
51
|
+
end
|
36
52
|
end
|
37
53
|
```
|
data/lib/rspec/situations.rb
CHANGED
@@ -10,7 +10,7 @@ module RSpec::Situations::InstanceExtensions
|
|
10
10
|
def _rsits( *keys ) # Go up the example parents and get the situations requested, whereever they may be defined
|
11
11
|
_rsits_combined_hash.select do |key, _|
|
12
12
|
keys.include? key # Then filter out only the keys we are using
|
13
|
-
end.
|
13
|
+
end.values # Now return an array of situations instead of a hash
|
14
14
|
end
|
15
15
|
|
16
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-situations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -59,6 +59,54 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: guard
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: guard-rspec
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: growl
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
62
110
|
description: Adds a super simple method to describe RSpec situations in terms of smaller
|
63
111
|
situation blocks.
|
64
112
|
email:
|