active_cucumber 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/active_cucumber.gemspec +1 -1
- data/features/active_cucumber/diff_all.feature +10 -0
- data/features/active_cucumber/diff_one.feature +10 -0
- data/features/support/subscription_cucumberator.rb +4 -0
- data/lib/active_cucumber/cucumberator.rb +4 -1
- data/lib/active_cucumber/cucumparer.rb +3 -2
- data/lib/active_cucumber.rb +4 -4
- 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: 51a76f3bdbaa0df727d7aeca2971ff1eb003d179
|
4
|
+
data.tar.gz: 8241aaae7b03a1cd3c4367ad989d21a31bc35568
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4ac02e89ff2de842f4dc2b468ebed869a814c776398450e21f1ccd98c2dc1b31aec223db46cace7ed01dcbf7f466910824fcef5c90aacd50400159b13d4bb90
|
7
|
+
data.tar.gz: 46cf5be5cee5156333881d9255b92fc34e3fd75bfa8ed96eae978f5c89b0e3818a9f556e09e162e232c3985ffc9aaacc58f38b0e74b53e5fc8d7d697ab930c5a
|
data/Gemfile.lock
CHANGED
data/active_cucumber.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'active_cucumber'
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.10'
|
7
7
|
s.authors = ['Kevin Goslar']
|
8
8
|
s.email = ['kevin.goslar@gmail.com']
|
9
9
|
s.summary = %s(ActiveRecord tools for Cucumber)
|
@@ -69,3 +69,13 @@ Feature: ActiveCucumber.diff_all!
|
|
69
69
|
| Star Trek TNG | All Good Things |
|
70
70
|
Then the test fails
|
71
71
|
And Cucumparer prints the error message "Tables were not identical"
|
72
|
+
|
73
|
+
|
74
|
+
Scenario: using context values
|
75
|
+
Given the subscriptions:
|
76
|
+
| SUBSCRIBER | SHOW |
|
77
|
+
| Q | Star Trek TNG |
|
78
|
+
When running "ActiveCucumber.diff_all! Subscription, table, context: { current_user: 'Q' }" with this table:
|
79
|
+
| SUBSCRIBER | SHOW |
|
80
|
+
| me | Star Trek TNG |
|
81
|
+
Then the test passes
|
@@ -53,3 +53,13 @@ Feature: ActiveCucumber.diff_one!
|
|
53
53
|
| NAME | All Good Things |
|
54
54
|
Then the test fails
|
55
55
|
And Cucumparer prints the error message "Tables were not identical"
|
56
|
+
|
57
|
+
|
58
|
+
Scenario: using context values
|
59
|
+
Given the subscription:
|
60
|
+
| SUBSCRIBER | Q |
|
61
|
+
| SHOW | Star Trek TNG |
|
62
|
+
When running "ActiveCucumber.diff_one! @created_subscription, table, context: { current_user: 'Q' }" with this table:
|
63
|
+
| SUBSCRIBER | me |
|
64
|
+
| SHOW | Star Trek TNG |
|
65
|
+
Then the test passes
|
@@ -8,8 +8,11 @@ module ActiveCucumber
|
|
8
8
|
class Cucumberator
|
9
9
|
|
10
10
|
# object - the instance to decorate
|
11
|
-
def initialize object
|
11
|
+
def initialize object, context
|
12
12
|
@object = object
|
13
|
+
context.each do |key, value|
|
14
|
+
instance_variable_set "@#{key}", value
|
15
|
+
end
|
13
16
|
end
|
14
17
|
|
15
18
|
|
@@ -2,9 +2,10 @@ module ActiveCucumber
|
|
2
2
|
|
3
3
|
class Cucumparer
|
4
4
|
|
5
|
-
def initialize clazz, cucumber_table
|
5
|
+
def initialize clazz, cucumber_table, context
|
6
6
|
@clazz = clazz
|
7
7
|
@cucumber_table = cucumber_table
|
8
|
+
@context = context
|
8
9
|
end
|
9
10
|
|
10
11
|
# Returns all entries in the database as a horizontal Mortadella table
|
@@ -45,7 +46,7 @@ module ActiveCucumber
|
|
45
46
|
|
46
47
|
# Returns the Cucumberator object for the given ActiveRecord instance
|
47
48
|
def cucumberator_for object
|
48
|
-
cucumberator_class.new object
|
49
|
+
cucumberator_class.new object, @context
|
49
50
|
end
|
50
51
|
|
51
52
|
end
|
data/lib/active_cucumber.rb
CHANGED
@@ -26,15 +26,15 @@ module ActiveCucumber
|
|
26
26
|
# matches the given horizontal Cucumber table.
|
27
27
|
#
|
28
28
|
# Sorts records by creation date.
|
29
|
-
def self.diff_all! clazz, cucumber_table
|
30
|
-
cucumparer = Cucumparer.new clazz, cucumber_table
|
29
|
+
def self.diff_all! clazz, cucumber_table, context: {}
|
30
|
+
cucumparer = Cucumparer.new clazz, cucumber_table, context
|
31
31
|
cucumber_table.diff! cucumparer.to_horizontal_table
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
35
|
# Verifies that the given object matches the given vertical Cucumber table
|
36
|
-
def self.diff_one! object, cucumber_table
|
37
|
-
cucumparer = Cucumparer.new object.class, cucumber_table
|
36
|
+
def self.diff_one! object, cucumber_table, context: {}
|
37
|
+
cucumparer = Cucumparer.new object.class, cucumber_table, context
|
38
38
|
cucumber_table.diff! cucumparer.to_vertical_table(object)
|
39
39
|
end
|
40
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Goslar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|