active_cucumber 0.0.7 → 0.0.8
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/README.md +1 -1
- data/active_cucumber.gemspec +1 -1
- data/features/active_cucumber/create_many.feature +9 -0
- data/features/step_definitions/steps.rb +8 -1
- data/features/support/director.rb +3 -0
- data/features/support/env.rb +12 -0
- data/features/support/show.rb +1 -0
- data/features/support/show_creator.rb +8 -0
- data/features/support/show_cucumberator.rb +4 -0
- data/lib/active_cucumber/creator.rb +6 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d0cb88ebda8bc14d3664472e9701713e4d4bcff
|
4
|
+
data.tar.gz: baffe5a2484e68525d0c473bba68fc77506b3ffd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1350ecc0b1709523fc140a997fcb454c4e5bfba5b60ba1b862f39edc01bb1a58b62947eeead2f8639d0cac36387e992880ed81d3eddbcfd9938b7191416a29b0
|
7
|
+
data.tar.gz: 3523c3ea4f2d48f7c667e608b136ec5cd8434f27e3d4d4ae1c9823252cdfe356b20aff5026cab4839d36f2f9ff2168df522dba36225ddcd7fd4c847a62d9a2dc
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# ActiveCucumber [![Circle CI](https://circleci.com/gh/Originate/active_cucumber.svg?style=shield)](https://circleci.com/gh/Originate/active_cucumber)
|
1
|
+
# ActiveCucumber [![Circle CI](https://circleci.com/gh/Originate/active_cucumber.svg?style=shield)](https://circleci.com/gh/Originate/active_cucumber) [![Dependency Status](https://gemnasium.com/Originate/active_cucumber.svg)](https://gemnasium.com/Originate/active_cucumber) [![Gem Version](https://badge.fury.io/rb/active_cucumber.svg)](https://badge.fury.io/rb/active_cucumber)
|
2
2
|
|
3
3
|
High-level Cucumber helpers for performing
|
4
4
|
[ActiveRecord](http://guides.rubyonrails.org/active_record_basics.html)-based
|
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.8'
|
7
7
|
s.authors = ['Kevin Goslar']
|
8
8
|
s.email = ['kevin.goslar@gmail.com']
|
9
9
|
s.summary = %s(ActiveRecord tools for Cucumber)
|
@@ -30,6 +30,15 @@ Feature: ActiveCucumber.create_many
|
|
30
30
|
And the database contains the show "Star Trek TNG"
|
31
31
|
|
32
32
|
|
33
|
+
Scenario: creating associated objects with a nil value
|
34
|
+
When running "ActiveCucumber.create_many Show, table" with this table:
|
35
|
+
| DIRECTOR | NAME |
|
36
|
+
| | Directionless |
|
37
|
+
| Gene Roddenberry | Star Trek TNG |
|
38
|
+
Then the database contains the given shows
|
39
|
+
And "Directionless" does not have a director
|
40
|
+
|
41
|
+
|
33
42
|
Scenario: creating associated objects that depend on other associated objects
|
34
43
|
When running "ActiveCucumber.create_many Episode, table" with this table:
|
35
44
|
| GENRE | SHOW | NAME |
|
@@ -11,7 +11,7 @@ end
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
|
-
|
14
|
+
When(/^running "([^"]+)" with this table:$/) do |code, table|
|
15
15
|
@previous_table = table
|
16
16
|
begin
|
17
17
|
@error_happened = false
|
@@ -23,6 +23,10 @@ Then(/^running "([^"]+)" with this table:$/) do |code, table|
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
Then(/^"(.*?)" does not have a director$/) do |show_name|
|
27
|
+
expect(Show.find_by(name: show_name).director).to be nil
|
28
|
+
end
|
29
|
+
|
26
30
|
|
27
31
|
Then(/^the database contains the given episode$/) do
|
28
32
|
expect(Episode).to have(1).instance
|
@@ -34,6 +38,9 @@ Then(/^the database contains the given episodes$/) do
|
|
34
38
|
ActiveCucumber.diff_all! Episode, @previous_table
|
35
39
|
end
|
36
40
|
|
41
|
+
Then(/^the database contains the given shows$/) do
|
42
|
+
ActiveCucumber.diff_all! Show, @previous_table
|
43
|
+
end
|
37
44
|
|
38
45
|
Then(/^the database contains the (\w+):$/) do |class_name, table|
|
39
46
|
ActiveCucumber.diff_all! class_name.humanize.singularize.constantize, table
|
data/features/support/env.rb
CHANGED
@@ -22,6 +22,7 @@ ActiveRecord::Schema.define do
|
|
22
22
|
|
23
23
|
create_table :shows, force: true do |t|
|
24
24
|
t.belongs_to :genre
|
25
|
+
t.belongs_to :director
|
25
26
|
t.string :name
|
26
27
|
t.datetime 'created_at'
|
27
28
|
end
|
@@ -38,6 +39,11 @@ ActiveRecord::Schema.define do
|
|
38
39
|
t.belongs_to :show
|
39
40
|
t.datetime 'created_at'
|
40
41
|
end
|
42
|
+
|
43
|
+
create_table :directors, force: true do |t|
|
44
|
+
t.string :name
|
45
|
+
t.datetime 'created_at'
|
46
|
+
end
|
41
47
|
end
|
42
48
|
|
43
49
|
|
@@ -48,6 +54,7 @@ FactoryGirl.define do
|
|
48
54
|
|
49
55
|
factory :show do
|
50
56
|
name { Faker::Book.title }
|
57
|
+
director
|
51
58
|
end
|
52
59
|
|
53
60
|
factory :episode do
|
@@ -60,6 +67,10 @@ FactoryGirl.define do
|
|
60
67
|
subscriber { Faker::Name.name }
|
61
68
|
show
|
62
69
|
end
|
70
|
+
|
71
|
+
factory :director do
|
72
|
+
name { Faker::Name.name }
|
73
|
+
end
|
63
74
|
end
|
64
75
|
|
65
76
|
|
@@ -67,6 +78,7 @@ Before do
|
|
67
78
|
Show.delete_all
|
68
79
|
Episode.delete_all
|
69
80
|
Subscription.delete_all
|
81
|
+
Director.delete_all
|
70
82
|
@error_checked = false
|
71
83
|
end
|
72
84
|
|
data/features/support/show.rb
CHANGED
@@ -19,7 +19,7 @@ module ActiveCucumber
|
|
19
19
|
symbolize_attributes!
|
20
20
|
@attributes.each do |key, value|
|
21
21
|
next unless respond_to?(method = method_name(key))
|
22
|
-
if (result = send method, value)
|
22
|
+
if (result = send method, value) || value.nil?
|
23
23
|
@attributes[key] = result if @attributes.key? key
|
24
24
|
else
|
25
25
|
@attributes.delete key
|
@@ -48,12 +48,16 @@ module ActiveCucumber
|
|
48
48
|
key.downcase.parameterize.underscore.to_sym
|
49
49
|
end
|
50
50
|
|
51
|
+
def normalized_value value
|
52
|
+
value.blank? ? nil : value
|
53
|
+
end
|
54
|
+
|
51
55
|
|
52
56
|
# Makes the keys on @attributes be normalized symbols
|
53
57
|
def symbolize_attributes!
|
54
58
|
@attributes = {}.tap do |result|
|
55
59
|
@attributes.each do |key, value|
|
56
|
-
result[normalized_key key] = value
|
60
|
+
result[normalized_key key] = normalized_value value
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
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.8
|
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
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -216,12 +216,14 @@ files:
|
|
216
216
|
- features/active_cucumber/diff_all.feature
|
217
217
|
- features/active_cucumber/diff_one.feature
|
218
218
|
- features/step_definitions/steps.rb
|
219
|
+
- features/support/director.rb
|
219
220
|
- features/support/env.rb
|
220
221
|
- features/support/episode.rb
|
221
222
|
- features/support/episode_creator.rb
|
222
223
|
- features/support/episode_cucumberator.rb
|
223
224
|
- features/support/genre.rb
|
224
225
|
- features/support/show.rb
|
226
|
+
- features/support/show_creator.rb
|
225
227
|
- features/support/show_cucumberator.rb
|
226
228
|
- features/support/subscription.rb
|
227
229
|
- features/support/subscription_creator.rb
|