pickle 0.5.1 → 0.6.0

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.
Files changed (46) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +3 -2
  3. data/.travis.yml +24 -4
  4. data/History.txt +55 -34
  5. data/README.md +15 -26
  6. data/Rakefile.d/cucumber.rake +13 -4
  7. data/Rakefile.d/repoclean.rake +3 -0
  8. data/features/app/app.rb +7 -7
  9. data/features/app/factories.rb +5 -5
  10. data/features/email/email.feature +1 -0
  11. data/features/step_definitions/email_steps.rb +1 -0
  12. data/features/step_definitions/extra_email_steps.rb +5 -5
  13. data/features/step_definitions/pickle_steps.rb +1 -0
  14. data/features/support/email.rb +1 -0
  15. data/features/support/env.rb +9 -3
  16. data/features/support/pickle.rb +2 -2
  17. data/gemfiles/Gemfile-rails.5.0.x +12 -0
  18. data/gemfiles/Gemfile-rails.5.1.x +10 -0
  19. data/gemfiles/Gemfile-rails.5.2.x +11 -0
  20. data/gemfiles/Gemfile-rails.5.2.x-cukes-4 +11 -0
  21. data/gemfiles/Gemfile-rails.5.2.x-cukes-5 +12 -0
  22. data/gemfiles/Gemfile-rails.6.0.x +10 -0
  23. data/gemfiles/Gemfile-rails.6.0.x-cukes-5 +11 -0
  24. data/gemfiles/Gemfile-rails.edge +9 -0
  25. data/lib/pickle.rb +0 -1
  26. data/lib/pickle/adapter.rb +9 -11
  27. data/lib/pickle/config.rb +1 -1
  28. data/lib/pickle/path.rb +1 -1
  29. data/lib/pickle/session.rb +15 -18
  30. data/lib/pickle/session/parser.rb +11 -9
  31. data/lib/pickle/version.rb +1 -1
  32. data/pickle.gemspec +9 -8
  33. data/rails_generators/pickle/templates/pickle.rb +2 -2
  34. data/spec/pickle/adapter_spec.rb +19 -19
  35. data/spec/pickle/config_spec.rb +9 -9
  36. data/spec/pickle/email_spec.rb +1 -1
  37. data/spec/pickle/path_spec.rb +37 -18
  38. data/spec/pickle/session_spec.rb +5 -5
  39. data/spec/spec_helper.rb +6 -1
  40. metadata +52 -56
  41. data/Gemfile +0 -3
  42. data/Gemfile.lock.development +0 -158
  43. data/features/step_definitions/email_steps.rb +0 -65
  44. data/features/step_definitions/pickle_steps.rb +0 -105
  45. data/features/support/email.rb +0 -21
  46. data/init.rb +0 -0
@@ -1,65 +0,0 @@
1
- # this file generated by script/generate pickle email
2
- #
3
- # add email mappings in features/support/email.rb
4
-
5
- ActionMailer::Base.delivery_method = :test
6
- ActionMailer::Base.perform_deliveries = true
7
-
8
- Before do
9
- ActionMailer::Base.deliveries.clear
10
- end
11
-
12
- # Clear the deliveries array, useful if your background sends email that you want to ignore
13
- Given(/^all emails? (?:have|has) been delivered$/) do
14
- ActionMailer::Base.deliveries.clear
15
- end
16
-
17
- Given(/^(\d)+ emails? should be delivered$/) do |count|
18
- expect(emails.size).to eq(count.to_i)
19
- end
20
-
21
- When(/^(?:I|they) follow "([^"]*?)" in #{capture_email}$/) do |link, email_ref|
22
- visit_in_email(email(email_ref), link)
23
- end
24
-
25
- When(/^(?:I|they) click the first link in #{capture_email}$/) do |email_ref|
26
- click_first_link_in_email(email(email_ref))
27
- end
28
-
29
- Then(/^(\d)+ emails? should be delivered to (.*)$/) do |count, to|
30
- actual = emails("to: \"#{email_for(to)}\"").size
31
- expect(actual).to eq(count.to_i), "Expected #{count} emails but encountered #{actual} delivered to #{to}"
32
- end
33
-
34
- Then(/^(\d)+ emails? should be delivered with #{capture_fields}$/) do |count, fields|
35
- actual = emails(fields).size
36
- expect(actual).to eq(count.to_i), "Expected #{count} emails but encountered #{actual} to be delivered with #{fields}"
37
- end
38
-
39
- Then(/^#{capture_email} should be delivered to (.+)$/) do |email_ref, to|
40
- expect(email(email_ref, "to: \"#{email_for(to)}\"")).not_to be_nil, "Failed to find #{email_ref} delivered to: #{to}"
41
- end
42
-
43
- Then(/^#{capture_email} should not be delivered to (.+)$/) do |email_ref, to|
44
- expect(email(email_ref, "to: \"#{email_for(to)}\"")).to be_nil, "Unexpectedly found #{email_ref} delivered to: #{to}"
45
- end
46
-
47
- Then(/^#{capture_email} should have #{capture_fields}$/) do |email_ref, fields|
48
- expect(email(email_ref, fields)).not_to be_nil, "Failed to find #{fields} in #{email_ref}"
49
- end
50
-
51
- Then(/^#{capture_email} should contain "(.*)"$/) do |email_ref, text|
52
- expect(email(email_ref).body).to match(/#{text}/), "Failed to find \"#{text}\" in #{email_ref}"
53
- end
54
-
55
- Then(/^#{capture_email} should not contain "(.*)"$/) do |email_ref, text|
56
- expect(email(email_ref).body).not_to match(/#{text}/), "Unexpectedly found \"#{text}\" in #{email_ref}"
57
- end
58
-
59
- Then(/^#{capture_email} should link to (.+)$/) do |email_ref, page|
60
- expect(email(email_ref).body).to match(/#{path_to(page)}/), "Failed to find link to #{page} in #{email_ref}"
61
- end
62
-
63
- Then(/^show me the emails?$/) do
64
- save_and_open_emails
65
- end
@@ -1,105 +0,0 @@
1
- # this file generated by script/generate pickle
2
-
3
- # create a model
4
- Given(/^#{capture_model} exists?(?: with #{capture_fields})?$/) do |name, fields|
5
- create_model(name, fields)
6
- end
7
-
8
- # create n models
9
- Given(/^(\d+) #{capture_plural_factory} exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
10
- create_models(count, plural_factory.singularize, fields)
11
- end
12
-
13
- # create models from a table
14
- Given(/^the following #{capture_plural_factory} exists?:?$/) do |plural_factory, table|
15
- create_models_from_table(plural_factory, table)
16
- end
17
-
18
- # find a model
19
- Then(/^#{capture_model} should exist(?: with #{capture_fields})?$/) do |name, fields|
20
- find_model!(name, fields)
21
- end
22
-
23
- # not find a model
24
- Then(/^#{capture_model} should not exist(?: with #{capture_fields})?$/) do |name, fields|
25
- expect(find_model(name, fields)).to be_nil
26
- end
27
-
28
- # find models with a table
29
- Then(/^the following #{capture_plural_factory} should exist:?$/) do |plural_factory, table|
30
- expect(find_models_from_table(plural_factory, table)).not_to be_any(&:nil?)
31
- end
32
-
33
- # not find models with a table
34
- Then(/^the following #{capture_plural_factory} should not exists?:?$/) do |plural_factory, table|
35
- find_models_from_table(plural_factory, table).should be_all(&:nil?)
36
- end
37
-
38
- # find exactly n models
39
- Then(/^(\d+) #{capture_plural_factory} should exist(?: with #{capture_fields})?$/) do |count, plural_factory, fields|
40
- expect(find_models(plural_factory.singularize, fields).size).to eq(count.to_i)
41
- end
42
-
43
- # assert equality of models
44
- Then(/^#{capture_model} should be #{capture_model}$/) do |a, b|
45
- expect(model!(a)).to eq(model!(b))
46
- end
47
-
48
- # assert model is in another model's has_many assoc
49
- Then(/^#{capture_model} should be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
50
- expect(model!(owner).send(association)).to include(model!(target))
51
- end
52
-
53
- # assert model is not in another model's has_many assoc
54
- Then(/^#{capture_model} should not be (?:in|one of|amongst) #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
55
- expect(model!(owner).send(association)).not_to include(model!(target))
56
- end
57
-
58
- # assert model is another model's has_one/belongs_to assoc
59
- Then(/^#{capture_model} should be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
60
- expect(model!(owner).send(association)).to eq(model!(target))
61
- end
62
-
63
- # assert model is not another model's has_one/belongs_to assoc
64
- Then(/^#{capture_model} should not be #{capture_model}(?:'s)? (\w+)$/) do |target, owner, association|
65
- expect(model!(owner).send(association)).not_to eq(model!(target))
66
- end
67
-
68
- # assert model.predicate?
69
- Then(/^#{capture_model} should (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
70
- if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
71
- expect(model!(name)).to send("have_#{predicate.gsub(' ', '_')}")
72
- else
73
- expect(model!(name)).to send("be_#{predicate.gsub(' ', '_')}")
74
- end
75
- end
76
-
77
- # assert not model.predicate?
78
- Then(/^#{capture_model} should not (?:be|have) (?:an? )?#{capture_predicate}$/) do |name, predicate|
79
- if model!(name).respond_to?("has_#{predicate.gsub(' ', '_')}")
80
- expect(model!(name)).not_to send("have_#{predicate.gsub(' ', '_')}")
81
- else
82
- expect(model!(name)).not_to send("be_#{predicate.gsub(' ', '_')}")
83
- end
84
- end
85
-
86
- # expect(model.attribute).to eq(value)
87
- # expect(model.attribute).not_to eq(value)
88
- Then(/^#{capture_model}'s (\w+) (should(?: not)?) be #{capture_value}$/) do |name, attribute, expectation, expected|
89
- actual_value = model(name).send(attribute)
90
- expectation = expectation.gsub("should", "to").gsub(" ", "_")
91
-
92
- case expected
93
- when 'nil', 'true', 'false'
94
- expect(actual_value).send(expectation, eq(eval(expected)))
95
- when /^[+-]?[0-9_]+(\.\d+)?$/
96
- expect(actual_value).send(expectation, eq(expected.to_f))
97
- else
98
- expect(actual_value.to_s).send(expectation, eq(eval(expected)))
99
- end
100
- end
101
-
102
- # assert size of association
103
- Then /^#{capture_model} should have (\d+) (\w+)$/ do |name, size, association|
104
- expect(model!(name).send(association).size).to eq(size.to_i)
105
- end
@@ -1,21 +0,0 @@
1
- module EmailHelpers
2
- # Maps a name to an email address. Used by email_steps
3
-
4
- def email_for(to)
5
- case to
6
-
7
- # add your own name => email address mappings here
8
-
9
- when /^#{capture_model}$/
10
- model($1).email
11
-
12
- when /^"(.*)"$/
13
- $1
14
-
15
- else
16
- to
17
- end
18
- end
19
- end
20
-
21
- World(EmailHelpers)
data/init.rb DELETED
File without changes