howitzer 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -2
  3. data/.travis.yml +3 -3
  4. data/CHANGELOG.md +27 -11
  5. data/Gemfile +1 -0
  6. data/ISSUE_TEMPLATE.md +16 -0
  7. data/README.md +2 -1
  8. data/Rakefile +18 -2
  9. data/bin/howitzer +7 -6
  10. data/features/cli_help.feature +1 -1
  11. data/features/cli_new.feature +51 -11
  12. data/features/cli_update.feature +44 -4
  13. data/features/cli_version.feature +1 -1
  14. data/features/step_definitions/common_steps.rb +5 -0
  15. data/generators/base_generator.rb +30 -16
  16. data/generators/config/config_generator.rb +13 -3
  17. data/generators/config/templates/boot.rb +1 -1
  18. data/generators/config/templates/capybara.rb +2 -128
  19. data/generators/config/templates/default.yml +20 -3
  20. data/generators/config/templates/drivers/browserstack.rb +19 -0
  21. data/generators/config/templates/drivers/crossbrowsertesting.rb +25 -0
  22. data/generators/config/templates/drivers/headless_chrome.rb +16 -0
  23. data/generators/config/templates/drivers/phantomjs.rb +20 -0
  24. data/generators/config/templates/drivers/poltergeist.rb +11 -0
  25. data/generators/config/templates/drivers/sauce.rb +21 -0
  26. data/generators/config/templates/drivers/selenium.rb +24 -0
  27. data/generators/config/templates/drivers/selenium_grid.rb +27 -0
  28. data/generators/config/templates/drivers/testingbot.rb +20 -0
  29. data/generators/config/templates/drivers/webkit.rb +6 -0
  30. data/generators/cucumber/cucumber_generator.rb +2 -2
  31. data/generators/cucumber/templates/cucumber.rake +0 -8
  32. data/generators/cucumber/templates/env.rb +1 -1
  33. data/generators/cucumber/templates/transformers.rb +11 -25
  34. data/generators/emails/emails_generator.rb +2 -2
  35. data/generators/emails/templates/example_email.rb +1 -1
  36. data/generators/prerequisites/prerequisites_generator.rb +3 -3
  37. data/generators/prerequisites/templates/base.rb +1 -1
  38. data/generators/prerequisites/templates/{factory_girl.rb → factory_bot.rb} +6 -6
  39. data/generators/prerequisites/templates/users.rb +1 -1
  40. data/generators/root/root_generator.rb +2 -2
  41. data/generators/root/templates/.rubocop.yml +2 -2
  42. data/generators/root/templates/Gemfile.erb +14 -18
  43. data/generators/rspec/rspec_generator.rb +2 -2
  44. data/generators/rspec/templates/spec_helper.rb +1 -1
  45. data/generators/tasks/tasks_generator.rb +2 -2
  46. data/generators/turnip/templates/spec_helper.rb +1 -1
  47. data/generators/turnip/turnip_generator.rb +2 -2
  48. data/generators/web/web_generator.rb +2 -2
  49. data/howitzer.gemspec +3 -1
  50. data/lib/howitzer/capybara_helpers.rb +25 -8
  51. data/lib/howitzer/gmail_api.rb +7 -0
  52. data/lib/howitzer/gmail_api/client.rb +22 -0
  53. data/lib/howitzer/mail_adapters/gmail.rb +93 -0
  54. data/lib/howitzer/mail_adapters/mailgun.rb +2 -2
  55. data/lib/howitzer/mail_adapters/mailtrap.rb +105 -0
  56. data/lib/howitzer/mailtrap_api.rb +7 -0
  57. data/lib/howitzer/mailtrap_api/client.rb +52 -0
  58. data/lib/howitzer/version.rb +1 -1
  59. data/lib/howitzer/web/page.rb +13 -1
  60. data/lib/howitzer/web/page_dsl.rb +1 -1
  61. data/spec/config/custom.yml +1 -1
  62. data/spec/spec_helper.rb +1 -0
  63. data/spec/unit/generators/base_generator_spec.rb +23 -12
  64. data/spec/unit/generators/config_generator_spec.rb +27 -6
  65. data/spec/unit/generators/cucumber_generator_spec.rb +8 -8
  66. data/spec/unit/generators/emails_generator_spec.rb +2 -2
  67. data/spec/unit/generators/prerequisites_generator_spec.rb +7 -7
  68. data/spec/unit/generators/root_generator_spec.rb +25 -22
  69. data/spec/unit/generators/rspec_generator_spec.rb +4 -4
  70. data/spec/unit/generators/tasks_generator_spec.rb +2 -2
  71. data/spec/unit/generators/turnip_generator_spec.rb +7 -7
  72. data/spec/unit/generators/web_generator_spec.rb +3 -3
  73. data/spec/unit/lib/capybara_helpers_spec.rb +2 -1
  74. data/spec/unit/lib/gmail_api/client_spec.rb +26 -0
  75. data/spec/unit/lib/mail_adapters/gmail_spec.rb +128 -0
  76. data/spec/unit/lib/mail_adapters/mailgun_spec.rb +13 -18
  77. data/spec/unit/lib/mail_adapters/mailtrap_spec.rb +130 -0
  78. data/spec/unit/lib/mailgun_api/client_spec.rb +31 -9
  79. data/spec/unit/lib/mailtrap_api/client_spec.rb +67 -0
  80. data/spec/unit/lib/web/page_spec.rb +30 -1
  81. metadata +63 -8
  82. data/features/support/transformers.rb +0 -3
  83. data/spec/support/mailgun_unit_client.rb +0 -68
@@ -1,3 +0,0 @@
1
- Transform /<HOWITZER_VERSION>/ do |text|
2
- text.gsub('<HOWITZER_VERSION>', Howitzer::VERSION)
3
- end
@@ -1,68 +0,0 @@
1
- require 'time'
2
- require 'json'
3
- require 'howitzer/exceptions'
4
-
5
- module Howitzer
6
- module MailgunApi
7
- class UnitClient
8
- attr_reader :url, :options, :block, :body, :code
9
-
10
- def initialize(url, options = {}, _backwards_compatibility = nil, &block)
11
- @url = url
12
- @block = block
13
- @options = options
14
- @body = nil
15
- @code = nil
16
- end
17
-
18
- def [](resource_path, &new_block)
19
- if block_given? then self.class.new(resource_path, options, &new_block)
20
- elsif block then self.class.new(resource_path, options, &block)
21
- else
22
- self.class.new(resource_path, options)
23
- end
24
- end
25
-
26
- def get(_options, _query_string = nil)
27
- Response.new(response_generator('bounces'))
28
- rescue StandardError => e
29
- raise Howitzer::CommunicationError.new(e), e.response
30
- end
31
-
32
- private
33
-
34
- def response_generator(resource_endpoint)
35
- case resource_endpoint
36
- when 'messages'
37
- t = Time.now
38
- id = "<#{t.to_i}.#{rand(99_999_999)}.5817@example.com>"
39
- @body = JSON.generate('message' => 'Queued. Thank you.', 'id' => id)
40
- when 'bounces'
41
- @body = JSON.generate(
42
- 'total_count' => 1,
43
- 'items' => {
44
- 'created_at' => 'Fri, 21 Oct 2011 11:02:55 GMT',
45
- 'code' => 550,
46
- 'address' => 'baz@example.com',
47
- 'error' => 'Message was not accepted -- invalid mailbox. Local mailbox baz@example.com is" +
48
- " unavailable: user not found'
49
- }
50
- )
51
- when 'lists'
52
- @body = JSON.generate(
53
- 'member' => {
54
- 'vars' => { 'age' => 26 },
55
- 'name' => 'Foo Bar',
56
- 'subscribed' => false,
57
- 'address' => 'bar@example.com'
58
- },
59
- 'message' => 'Mailing list member has been updated'
60
- )
61
- when 'campaigns'
62
- @body = JSON.generate('message' => 'Campaign has been deleted', 'id' => 'ABC123')
63
- end
64
- self
65
- end
66
- end
67
- end
68
- end