rspec-situations 0.0.2 → 0.0.4

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/Gemfile CHANGED
@@ -1,13 +1,18 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+
3
4
  gemspec
4
5
 
6
+
5
7
  gem 'rake'
6
8
  gem 'rspec'
7
9
  gem 'bundler'
8
- gem 'growl'
9
- gem 'debugger'
10
- gem 'guard'
11
- gem 'guard-bundler'
12
- gem 'guard-rspec'
13
10
 
11
+
12
+ group :development do
13
+ gem 'growl'
14
+ gem 'debugger'
15
+ gem 'guard'
16
+ gem 'guard-bundler'
17
+ gem 'guard-rspec'
18
+ end
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/brett-richardson/rspec-situations.png?branch=master)](https://travis-ci.org/brett-richardson/rspec-situations)
2
+
1
3
  Using Rspec Situations
2
4
  ======================
3
5
 
@@ -16,16 +18,20 @@ describe Apple do
16
18
  subject( :apple ){ create :apple }
17
19
 
18
20
  situation( :bought ){ subject.bought_by = create :user }
19
- situation( :red ){ subject.color = :Red }
21
+ situation( :red ){ subject.color = :red }
20
22
 
21
- situation( :1yr_old, 'a year old' ){ subject.created_at = 2.years.ago }
23
+ situation( :one_yr_old, 'a year old' ){ subject.created_at = 1.years.ago } # With optional description
22
24
 
23
- describe_situation :stolen, :red do
25
+ describe_situation :bought, :red do
24
26
  it{ should be_tasty }
25
27
  end
26
28
 
27
- describe_situation :stolen, :1yr_old do
29
+ describe_situation :bought, :one_yr_old, 'bought a year ago' do # With optional description
28
30
  it{ should_not be_tasty }
29
31
  end
32
+
33
+ describe_situation :bought, :one_yr_old do
34
+ it{ should_not be_tasty }
35
+ end
30
36
  end
31
37
  ```
@@ -42,7 +42,15 @@ module RSpec::Situations
42
42
 
43
43
  # Combine each situation's description into a string
44
44
  def _rsits_describe_name( *keys )
45
- 'when ' + _rsits( *keys ).map{ |k,v| v.description }.join( ' and ' )
45
+ hash = _rsits *keys
46
+
47
+ 'when ' + keys.map do |key|
48
+ if hash[key]
49
+ hash[key].description
50
+ else # Fall back to simple key.to_s if the situation isn't found
51
+ key
52
+ end
53
+ end.join( ' and ' )
46
54
  end
47
55
 
48
56
 
@@ -53,6 +61,7 @@ module RSpec::Situations
53
61
 
54
62
  def _rsits_combined_hash
55
63
  _rsits_hash # TODO: Combine with parents, not needed until you want parent and local situations to interact directly with each other.
64
+ # FIXME: How do we access previous contexts from here?
56
65
  end
57
66
 
58
67
 
@@ -4,10 +4,10 @@ module RSpec
4
4
  VERSION_NUMBERS = [
5
5
  VERSION_MAJOR = 0,
6
6
  VERSION_MINOR = 0,
7
- VERSION_BUILD = 2,
7
+ VERSION_BUILD = 4
8
8
  ]
9
9
 
10
- VERSION = VERSION_NUMBERS.join(".")
10
+ VERSION = VERSION_NUMBERS.join '.'
11
11
 
12
12
  end
13
13
  end
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.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: