howitzer 1.1.1 → 2.0.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +32 -0
- data/.travis.yml +1 -4
- data/.yardopts +1 -2
- data/CHANGELOG.md +28 -1
- data/Gemfile +6 -0
- data/LICENSE +1 -1
- data/README.md +55 -85
- data/Rakefile +7 -7
- data/bin/howitzer +56 -31
- data/features/cli_new.feature +162 -79
- data/features/cli_update.feature +114 -21
- data/features/step_definitions/common_steps.rb +29 -9
- data/features/support/env.rb +1 -1
- data/features/support/transformers.rb +2 -2
- data/generators/base_generator.rb +121 -49
- data/generators/config/config_generator.rb +8 -5
- data/generators/config/templates/boot.rb +14 -0
- data/generators/config/templates/capybara.rb +156 -0
- data/generators/config/templates/custom.yml +2 -3
- data/generators/config/templates/default.yml +50 -82
- data/generators/cucumber/cucumber_generator.rb +9 -9
- data/generators/cucumber/templates/common_steps.rb +4 -4
- data/generators/cucumber/templates/cucumber.rake +63 -54
- data/generators/cucumber/templates/env.rb +24 -23
- data/generators/cucumber/templates/transformers.rb +23 -15
- data/generators/emails/emails_generator.rb +4 -2
- data/generators/emails/templates/example_email.rb +4 -4
- data/generators/prerequisites/prerequisites_generator.rb +24 -0
- data/generators/prerequisites/templates/base.rb +22 -0
- data/generators/prerequisites/templates/factory_girl.rb +30 -0
- data/generators/prerequisites/templates/user.rb +7 -0
- data/generators/prerequisites/templates/users.rb +12 -0
- data/generators/root/root_generator.rb +11 -7
- data/generators/root/templates/.rubocop.yml +32 -0
- data/generators/root/templates/Gemfile.erb +27 -0
- data/generators/root/templates/Rakefile +6 -8
- data/generators/rspec/rspec_generator.rb +7 -7
- data/generators/rspec/templates/example_spec.rb +1 -1
- data/generators/rspec/templates/rspec.rake +48 -29
- data/generators/rspec/templates/spec_helper.rb +33 -32
- data/generators/tasks/tasks_generator.rb +4 -2
- data/generators/tasks/templates/common.rake +1 -16
- data/generators/turnip/templates/.rspec +1 -0
- data/generators/turnip/templates/common_steps.rb +25 -0
- data/generators/turnip/templates/example.feature +8 -0
- data/generators/turnip/templates/spec_helper.rb +56 -0
- data/generators/turnip/templates/turnip.rake +61 -0
- data/generators/turnip/templates/turnip_helper.rb +6 -0
- data/generators/turnip/turnip_generator.rb +26 -0
- data/generators/web/templates/example_page.rb +15 -0
- data/generators/web/templates/menu_section.rb +13 -0
- data/generators/web/web_generator.rb +22 -0
- data/howitzer.gemspec +14 -21
- data/lib/howitzer.rb +47 -7
- data/lib/howitzer/cache.rb +70 -0
- data/lib/howitzer/capybara_helpers.rb +194 -0
- data/lib/howitzer/email.rb +96 -104
- data/lib/howitzer/exceptions.rb +10 -6
- data/lib/howitzer/log.rb +120 -0
- data/lib/howitzer/mail_adapters.rb +7 -0
- data/lib/howitzer/mail_adapters/abstract.rb +84 -0
- data/lib/howitzer/mail_adapters/mailgun.rb +115 -0
- data/lib/howitzer/mailgun_api.rb +9 -0
- data/lib/howitzer/mailgun_api/client.rb +79 -0
- data/lib/howitzer/mailgun_api/connector.rb +37 -0
- data/lib/howitzer/mailgun_api/response.rb +28 -0
- data/lib/howitzer/tasks/framework.rake +2 -2
- data/lib/howitzer/utils.rb +7 -1
- data/lib/howitzer/utils/string_extensions.rb +66 -0
- data/lib/howitzer/version.rb +2 -1
- data/lib/howitzer/web.rb +11 -0
- data/lib/howitzer/web/base_section.rb +27 -0
- data/lib/howitzer/web/blank_page.rb +12 -0
- data/lib/howitzer/web/capybara_methods_proxy.rb +29 -0
- data/lib/howitzer/web/element_dsl.rb +109 -0
- data/lib/howitzer/web/iframe_dsl.rb +93 -0
- data/lib/howitzer/web/page.rb +173 -0
- data/lib/howitzer/web/page_dsl.rb +64 -0
- data/lib/howitzer/web/page_validator.rb +118 -0
- data/lib/howitzer/web/section.rb +27 -0
- data/lib/howitzer/web/section_dsl.rb +154 -0
- data/spec/config/custom.yml +10 -1
- data/spec/spec_helper.rb +37 -19
- data/spec/support/generator_helper.rb +12 -11
- data/spec/support/logger_helper.rb +10 -9
- data/spec/support/mailgun_unit_client.rb +52 -44
- data/spec/support/shared_examples/capybara_context_holder.rb +33 -0
- data/spec/support/shared_examples/capybara_methods_proxy.rb +94 -0
- data/spec/support/shared_examples/dynamic_section_methods.rb +35 -0
- data/spec/support/shared_examples/element_dsl.rb +119 -0
- data/spec/unit/generators/base_generator_spec.rb +64 -33
- data/spec/unit/generators/config_generator_spec.rb +11 -7
- data/spec/unit/generators/cucumber_generator_spec.rb +26 -17
- data/spec/unit/generators/emails_generator_spec.rb +10 -6
- data/spec/unit/generators/prerequisites_generator_spec.rb +53 -0
- data/spec/unit/generators/root_generator_spec.rb +50 -13
- data/spec/unit/generators/rspec_generator_spec.rb +9 -9
- data/spec/unit/generators/tasks_generator_spec.rb +6 -6
- data/spec/unit/generators/turnip_generator_spec.rb +52 -0
- data/spec/unit/generators/web_generator_spec.rb +52 -0
- data/spec/unit/lib/cache_spec.rb +85 -0
- data/spec/unit/lib/capybara_helpers_spec.rb +696 -0
- data/spec/unit/lib/email_spec.rb +104 -91
- data/spec/unit/lib/howitzer.rb +31 -0
- data/spec/unit/lib/init_spec.rb +0 -1
- data/spec/unit/lib/log_spec.rb +122 -0
- data/spec/unit/lib/mail_adapters/abstract_spec.rb +62 -0
- data/spec/unit/lib/mail_adapters/mailgun_spec.rb +163 -0
- data/spec/unit/lib/mailgun_api/client_spec.rb +58 -0
- data/spec/unit/lib/mailgun_api/connector_spec.rb +54 -0
- data/spec/unit/lib/mailgun_api/response_spec.rb +28 -0
- data/spec/unit/lib/utils/string_extensions_spec.rb +77 -0
- data/spec/unit/lib/web/base_section_spec.rb +41 -0
- data/spec/unit/lib/web/element_dsl_spec.rb +17 -0
- data/spec/unit/lib/web/iframe_dsl_spec.rb +99 -0
- data/spec/unit/lib/web/page_dsl_spec.rb +52 -0
- data/spec/unit/lib/web/page_spec.rb +304 -0
- data/spec/unit/lib/web/page_validator_spec.rb +218 -0
- data/spec/unit/lib/web/section_dsl_spec.rb +165 -0
- data/spec/unit/lib/web/section_spec.rb +61 -0
- data/spec/unit/version_spec.rb +1 -1
- metadata +116 -203
- data/GETTING_STARTED.md +0 -774
- data/generators/cucumber/templates/cucumber.yml +0 -10
- data/generators/pages/pages_generator.rb +0 -21
- data/generators/pages/templates/example_menu.rb +0 -15
- data/generators/pages/templates/example_page.rb +0 -15
- data/generators/root/templates/Gemfile +0 -7
- data/generators/root/templates/boot.rb +0 -10
- data/lib/howitzer/blank_page.rb +0 -6
- data/lib/howitzer/capybara/dsl_ex.rb +0 -15
- data/lib/howitzer/capybara/settings.rb +0 -343
- data/lib/howitzer/helpers.rb +0 -230
- data/lib/howitzer/init.rb +0 -1
- data/lib/howitzer/mailgun/client.rb +0 -65
- data/lib/howitzer/mailgun/connector.rb +0 -34
- data/lib/howitzer/mailgun/response.rb +0 -28
- data/lib/howitzer/patches/rawler_patched.rb +0 -86
- data/lib/howitzer/settings.rb +0 -27
- data/lib/howitzer/utils/data_generator/data_storage.rb +0 -88
- data/lib/howitzer/utils/data_generator/gen.rb +0 -135
- data/lib/howitzer/utils/locator_store.rb +0 -217
- data/lib/howitzer/utils/log.rb +0 -139
- data/lib/howitzer/utils/page_validator.rb +0 -133
- data/lib/howitzer/vendor/firebug-1.12.1-fx.xpi +0 -0
- data/lib/howitzer/vendor/firepath-0.9.7-fx.xpi +0 -0
- data/lib/howitzer/web_page.rb +0 -253
- data/spec/active_resource.rb +0 -0
- data/spec/config/default.yml +0 -26
- data/spec/support/boot_helper.rb +0 -15
- data/spec/unit/generators/pages_generator_spec.rb +0 -33
- data/spec/unit/lib/capybara/dsl_ex_spec.rb +0 -60
- data/spec/unit/lib/capybara/settings_spec.rb +0 -441
- data/spec/unit/lib/helpers_spec.rb +0 -1129
- data/spec/unit/lib/mailgun/client_spec.rb +0 -36
- data/spec/unit/lib/mailgun/connector_spec.rb +0 -70
- data/spec/unit/lib/mailgun/response_spec.rb +0 -28
- data/spec/unit/lib/settings_spec.rb +0 -17
- data/spec/unit/lib/utils/data_generator/data_storage_spec.rb +0 -80
- data/spec/unit/lib/utils/data_generator/gen_spec.rb +0 -90
- data/spec/unit/lib/utils/locator_store_spec.rb +0 -157
- data/spec/unit/lib/utils/log_spec.rb +0 -107
- data/spec/unit/lib/utils/page_validator_spec.rb +0 -265
- data/spec/unit/lib/web_page_spec.rb +0 -346
data/spec/unit/lib/email_spec.rb
CHANGED
|
@@ -1,142 +1,155 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
require 'howitzer/email'
|
|
3
|
-
require 'howitzer/
|
|
3
|
+
require 'howitzer/log'
|
|
4
4
|
require 'howitzer/exceptions'
|
|
5
5
|
|
|
6
|
-
RSpec.describe
|
|
7
|
-
let(:recipient){ 'first_tester@gmail.com' }
|
|
8
|
-
let(:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
'attachments' => []
|
|
18
|
-
}
|
|
6
|
+
RSpec.describe Howitzer::Email do
|
|
7
|
+
let(:recipient) { 'first_tester@gmail.com' }
|
|
8
|
+
let(:message_subject) { 'test subject' }
|
|
9
|
+
let(:message) { double(:message) }
|
|
10
|
+
let(:email_object) { described_class.new(message) }
|
|
11
|
+
|
|
12
|
+
describe '.adapter' do
|
|
13
|
+
it do
|
|
14
|
+
expect(described_class.adapter)
|
|
15
|
+
.to eql(Howitzer::MailAdapters.const_get(Howitzer.mail_adapter.to_s.capitalize))
|
|
16
|
+
end
|
|
19
17
|
end
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
before do
|
|
24
|
-
stub_const('Email::SUBJECT', message_subject)
|
|
18
|
+
|
|
19
|
+
describe '.adapter_name' do
|
|
20
|
+
it { expect(described_class.adapter_name).to eql Howitzer.mail_adapter.to_sym }
|
|
25
21
|
end
|
|
26
22
|
|
|
27
|
-
describe '
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
describe '.adapter=' do
|
|
24
|
+
subject { described_class.adapter = name }
|
|
25
|
+
|
|
26
|
+
context 'when adapter_name is Symbol or String' do
|
|
27
|
+
let(:name) { Howitzer.mail_adapter }
|
|
28
|
+
it { expect(described_class.adapter).to eql Howitzer::MailAdapters.const_get(name.to_s.capitalize) }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
context 'when adapter_name is not Symbol or String' do
|
|
32
|
+
let(:name) { nil }
|
|
33
|
+
it { expect { subject }.to raise_error(Howitzer::NoMailAdapterError) }
|
|
30
34
|
end
|
|
31
35
|
end
|
|
32
36
|
|
|
33
|
-
describe '.
|
|
34
|
-
let(:recipient) { 'test@user.com' }
|
|
35
|
-
subject { Email.find_by_recipient(recipient) }
|
|
37
|
+
describe '.subject' do
|
|
36
38
|
it do
|
|
37
|
-
|
|
38
|
-
subject
|
|
39
|
+
described_class.send(:subject, message_subject)
|
|
40
|
+
expect(described_class.instance_variable_get(:@subject)).to eql message_subject
|
|
41
|
+
end
|
|
42
|
+
it 'should be protected' do
|
|
43
|
+
expect { described_class.subject(message_subject) }.to raise_error(NoMethodError)
|
|
39
44
|
end
|
|
40
45
|
end
|
|
41
46
|
|
|
42
|
-
describe '.
|
|
43
|
-
let(:
|
|
44
|
-
|
|
45
|
-
subject
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let(:event) do
|
|
49
|
-
{
|
|
50
|
-
'message' => {
|
|
51
|
-
'recipients' => [recipient],
|
|
52
|
-
'headers' => {
|
|
53
|
-
'subject' => message_subject
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
'storage' => {
|
|
57
|
-
'url' => url
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
end
|
|
61
|
-
before do
|
|
62
|
-
allow(Mailgun::Connector.instance.client).to receive(:get).with('mailgun@test.domain/events', event: 'stored').ordered.once {events}
|
|
63
|
-
allow(Mailgun::Connector.instance.client).to receive(:get_url).with(url).ordered.once { mailgun_message }
|
|
64
|
-
end
|
|
47
|
+
describe '.find_by_recipient' do
|
|
48
|
+
let(:recipient) { 'test@user.com' }
|
|
49
|
+
|
|
50
|
+
context 'simple subject without parameters' do
|
|
51
|
+
subject { described_class.find_by_recipient(recipient) }
|
|
52
|
+
before { described_class.class_eval { subject 'Some title' } }
|
|
65
53
|
it do
|
|
66
|
-
expect(
|
|
54
|
+
expect(described_class.adapter).to receive(:find).with(recipient, 'Some title').once
|
|
67
55
|
subject
|
|
68
56
|
end
|
|
69
57
|
end
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
58
|
+
|
|
59
|
+
context 'complex subject with 1 parameter' do
|
|
60
|
+
subject { described_class.find_by_recipient(recipient, name: 'Vasya') }
|
|
61
|
+
before { described_class.class_eval { subject 'Some title from :name' } }
|
|
62
|
+
it do
|
|
63
|
+
expect(described_class.adapter).to receive(:find).with(recipient, 'Some title from Vasya').once
|
|
64
|
+
subject
|
|
76
65
|
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
context 'complex subject with 2 parameters' do
|
|
69
|
+
subject { described_class.find_by_recipient(recipient, foo: 1, bar: 2) }
|
|
70
|
+
before { described_class.class_eval { subject 'Some title with :foo and :bar' } }
|
|
77
71
|
it do
|
|
78
|
-
expect(
|
|
72
|
+
expect(described_class.adapter).to receive(:find).with(recipient, 'Some title with 1 and 2').once
|
|
79
73
|
subject
|
|
80
74
|
end
|
|
81
75
|
end
|
|
76
|
+
|
|
77
|
+
context 'missing subject' do
|
|
78
|
+
subject { described_class.find_by_recipient(recipient) }
|
|
79
|
+
before { described_class.class_eval { subject nil } }
|
|
80
|
+
it do
|
|
81
|
+
expect { subject }.to raise_error(Howitzer::NoEmailSubjectError)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
describe '#new' do
|
|
87
|
+
context 'when Email instance receive message and add create @message variable that' do
|
|
88
|
+
it { expect(email_object.instance_variable_get(:@message)).to eql message }
|
|
89
|
+
end
|
|
82
90
|
end
|
|
83
91
|
|
|
84
92
|
describe '#plain_text_body' do
|
|
85
|
-
|
|
93
|
+
subject { email_object.plain_text_body }
|
|
94
|
+
it do
|
|
95
|
+
expect(message).to receive(:plain_text_body).once
|
|
96
|
+
subject
|
|
97
|
+
end
|
|
86
98
|
end
|
|
87
99
|
|
|
88
100
|
describe '#html_body' do
|
|
89
|
-
|
|
101
|
+
subject { email_object.html_body }
|
|
102
|
+
it do
|
|
103
|
+
expect(message).to receive(:html_body).once
|
|
104
|
+
subject
|
|
105
|
+
end
|
|
90
106
|
end
|
|
91
107
|
|
|
92
108
|
describe '#text' do
|
|
93
|
-
|
|
109
|
+
subject { email_object.text }
|
|
110
|
+
it do
|
|
111
|
+
expect(message).to receive(:text).once
|
|
112
|
+
subject
|
|
113
|
+
end
|
|
94
114
|
end
|
|
95
115
|
|
|
96
116
|
describe '#mail_from' do
|
|
97
|
-
|
|
117
|
+
subject { email_object.mail_from }
|
|
118
|
+
it do
|
|
119
|
+
expect(message).to receive(:mail_from).once
|
|
120
|
+
subject
|
|
121
|
+
end
|
|
98
122
|
end
|
|
99
123
|
|
|
100
124
|
describe '#recipients' do
|
|
101
125
|
subject { email_object.recipients }
|
|
102
|
-
it
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
it { is_expected.to include message['To']}
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
context 'when more than one recipient' do
|
|
109
|
-
let(:second_recipient) { 'second_tester@gmail.com' }
|
|
110
|
-
let(:message_with_multiple_recipients) { message.merge({'To' => "#{recipient}, #{second_recipient}"}) }
|
|
111
|
-
let(:email_object) { Email.new(message_with_multiple_recipients) }
|
|
112
|
-
it { is_expected.to eql [recipient, second_recipient] }
|
|
126
|
+
it do
|
|
127
|
+
expect(message).to receive(:recipients).once
|
|
128
|
+
subject
|
|
113
129
|
end
|
|
114
130
|
end
|
|
115
131
|
|
|
116
132
|
describe '#received_time' do
|
|
117
|
-
|
|
133
|
+
subject { email_object.received_time }
|
|
134
|
+
it do
|
|
135
|
+
expect(message).to receive(:received_time).once
|
|
136
|
+
subject
|
|
137
|
+
end
|
|
118
138
|
end
|
|
119
139
|
|
|
120
140
|
describe '#sender_email' do
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
subject { email_object.get_mime_part }
|
|
126
|
-
|
|
127
|
-
context 'when has attachments' do
|
|
128
|
-
let(:files) { [double] }
|
|
129
|
-
before { email_object.instance_variable_set(:@message, 'attachments' => files)}
|
|
130
|
-
it { is_expected.to eq(files) }
|
|
141
|
+
subject { email_object.sender_email }
|
|
142
|
+
it do
|
|
143
|
+
expect(message).to receive(:sender_email).once
|
|
144
|
+
subject
|
|
131
145
|
end
|
|
146
|
+
end
|
|
132
147
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
subject
|
|
139
|
-
end
|
|
148
|
+
describe '#mime_part' do
|
|
149
|
+
subject { email_object.mime_part }
|
|
150
|
+
it do
|
|
151
|
+
expect(message).to receive(:mime_part).once
|
|
152
|
+
subject
|
|
140
153
|
end
|
|
141
154
|
end
|
|
142
155
|
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'howitzer'
|
|
3
|
+
|
|
4
|
+
RSpec.describe 'Howitzer' do
|
|
5
|
+
describe 'SexySettings configuration' do
|
|
6
|
+
subject { SexySettings.configuration }
|
|
7
|
+
it { expect(subject.path_to_custom_settings).to include('config/custom.yml') }
|
|
8
|
+
it { expect(subject.path_to_default_settings).to include('config/default.yml') }
|
|
9
|
+
end
|
|
10
|
+
describe '.app_uri' do
|
|
11
|
+
before do
|
|
12
|
+
allow(Howitzer).to receive(:app_base_auth_login) { app_base_auth_login_setting }
|
|
13
|
+
allow(Howitzer).to receive(:app_base_auth_pass) { app_base_auth_pass_setting }
|
|
14
|
+
allow(Howitzer).to receive(:app_protocol) { app_protocol_setting }
|
|
15
|
+
allow(Howitzer).to receive(:app_host) { app_host_setting }
|
|
16
|
+
end
|
|
17
|
+
let(:app_protocol_setting) { nil }
|
|
18
|
+
let(:app_host_setting) { 'redmine.strongqa.com' }
|
|
19
|
+
context 'when login and password present' do
|
|
20
|
+
let(:app_base_auth_login_setting) { 'alex' }
|
|
21
|
+
let(:app_base_auth_pass_setting) { 'pa$$w0rd' }
|
|
22
|
+
it { expect(Howitzer.app_uri.site).to eq('http://alex:pa$$w0rd@redmine.strongqa.com') }
|
|
23
|
+
it { expect(Howitzer.app_uri.origin).to eq('http://redmine.strongqa.com') }
|
|
24
|
+
end
|
|
25
|
+
context 'when login and password blank' do
|
|
26
|
+
let(:app_base_auth_login_setting) { nil }
|
|
27
|
+
let(:app_base_auth_pass_setting) { nil }
|
|
28
|
+
it { expect(Howitzer.app_uri.site).to eq('http://redmine.strongqa.com') }
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
data/spec/unit/lib/init_spec.rb
CHANGED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'howitzer/log'
|
|
3
|
+
include Howitzer::LoggerHelper
|
|
4
|
+
|
|
5
|
+
RSpec.describe Howitzer::Log do
|
|
6
|
+
context '.instance' do
|
|
7
|
+
subject { described_class.instance }
|
|
8
|
+
let(:other_log) { described_class.instance }
|
|
9
|
+
it { is_expected.to be_a_kind_of(described_class) }
|
|
10
|
+
it { is_expected.to equal(other_log) }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context '.debug' do
|
|
14
|
+
it do
|
|
15
|
+
expect(described_class.instance).to receive(:debug).with('Foo')
|
|
16
|
+
described_class.debug('Foo')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
context '.info' do
|
|
21
|
+
it do
|
|
22
|
+
expect(described_class.instance).to receive(:info).with('Foo')
|
|
23
|
+
described_class.info('Foo')
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context '.warn' do
|
|
28
|
+
it do
|
|
29
|
+
expect(described_class.instance).to receive(:warn).with('Foo')
|
|
30
|
+
described_class.warn('Foo')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context '.fatal' do
|
|
35
|
+
it do
|
|
36
|
+
expect(described_class.instance).to receive(:fatal).with('Foo')
|
|
37
|
+
described_class.fatal('Foo')
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
context '.error' do
|
|
42
|
+
it do
|
|
43
|
+
expect(described_class.instance).to receive(:error).with('Foo')
|
|
44
|
+
described_class.error('Foo')
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
context '.print_feature_name' do
|
|
49
|
+
it do
|
|
50
|
+
expect(described_class.instance).to receive(:print_feature_name).with('Foo')
|
|
51
|
+
described_class.print_feature_name('Foo')
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
context '.settings_as_formatted_text' do
|
|
56
|
+
it do
|
|
57
|
+
expect(described_class.instance).to receive(:settings_as_formatted_text).with(no_args)
|
|
58
|
+
described_class.settings_as_formatted_text
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
context '.print_scenario_name' do
|
|
63
|
+
it do
|
|
64
|
+
expect(described_class.instance).to receive(:print_scenario_name).with('Foo')
|
|
65
|
+
described_class.print_scenario_name('Foo')
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe '#debug' do
|
|
70
|
+
it do
|
|
71
|
+
expect(described_class.instance.instance_variable_get(:@logger)).to receive(:debug).with(:foo)
|
|
72
|
+
described_class.instance.debug :foo
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
describe '#info' do
|
|
76
|
+
it do
|
|
77
|
+
expect(described_class.instance.instance_variable_get(:@logger)).to receive(:info).with(:foo)
|
|
78
|
+
described_class.instance.info :foo
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
describe '#warn' do
|
|
82
|
+
it do
|
|
83
|
+
expect(described_class.instance.instance_variable_get(:@logger)).to receive(:warn).with(:foo)
|
|
84
|
+
described_class.instance.warn :foo
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
describe '#fatal' do
|
|
88
|
+
it do
|
|
89
|
+
expect(described_class.instance.instance_variable_get(:@logger)).to receive(:fatal).with(:foo)
|
|
90
|
+
described_class.instance.fatal :foo
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe '#error' do
|
|
95
|
+
it do
|
|
96
|
+
expect(described_class.instance.instance_variable_get(:@logger)).to receive(:error).with(:foo)
|
|
97
|
+
described_class.instance.error :foo
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
describe '#print_feature_name' do
|
|
102
|
+
it do
|
|
103
|
+
expect(described_class.instance).to receive(:log_without_formatting) { |&arg| arg.call }
|
|
104
|
+
expect(described_class.instance).to receive(:info).with('*** Feature: FOO ***')
|
|
105
|
+
described_class.instance.print_feature_name('Foo')
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
describe '#settings_as_formatted_text' do
|
|
109
|
+
it do
|
|
110
|
+
expect(described_class.instance).to receive(:log_without_formatting) { |&arg| arg.call }
|
|
111
|
+
expect(described_class.instance).to receive(:info).with(SexySettings::Base.instance.as_formatted_text)
|
|
112
|
+
described_class.instance.settings_as_formatted_text
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
describe '#print_scenario_name' do
|
|
116
|
+
it do
|
|
117
|
+
expect(described_class.instance).to receive(:log_without_formatting) { |&arg| arg.call }
|
|
118
|
+
expect(described_class.instance).to receive(:info).with(' => Scenario: Foo')
|
|
119
|
+
described_class.instance.print_scenario_name('Foo')
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'howitzer/email'
|
|
3
|
+
require 'howitzer/mail_adapters/abstract'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Howitzer::MailAdapters::Abstract do
|
|
6
|
+
let(:recipient) { 'first_tester@gmail.com' }
|
|
7
|
+
let(:message_subject) { 'test subject' }
|
|
8
|
+
let(:message) { double(:message) }
|
|
9
|
+
let(:abstract_adapter) { described_class.new(message) }
|
|
10
|
+
let(:email_object) { Howitzer::Email.adapter.new(message) }
|
|
11
|
+
|
|
12
|
+
describe '.find' do
|
|
13
|
+
subject { described_class.find(recipient, message_subject) }
|
|
14
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
describe '#new' do
|
|
18
|
+
context 'when Email instance receive message and add create @message variable that' do
|
|
19
|
+
it { expect(email_object.instance_variable_get(:@message)).to eql message }
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe '#plain_text_body' do
|
|
24
|
+
subject { abstract_adapter.plain_text_body }
|
|
25
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe '#html_body' do
|
|
29
|
+
subject { abstract_adapter.html_body }
|
|
30
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
describe '#text' do
|
|
34
|
+
subject { abstract_adapter.text }
|
|
35
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe '#mail_from' do
|
|
39
|
+
subject { abstract_adapter.mail_from }
|
|
40
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe '#recipients' do
|
|
44
|
+
subject { abstract_adapter.recipients }
|
|
45
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
describe '#received_time' do
|
|
49
|
+
subject { abstract_adapter.received_time }
|
|
50
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
describe '#sender_email' do
|
|
54
|
+
subject { abstract_adapter.sender_email }
|
|
55
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe '#mime_part' do
|
|
59
|
+
subject { abstract_adapter.mime_part }
|
|
60
|
+
it { expect { subject }.to raise_error(NotImplementedError) }
|
|
61
|
+
end
|
|
62
|
+
end
|