howitzer 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -2
- data/.travis.yml +3 -3
- data/CHANGELOG.md +27 -11
- data/Gemfile +1 -0
- data/ISSUE_TEMPLATE.md +16 -0
- data/README.md +2 -1
- data/Rakefile +18 -2
- data/bin/howitzer +7 -6
- data/features/cli_help.feature +1 -1
- data/features/cli_new.feature +51 -11
- data/features/cli_update.feature +44 -4
- data/features/cli_version.feature +1 -1
- data/features/step_definitions/common_steps.rb +5 -0
- data/generators/base_generator.rb +30 -16
- data/generators/config/config_generator.rb +13 -3
- data/generators/config/templates/boot.rb +1 -1
- data/generators/config/templates/capybara.rb +2 -128
- data/generators/config/templates/default.yml +20 -3
- data/generators/config/templates/drivers/browserstack.rb +19 -0
- data/generators/config/templates/drivers/crossbrowsertesting.rb +25 -0
- data/generators/config/templates/drivers/headless_chrome.rb +16 -0
- data/generators/config/templates/drivers/phantomjs.rb +20 -0
- data/generators/config/templates/drivers/poltergeist.rb +11 -0
- data/generators/config/templates/drivers/sauce.rb +21 -0
- data/generators/config/templates/drivers/selenium.rb +24 -0
- data/generators/config/templates/drivers/selenium_grid.rb +27 -0
- data/generators/config/templates/drivers/testingbot.rb +20 -0
- data/generators/config/templates/drivers/webkit.rb +6 -0
- data/generators/cucumber/cucumber_generator.rb +2 -2
- data/generators/cucumber/templates/cucumber.rake +0 -8
- data/generators/cucumber/templates/env.rb +1 -1
- data/generators/cucumber/templates/transformers.rb +11 -25
- data/generators/emails/emails_generator.rb +2 -2
- data/generators/emails/templates/example_email.rb +1 -1
- data/generators/prerequisites/prerequisites_generator.rb +3 -3
- data/generators/prerequisites/templates/base.rb +1 -1
- data/generators/prerequisites/templates/{factory_girl.rb → factory_bot.rb} +6 -6
- data/generators/prerequisites/templates/users.rb +1 -1
- data/generators/root/root_generator.rb +2 -2
- data/generators/root/templates/.rubocop.yml +2 -2
- data/generators/root/templates/Gemfile.erb +14 -18
- data/generators/rspec/rspec_generator.rb +2 -2
- data/generators/rspec/templates/spec_helper.rb +1 -1
- data/generators/tasks/tasks_generator.rb +2 -2
- data/generators/turnip/templates/spec_helper.rb +1 -1
- data/generators/turnip/turnip_generator.rb +2 -2
- data/generators/web/web_generator.rb +2 -2
- data/howitzer.gemspec +3 -1
- data/lib/howitzer/capybara_helpers.rb +25 -8
- data/lib/howitzer/gmail_api.rb +7 -0
- data/lib/howitzer/gmail_api/client.rb +22 -0
- data/lib/howitzer/mail_adapters/gmail.rb +93 -0
- data/lib/howitzer/mail_adapters/mailgun.rb +2 -2
- data/lib/howitzer/mail_adapters/mailtrap.rb +105 -0
- data/lib/howitzer/mailtrap_api.rb +7 -0
- data/lib/howitzer/mailtrap_api/client.rb +52 -0
- data/lib/howitzer/version.rb +1 -1
- data/lib/howitzer/web/page.rb +13 -1
- data/lib/howitzer/web/page_dsl.rb +1 -1
- data/spec/config/custom.yml +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/generators/base_generator_spec.rb +23 -12
- data/spec/unit/generators/config_generator_spec.rb +27 -6
- data/spec/unit/generators/cucumber_generator_spec.rb +8 -8
- data/spec/unit/generators/emails_generator_spec.rb +2 -2
- data/spec/unit/generators/prerequisites_generator_spec.rb +7 -7
- data/spec/unit/generators/root_generator_spec.rb +25 -22
- data/spec/unit/generators/rspec_generator_spec.rb +4 -4
- data/spec/unit/generators/tasks_generator_spec.rb +2 -2
- data/spec/unit/generators/turnip_generator_spec.rb +7 -7
- data/spec/unit/generators/web_generator_spec.rb +3 -3
- data/spec/unit/lib/capybara_helpers_spec.rb +2 -1
- data/spec/unit/lib/gmail_api/client_spec.rb +26 -0
- data/spec/unit/lib/mail_adapters/gmail_spec.rb +128 -0
- data/spec/unit/lib/mail_adapters/mailgun_spec.rb +13 -18
- data/spec/unit/lib/mail_adapters/mailtrap_spec.rb +130 -0
- data/spec/unit/lib/mailgun_api/client_spec.rb +31 -9
- data/spec/unit/lib/mailtrap_api/client_spec.rb +67 -0
- data/spec/unit/lib/web/page_spec.rb +30 -1
- metadata +63 -8
- data/features/support/transformers.rb +0 -3
- data/spec/support/mailgun_unit_client.rb +0 -68
@@ -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
|