howitzer 1.0.2 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +3 -1
  4. data/.ruby-gemset +1 -0
  5. data/.travis.yml +4 -1
  6. data/.yardopts +5 -0
  7. data/CHANGELOG.md +23 -1
  8. data/CONTRIBUTING.md +14 -0
  9. data/GETTING_STARTED.md +283 -183
  10. data/Gemfile +3 -2
  11. data/LICENSE +1 -1
  12. data/README.md +93 -39
  13. data/Rakefile +4 -0
  14. data/bin/howitzer +34 -5
  15. data/features/cli_help.feature +3 -2
  16. data/features/cli_new.feature +1 -1
  17. data/features/cli_unknown.feature +1 -1
  18. data/features/cli_update.feature +84 -0
  19. data/features/step_definitions/common_steps.rb +9 -1
  20. data/generators/base_generator.rb +30 -15
  21. data/generators/config/config_generator.rb +7 -7
  22. data/generators/config/templates/custom.yml +1 -0
  23. data/generators/config/templates/default.yml +35 -5
  24. data/generators/cucumber/templates/env.rb +2 -2
  25. data/generators/cucumber/templates/transformers.rb +3 -1
  26. data/generators/root/templates/Gemfile +5 -3
  27. data/generators/root/templates/Rakefile +2 -0
  28. data/generators/rspec/templates/example_spec.rb +3 -3
  29. data/generators/rspec/templates/spec_helper.rb +6 -7
  30. data/howitzer.gemspec +15 -15
  31. data/lib/howitzer/capybara/settings.rb +125 -49
  32. data/lib/howitzer/helpers.rb +161 -94
  33. data/lib/howitzer/mailgun/client.rb +1 -1
  34. data/lib/howitzer/tasks/framework.rake +3 -0
  35. data/lib/howitzer/utils.rb +1 -1
  36. data/lib/howitzer/utils/locator_store.rb +1 -1
  37. data/lib/howitzer/utils/log.rb +1 -1
  38. data/lib/howitzer/utils/page_validator.rb +1 -1
  39. data/lib/howitzer/version.rb +1 -1
  40. data/lib/howitzer/web_page.rb +11 -11
  41. data/spec/spec_helper.rb +25 -22
  42. data/spec/support/generator_helper.rb +8 -1
  43. data/spec/unit/generators/base_generator_spec.rb +242 -0
  44. data/spec/unit/generators/config_generator_spec.rb +34 -0
  45. data/spec/unit/generators/cucumber_generator_spec.rb +45 -0
  46. data/spec/unit/generators/emails_generator_spec.rb +31 -0
  47. data/spec/unit/generators/pages_generator_spec.rb +33 -0
  48. data/spec/unit/generators/root_generator_spec.rb +35 -0
  49. data/spec/unit/generators/rspec_generator_spec.rb +36 -0
  50. data/spec/unit/generators/tasks_generator_spec.rb +31 -0
  51. data/spec/unit/lib/capybara/dsl_ex_spec.rb +11 -11
  52. data/spec/unit/lib/capybara/settings_spec.rb +336 -58
  53. data/spec/unit/lib/email_spec.rb +17 -17
  54. data/spec/unit/lib/helpers_spec.rb +699 -315
  55. data/spec/unit/lib/mailgun/client_spec.rb +9 -9
  56. data/spec/unit/lib/mailgun/connector_spec.rb +20 -20
  57. data/spec/unit/lib/mailgun/response_spec.rb +9 -9
  58. data/spec/unit/lib/settings_spec.rb +6 -6
  59. data/spec/unit/lib/utils/data_generator/data_storage_spec.rb +31 -31
  60. data/spec/unit/lib/utils/data_generator/gen_spec.rb +20 -20
  61. data/spec/unit/lib/utils/locator_store_spec.rb +39 -39
  62. data/spec/unit/lib/utils/log_spec.rb +42 -42
  63. data/spec/unit/lib/utils/page_validator_spec.rb +69 -70
  64. data/spec/unit/lib/web_page_spec.rb +91 -69
  65. data/spec/unit/version_spec.rb +3 -3
  66. metadata +100 -78
  67. data/spec/unit/generators/generators_spec.rb +0 -175
@@ -1,18 +1,18 @@
1
1
  require 'spec_helper'
2
- require "howitzer/email"
3
- require "howitzer/utils/log"
2
+ require 'howitzer/email'
3
+ require 'howitzer/utils/log'
4
4
  require 'howitzer/exceptions'
5
5
 
6
- describe "Email" do
6
+ RSpec.describe 'Email' do
7
7
  let(:recipient){ 'first_tester@gmail.com' }
8
8
  let(:message) do
9
9
  {
10
10
  'body-plain' => 'test body footer',
11
- 'stripped-html' => "<p> test body </p> <p> footer </p>",
11
+ 'stripped-html' => '<p> test body </p> <p> footer </p>',
12
12
  'stripped-text' => 'test body',
13
- 'From' => "Strong Tester <tester@gmail.com>",
13
+ 'From' => 'Strong Tester <tester@gmail.com>',
14
14
  'To' => recipient,
15
- 'Received' => "by 10.216.46.75 with HTTP; Sat, 5 Apr 2014 05:10:42 -0700 (PDT)",
15
+ 'Received' => 'by 10.216.46.75 with HTTP; Sat, 5 Apr 2014 05:10:42 -0700 (PDT)',
16
16
  'sender' => 'tester@gmail.com',
17
17
  'attachments' => []
18
18
  }
@@ -43,23 +43,23 @@ describe "Email" do
43
43
  let(:mailgun_message){ double(to_h: message) }
44
44
  let(:events) { double(to_h: {'items' => [event]}) }
45
45
  subject { Email.find(recipient, message_subject) }
46
- context "when message is found" do
46
+ context 'when message is found' do
47
47
  let(:event) { {'message' => {'recipients' => [recipient], 'headers' => {'subject' => message_subject} }, 'storage' => {'key' => '1234567890'} } }
48
48
  before do
49
- allow(Mailgun::Connector.instance.client).to receive(:get).with("mailgun@test.domain/events", event: 'stored').ordered.once {events}
50
- allow(Mailgun::Connector.instance.client).to receive(:get).with("domains/mailgun@test.domain/messages/1234567890").ordered.once { mailgun_message }
49
+ allow(Mailgun::Connector.instance.client).to receive(:get).with('mailgun@test.domain/events', event: 'stored').ordered.once {events}
50
+ allow(Mailgun::Connector.instance.client).to receive(:get).with('domains/mailgun@test.domain/messages/1234567890').ordered.once { mailgun_message }
51
51
  end
52
52
  it do
53
53
  expect(Email).to receive(:new).with(message).once
54
54
  subject
55
55
  end
56
56
  end
57
- context "when message is not found" do
58
- let(:event) { {'message' => {'recipients' => ["other@test.com"], 'headers' => {'subject' => message_subject} }, 'storage' => {'key' => '1234567890'} } }
57
+ context 'when message is not found' do
58
+ let(:event) { {'message' => {'recipients' => ['other@test.com'], 'headers' => {'subject' => message_subject} }, 'storage' => {'key' => '1234567890'} } }
59
59
  before do
60
60
  allow(settings).to receive(:timeout_small) { 0.5 }
61
61
  allow(settings).to receive(:timeout_short) { 0.05 }
62
- allow(Mailgun::Connector.instance.client).to receive(:get).with("mailgun@test.domain/events", event: 'stored').at_least(:twice).ordered {events}
62
+ allow(Mailgun::Connector.instance.client).to receive(:get).with('mailgun@test.domain/events', event: 'stored').at_least(:twice).ordered {events}
63
63
  end
64
64
  it do
65
65
  expect(log).to receive(:error).with(Howitzer::EmailNotFoundError, "Message with subject '#{message_subject}' for recipient '#{recipient}' was not found.")
@@ -86,17 +86,17 @@ describe "Email" do
86
86
 
87
87
  describe '#recipients' do
88
88
  subject { email_object.recipients }
89
- it { expect(subject).to be_a_kind_of Array }
89
+ it { is_expected.to be_a_kind_of Array }
90
90
 
91
91
  context 'when one recipient' do
92
- it { expect(subject).to include message['To']}
92
+ it { is_expected.to include message['To']}
93
93
  end
94
94
 
95
95
  context 'when more than one recipient' do
96
- let(:second_recipient) { "second_tester@gmail.com" }
96
+ let(:second_recipient) { 'second_tester@gmail.com' }
97
97
  let(:message_with_multiple_recipients) { message.merge({'To' => "#{recipient}, #{second_recipient}"}) }
98
98
  let(:email_object) { Email.new(message_with_multiple_recipients) }
99
- it { expect(subject).to eql [recipient, second_recipient] }
99
+ it { is_expected.to eql [recipient, second_recipient] }
100
100
  end
101
101
  end
102
102
 
@@ -114,7 +114,7 @@ describe "Email" do
114
114
  context 'when has attachments' do
115
115
  let(:files) { [double] }
116
116
  before { email_object.instance_variable_set(:@message, 'attachments' => files)}
117
- it { expect(subject).to eq(files) }
117
+ it { is_expected.to eq(files) }
118
118
  end
119
119
 
120
120
  context 'when no attachments' do
@@ -1,620 +1,1003 @@
1
1
  require 'spec_helper'
2
- require "howitzer/helpers"
2
+ require 'howitzer/helpers'
3
3
 
4
- describe "Helpers" do
5
- let(:settings) { double("settings")}
4
+ RSpec.describe 'Helpers' do
5
+ let(:settings) { double('settings')}
6
+ let(:selenium_driver) { false }
7
+ let(:selenium_grid_driver) { false }
8
+ let(:phantomjs_driver) { false }
9
+ let(:sauce_driver) { false }
10
+ let(:testingbot_driver) { false }
6
11
 
7
- describe "#sauce_driver?" do
12
+ describe '#sauce_driver?' do
8
13
  subject { sauce_driver? }
9
14
  before { allow(settings).to receive(:driver) { driver_setting } }
10
- context "when :sauce" do
15
+ context 'when :sauce' do
11
16
  let(:driver_setting) {:sauce}
12
- it{ expect(subject).to be_true }
17
+ it{ is_expected.to be_truthy }
13
18
  end
14
- context "when not :sauce" do
19
+ context 'when not :sauce' do
15
20
  let(:driver_setting) {:phantomjs}
16
- it{ expect(subject).to be_false }
21
+ it{ is_expected.to be_falsey }
17
22
  end
18
- context "when driver specified as String" do
19
- let(:driver_setting) {"sauce"}
20
- it{ expect(subject).to be_true }
23
+ context 'when driver specified as String' do
24
+ let(:driver_setting) { 'sauce' }
25
+ it{ is_expected.to be true }
21
26
  end
22
- context "when driver is not specified" do
27
+ context 'when driver is not specified' do
23
28
  let(:driver_setting) { nil }
24
29
  it do
25
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, "Please check your settings").once.and_call_original
30
+ expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
26
31
  expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
27
32
  end
28
33
  end
29
34
  end
30
35
 
31
- describe "#testingbot_driver?" do
36
+ describe '#testingbot_driver?' do
32
37
  subject { testingbot_driver? }
33
38
  before { allow(settings).to receive(:driver) { driver_setting } }
34
- context "when :testingbot" do
39
+ context 'when :testingbot' do
35
40
  let(:driver_setting) {:testingbot}
36
- it{ expect(subject).to be_true }
41
+ it{ is_expected.to be_truthy }
37
42
  end
38
- context "when not :testingbot" do
43
+ context 'when not :testingbot' do
39
44
  let(:driver_setting) {:phantomjs}
40
- it{ expect(subject).to be_false }
45
+ it{ is_expected.to be_falsey }
41
46
  end
42
- context "when driver specified as String" do
43
- let(:driver_setting) {"testingbot"}
44
- it{ expect(subject).to be_true }
47
+ context 'when driver specified as String' do
48
+ let(:driver_setting) { 'testingbot' }
49
+ it{ is_expected.to be_truthy }
45
50
  end
46
- context "when driver is not specified" do
51
+ context 'when driver is not specified' do
47
52
  let(:driver_setting) { nil }
48
53
  it do
49
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, "Please check your settings").once.and_call_original
54
+ expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
50
55
  expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
51
56
  end
52
57
  end
53
58
  end
54
59
 
55
- describe "#phantomjs_driver?" do
60
+ describe '#phantomjs_driver?' do
56
61
  subject { phantomjs_driver? }
57
62
  before { allow(settings).to receive(:driver) { driver_setting } }
58
- context "when :phantomjs" do
63
+ context 'when :phantomjs' do
59
64
  let(:driver_setting) {:phantomjs}
60
- it{ expect(subject).to be_true }
65
+ it{ is_expected.to be_truthy }
61
66
  end
62
- context "when not :phantomjs" do
67
+ context 'when not :phantomjs' do
63
68
  let(:driver_setting) {:selenium}
64
- it{ expect(subject).to be_false }
69
+ it{ is_expected.to be_falsey }
65
70
  end
66
- context "when driver specified as String" do
67
- let(:driver_setting) {"phantomjs"}
68
- it{ expect(subject).to be_true }
71
+ context 'when :selenium_grid' do
72
+ let(:driver_setting) {:selenium_grid}
73
+ it{ is_expected.to be_falsey }
69
74
  end
70
- context "when driver is not specified" do
75
+ context 'when driver specified as String' do
76
+ let(:driver_setting) { 'phantomjs' }
77
+ it{ is_expected.to be_truthy }
78
+ end
79
+ context 'when driver is not specified' do
71
80
  let(:driver_setting) { nil }
72
81
  it do
73
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, "Please check your settings").once.and_call_original
82
+ expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
74
83
  expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
75
84
  end
76
85
  end
77
86
  end
78
87
 
79
- describe "#selenium_driver?" do
88
+ describe '#selenium_driver?' do
80
89
  subject { selenium_driver? }
81
90
  before { allow(settings).to receive(:driver) { driver_setting } }
82
- context "when :selenium" do
91
+ context 'when :selenium' do
83
92
  let(:driver_setting) {:selenium}
84
- it{ expect(subject).to be_true }
93
+ it{ is_expected.to be_truthy }
94
+ end
95
+ context 'when :selenium_grid' do
96
+ let(:driver_setting) {:selenium_grid}
97
+ it{ is_expected.to be_falsey }
85
98
  end
86
- context "when not :selenium" do
99
+ context 'when not :selenium' do
87
100
  let(:driver_setting) {:phantomjs}
88
- it{ expect(subject).to be_false }
101
+ it{ is_expected.to be_falsey }
89
102
  end
90
- context "when driver specified as String" do
91
- let(:driver_setting) {"selenium"}
92
- it{ expect(subject).to be_true }
103
+ context 'when driver specified as String' do
104
+ let(:driver_setting) { 'selenium' }
105
+ it{ is_expected.to be_truthy }
93
106
  end
94
- context "when driver is not specified" do
107
+ context 'when driver is not specified' do
95
108
  let(:driver_setting) { nil }
96
109
  it do
97
- expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, "Please check your settings").once.and_call_original
110
+ expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
98
111
  expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
99
112
  end
100
113
  end
101
114
  end
102
115
 
103
- describe "#ie_browser?" do
116
+ describe '#selenium_grid_driver?' do
117
+ subject { selenium_grid_driver? }
118
+ before { allow(settings).to receive(:driver) { driver_setting } }
119
+ context 'when :selenium_grid' do
120
+ let(:driver_setting) {:selenium_grid}
121
+ it{ is_expected.to be_truthy }
122
+ end
123
+ context 'when :selenium' do
124
+ let(:driver_setting) {:selenium}
125
+ it{ is_expected.to be_falsey }
126
+ end
127
+ context 'when not :selenium' do
128
+ let(:driver_setting) {:phantomjs}
129
+ it{ is_expected.to be_falsey }
130
+ end
131
+ context 'when driver specified as String' do
132
+ let(:driver_setting) { 'selenium_grid' }
133
+ it{ is_expected.to be_truthy }
134
+ end
135
+ context 'when driver is not specified' do
136
+ let(:driver_setting) { nil }
137
+ it do
138
+ expect(log).to receive(:error).with(Howitzer::DriverNotSpecifiedError, 'Please check your settings').once.and_call_original
139
+ expect { subject }.to raise_error(Howitzer::DriverNotSpecifiedError)
140
+ end
141
+ end
142
+ end
143
+
144
+ describe '#ie_browser?' do
104
145
  subject { ie_browser? }
105
- before { allow(self).to receive(:sauce_driver?) {sauce_driver} }
106
- before { allow(self).to receive(:testingbot_driver?) {testingbot_driver} }
107
- context "when sauce_driver? is TRUE" do
146
+ before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
147
+ before { allow(self).to receive(:testingbot_driver?) { testingbot_driver } }
148
+ before { allow(self).to receive(:selenium_grid_driver?) { selenium_grid_driver } }
149
+ context 'when sauce_driver? is TRUE' do
108
150
  let(:sauce_driver) { true }
109
- let(:testingbot_driver) { false }
110
- context "settings.sl_browser_name = :ie" do
151
+ context 'settings.sl_browser_name = :ie' do
111
152
  before { allow(settings).to receive(:sl_browser_name) { :ie } }
112
- it { expect(subject).to be_true }
153
+ it { is_expected.to be_truthy }
113
154
  end
114
- context "settings.sl_browser_name = :iexplore" do
155
+ context 'settings.sl_browser_name = :iexplore' do
115
156
  before { allow(settings).to receive(:sl_browser_name) { :iexplore } }
116
- it { expect(subject).to be_true }
157
+ it { is_expected.to be_truthy }
117
158
  end
118
- context "settings.sl_browser_name = :chrome" do
159
+ context 'settings.sl_browser_name = :chrome' do
119
160
  before { allow(settings).to receive(:sl_browser_name) { :chrome } }
120
- it { expect(subject).to be_false }
161
+ it { is_expected.to be_falsey }
121
162
  end
122
- context "settings.sl_browser_name is not specified" do
163
+ context 'settings.sl_browser_name is not specified' do
123
164
  before { allow(settings).to receive(:sl_browser_name) { nil } }
124
165
  it do
125
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
166
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
126
167
  expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
127
168
  end
128
169
  end
129
170
  end
130
- context "when sauce_driver? is FALSE" do
131
- let(:sauce_driver) { false }
132
- let(:testingbot_driver) { false }
171
+ context 'when sauce_driver? is FALSE' do
133
172
  before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
134
- context "when selenium_driver? is TRUE" do
173
+ context 'when selenium_driver? is TRUE' do
135
174
  let(:selenium_driver) { true }
136
- context "settings.sel_browser = :ie" do
175
+ context 'settings.sel_browser = :ie' do
176
+ before { allow(settings).to receive(:sel_browser) { :ie } }
177
+ it { is_expected.to be_truthy }
178
+ end
179
+ context 'settings.sel_browser = :iexplore' do
180
+ before { allow(settings).to receive(:sel_browser) { :iexplore } }
181
+ it { is_expected.to be_truthy }
182
+ end
183
+ context 'settings.sel_browser = :chrome' do
184
+ before { allow(settings).to receive(:sel_browser) { :chrome } }
185
+ it { is_expected.to be_falsey }
186
+ end
187
+ context 'settings.sel_browser is not specified' do
188
+ before { allow(settings).to receive(:sel_browser) { nil } }
189
+ it do
190
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
191
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
192
+ end
193
+ end
194
+ end
195
+ context 'when selenium_driver? is FALSE' do
196
+ it { is_expected.to be_falsey }
197
+ end
198
+ context 'when selenium_grid_driver? is TRUE' do
199
+ let(:selenium_grid_driver) { true }
200
+ context 'settings.sel_browser = :ie' do
137
201
  before { allow(settings).to receive(:sel_browser) { :ie } }
138
- it { expect(subject).to be_true }
202
+ it { is_expected.to be_truthy }
139
203
  end
140
- context "settings.sel_browser = :iexplore" do
204
+ context 'settings.sel_browser = :iexplore' do
141
205
  before { allow(settings).to receive(:sel_browser) { :iexplore } }
142
- it { expect(subject).to be_true }
206
+ it { is_expected.to be_truthy }
143
207
  end
144
- context "settings.sel_browser = :chrome" do
208
+ context 'settings.sel_browser = :chrome' do
145
209
  before { allow(settings).to receive(:sel_browser) { :chrome } }
146
- it { expect(subject).to be_false }
210
+ it { is_expected.to be_falsey }
147
211
  end
148
- context "settings.sel_browser is not specified" do
212
+ context 'settings.sel_browser is not specified' do
149
213
  before { allow(settings).to receive(:sel_browser) { nil } }
150
214
  it do
151
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
215
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
152
216
  expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
153
217
  end
154
218
  end
155
219
  end
156
- context "when selenium_driver? is FALSE" do
157
- let(:selenium_driver) { false }
158
- it { expect(subject).to be_false }
220
+ context 'when selenium_grid_driver? is FALSE' do
221
+ it { is_expected.to be_falsey }
159
222
  end
160
223
  end
161
- context "when testingbot_driver? is TRUE" do
224
+ context 'when testingbot_driver? is TRUE' do
162
225
  let(:testingbot_driver) { true }
163
- let(:sauce_driver) { false }
164
226
  before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
165
- context "settings.sel_browser = :ie" do
227
+ context 'settings.sel_browser = :ie' do
166
228
  before do
167
229
  allow(settings).to receive(:tb_browser_name) { :ie }
168
230
  allow(settings).to receive(:tb_browser_version) { 9 }
169
231
  end
170
- it { expect(subject).to be_true }
232
+ it { is_expected.to be_truthy }
171
233
  end
172
- context "settings.tb_browser_name = :iexplore" do
234
+ context 'settings.tb_browser_name = :iexplore' do
173
235
  before do
174
236
  allow(settings).to receive(:tb_browser_name) { :iexplore }
175
237
  allow(settings).to receive(:tb_browser_version) { 9 }
176
238
  end
177
- it { expect(subject).to be_true }
239
+ it { is_expected.to be_truthy }
178
240
  end
179
- context "settings.tb_browser_name = :firefox" do
241
+ context 'settings.tb_browser_name = :firefox' do
180
242
  before do
181
243
  allow(settings).to receive(:tb_browser_name) { :firefox }
182
244
  allow(settings).to receive(:tb_browser_version) { 8 }
183
245
  end
184
- it { expect(subject).to be_false }
246
+ it { is_expected.to be_falsey }
185
247
  end
186
- context "settings.tb_browser_name is not specified" do
248
+ context 'settings.tb_browser_name is not specified' do
187
249
  before { allow(settings).to receive(:tb_browser_name) { nil } }
188
250
  it do
189
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
251
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
190
252
  expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
191
253
  end
192
254
  end
193
255
  end
194
- context "when testingbot_driver? is FALSE" do
256
+ context 'when testingbot_driver? is FALSE' do
195
257
  before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
196
- context "when sauce_driver? is TRUE" do
197
- let(:testingbot_driver) { false }
258
+ context 'when sauce_driver? is TRUE' do
198
259
  let(:sauce_driver) { true }
199
- context "settings.sl_browser_name = :ie" do
260
+ context 'settings.sl_browser_name = :ie' do
200
261
  before { allow(settings).to receive(:sl_browser_name) { :ie } }
201
- it { expect(subject).to be_true }
262
+ it { is_expected.to be_truthy }
202
263
  end
203
- context "settings.sl_browser_name = :iexplore" do
264
+ context 'settings.sl_browser_name = :iexplore' do
204
265
  before { allow(settings).to receive(:sl_browser_name) { :iexplore } }
205
- it { expect(subject).to be_true }
266
+ it { is_expected.to be_truthy }
206
267
  end
207
- context "settings.sl_browser_name = :chrome" do
268
+ context 'settings.sl_browser_name = :chrome' do
208
269
  before { allow(settings).to receive(:sl_browser_name) { :chrome } }
209
- it { expect(subject).to be_false }
270
+ it { is_expected.to be_falsey }
210
271
  end
211
- context "settings.sl_browser_name is not specified" do
272
+ context 'settings.sl_browser_name is not specified' do
212
273
  before { allow(settings).to receive(:sl_browser_name) { nil } }
213
274
  it do
214
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
275
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
215
276
  expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
216
277
  end
217
278
  end
218
279
  end
219
280
  end
220
- context "when selenium_driver? is TRUE" do
221
- let(:sauce_driver) { false }
222
- let(:testingbot_driver) { false }
281
+ context 'when selenium_driver? is TRUE' do
223
282
  before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
224
- context "when selenium_driver? is TRUE" do
283
+ context 'when selenium_driver? is TRUE' do
225
284
  let(:selenium_driver) { true }
226
- context "settings.sel_browser = :ie" do
285
+ context 'settings.sel_browser = :ie' do
227
286
  before { allow(settings).to receive(:sel_browser) { :ie } }
228
- it { expect(subject).to be_true }
287
+ it { is_expected.to be_truthy }
229
288
  end
230
- context "settings.sel_browser = :iexplore" do
289
+ context 'settings.sel_browser = :iexplore' do
231
290
  before { allow(settings).to receive(:sel_browser) { :iexplore } }
232
- it { expect(subject).to be_true }
291
+ it { is_expected.to be_truthy }
233
292
  end
234
- context "settings.sel_browser = :chrome" do
293
+ context 'settings.sel_browser = :chrome' do
235
294
  before { allow(settings).to receive(:sel_browser) { :chrome } }
236
- it { expect(subject).to be_false }
295
+ it { is_expected.to be_falsey }
237
296
  end
238
- context "settings.sel_browser is not specified" do
297
+ context 'settings.sel_browser is not specified' do
239
298
  before { allow(settings).to receive(:sel_browser) { nil } }
240
299
  it do
241
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
300
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
242
301
  expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
243
302
  end
244
303
  end
245
304
  end
246
305
  end
247
- context "when selenium_driver? is FALSE" do
306
+ context 'when selenium_driver? is FALSE' do
248
307
  before { allow(self).to receive(:selenium_driver?) { false } }
249
- context "when testingbot_driver? is TRUE" do
308
+ context 'when testingbot_driver? is TRUE' do
250
309
  let(:testingbot_driver) { true }
251
- let(:sauce_driver) { false }
252
310
  before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
253
- context "settings.sl_browser_name = :ie" do
311
+ context 'settings.sl_browser_name = :ie' do
254
312
  before do
255
313
  allow(settings).to receive(:tb_browser_name) { :ie }
256
314
  allow(settings).to receive(:tb_browser_version) { 9 }
257
315
  end
258
- it { expect(subject).to be_true }
316
+ it { is_expected.to be_truthy }
259
317
  end
260
- context "settings.tb_browser_name = :iexplore" do
318
+ context 'settings.tb_browser_name = :iexplore' do
261
319
  before do
262
320
  allow(settings).to receive(:tb_browser_name) { :iexplore }
263
321
  allow(settings).to receive(:tb_browser_version) { 9 }
264
322
  end
265
- it { expect(subject).to be_true }
323
+ it { is_expected.to be_truthy }
266
324
  end
267
- context "settings.tb_browser_name = :firefox" do
325
+ context 'settings.tb_browser_name = :firefox' do
268
326
  before do
269
327
  allow(settings).to receive(:tb_browser_name) { :firefox }
270
328
  allow(settings).to receive(:tb_browser_version) { 8 }
271
329
  end
272
- it { expect(subject).to be_false }
330
+ it { is_expected.to be_falsey }
273
331
  end
274
- context "settings.tb_browser_name is not specified" do
332
+ context 'settings.tb_browser_name is not specified' do
275
333
  before { allow(settings).to receive(:tb_browser_name) { nil } }
276
334
  it do
277
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
335
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
278
336
  expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
279
337
  end
280
338
  end
281
339
  end
282
340
  end
283
341
  end
284
- describe "#ff_browser?" do
342
+
343
+ describe '#ff_browser?' do
285
344
  subject { ff_browser? }
286
- before { allow(self).to receive(:sauce_driver?){ sauce_driver} }
287
- before { allow(self).to receive(:testingbot_driver?){ testingbot_driver} }
288
- context "when sauce_driver? is TRUE" do
345
+ before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
346
+ before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
347
+ before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
348
+ context 'when sauce_driver? is TRUE' do
289
349
  let(:sauce_driver) { true }
290
- let(:testingbot_driver) { false }
291
- context "settings.sl_browser_name = :ff" do
350
+ context 'settings.sl_browser_name = :ff' do
292
351
  before { allow(settings).to receive(:sl_browser_name) { :ff } }
293
- it { expect(subject).to be_true }
352
+ it { is_expected.to be_truthy }
294
353
  end
295
- context "settings.sl_browser_name = :firefox" do
354
+ context 'settings.sl_browser_name = :firefox' do
296
355
  before { allow(settings).to receive(:sl_browser_name) { :firefox } }
297
- it { expect(subject).to be_true }
356
+ it { is_expected.to be_truthy }
298
357
  end
299
- context "settings.sl_browser_name = :chrome" do
358
+ context 'settings.sl_browser_name = :chrome' do
300
359
  before { allow(settings).to receive(:sl_browser_name) { :chrome } }
301
- it { expect(subject).to be_false }
360
+ it { is_expected.to be_falsey }
302
361
  end
303
- context "settings.sl_browser_name is not specified" do
362
+ context 'settings.sl_browser_name is not specified' do
304
363
  before { allow(settings).to receive(:sl_browser_name) { nil } }
305
364
  it do
306
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
365
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
307
366
  expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
308
367
  end
309
368
  end
310
369
  end
311
- context "when sauce_driver? is FALSE" do
312
- let(:testingbot_driver) { false }
313
- let(:sauce_driver) { false }
370
+ context 'when sauce_driver? is FALSE' do
314
371
  before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
315
- context "when selenium_driver? is TRUE" do
372
+ context 'when selenium_driver? is TRUE' do
316
373
  let(:selenium_driver) { true }
317
- context "settings.sel_browser = :ff" do
374
+ context 'settings.sel_browser = :ff' do
318
375
  before { allow(settings).to receive(:sel_browser) { :ff } }
319
- it { expect(subject).to be_true }
376
+ it { is_expected.to be_truthy }
320
377
  end
321
- context "settings.sel_browser = :firefox" do
378
+ context 'settings.sel_browser = :firefox' do
322
379
  before { allow(settings).to receive(:sel_browser) { :firefox } }
323
- it { expect(subject).to be_true }
380
+ it { is_expected.to be_truthy }
324
381
  end
325
- context "settings.sel_browser = :chrome" do
382
+ context 'settings.sel_browser = :chrome' do
326
383
  before { allow(settings).to receive(:sel_browser) { :chrome } }
327
- it { expect(subject).to be_false }
384
+ it { is_expected.to be_falsey }
328
385
  end
329
- context "settings.sel_browser is not specified" do
386
+ context 'settings.sel_browser is not specified' do
330
387
  before { allow(settings).to receive(:sel_browser) { nil } }
331
388
  it do
332
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
389
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
333
390
  expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
334
391
  end
335
392
  end
336
393
  end
337
- context "when selenium_driver? is FALSE" do
338
- let(:selenium_driver) { false }
339
- it { expect(subject).to be_false }
394
+ context 'when selenium_driver? is FALSE' do
395
+ it { is_expected.to be_falsey }
340
396
  end
341
397
  end
342
- context "when testingbot_driver? is TRUE" do
398
+ context 'when testingbot_driver? is TRUE' do
343
399
  let(:testingbot_driver) { true }
344
- let(:sauce_driver) { false }
345
400
  before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
346
- context "settings.tb_browser_name = :ff" do
401
+ context 'settings.tb_browser_name = :ff' do
347
402
  before do
348
403
  allow(settings).to receive(:tb_browser_name) { :ff }
349
404
  allow(settings).to receive(:tb_browser_version) { 8 }
350
405
  end
351
- it { expect(subject).to be_true }
406
+ it { is_expected.to be_truthy }
352
407
  end
353
- context "settings.tb_browser_name = :firefox" do
408
+ context 'settings.tb_browser_name = :firefox' do
354
409
  before do
355
410
  allow(settings).to receive(:tb_browser_name) { :firefox }
356
411
  allow(settings).to receive(:tb_browser_version) { 8 }
357
412
  end
358
- it { expect(subject).to be_true }
413
+ it { is_expected.to be_truthy }
359
414
  end
360
- context "settings.tb_browser_name = :iexplore" do
415
+ context 'settings.tb_browser_name = :iexplore' do
361
416
  before do
362
417
  allow(settings).to receive(:tb_browser_name) { :iexplore }
363
418
  allow(settings).to receive(:tb_browser_version) { 9 }
364
419
  end
365
- it { expect(subject).to be_false }
420
+ it { is_expected.to be_falsey }
366
421
  end
367
- context "settings.tb_browser_name is not specified" do
422
+ context 'settings.tb_browser_name is not specified' do
368
423
  before { allow(settings).to receive(:tb_browser_name) { nil } }
369
424
  it do
370
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
425
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
371
426
  expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
372
427
  end
373
428
  end
374
429
  end
375
- context "when testingbot_driver? is FALSE" do
430
+ context 'when testingbot_driver? is FALSE' do
376
431
  before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
377
- context "when sauce_driver? is TRUE" do
378
- let(:testingbot_driver) { false }
432
+ context 'when sauce_driver? is TRUE' do
379
433
  let(:sauce_driver) { true }
380
- context "settings.sl_browser_name = :ff" do
434
+ context 'settings.sl_browser_name = :ff' do
381
435
  before { allow(settings).to receive(:sl_browser_name) { :ff } }
382
- it { expect(subject).to be_true }
436
+ it { is_expected.to be_truthy }
383
437
  end
384
- context "settings.sl_browser_name = :firefox" do
438
+ context 'settings.sl_browser_name = :firefox' do
385
439
  before { allow(settings).to receive(:sl_browser_name) { :firefox } }
386
- it { expect(subject).to be_true }
440
+ it { is_expected.to be_truthy }
387
441
  end
388
- context "settings.sl_browser_name = :chrome" do
442
+ context 'settings.sl_browser_name = :chrome' do
389
443
  before { allow(settings).to receive(:sl_browser_name) { :chrome } }
390
- it { expect(subject).to be_false }
444
+ it { is_expected.to be_falsey }
391
445
  end
392
- context "settings.sl_browser_name is not specified" do
446
+ context 'settings.sl_browser_name is not specified' do
393
447
  before { allow(settings).to receive(:sl_browser_name) { nil } }
394
448
  it do
395
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
449
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
396
450
  expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
397
451
  end
398
452
  end
399
453
  end
400
454
  end
401
- context "when selenium_driver? is TRUE" do
402
- let(:sauce_driver) { false }
403
- let(:testingbot_driver) { false }
455
+ context 'when selenium_driver? is TRUE' do
404
456
  before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
405
- context "when selenium_driver? is TRUE" do
457
+ context 'when selenium_driver? is TRUE' do
406
458
  let(:selenium_driver) { true }
407
- context "settings.sel_browser = :ff" do
459
+ context 'settings.sel_browser = :ff' do
408
460
  before { allow(settings).to receive(:sel_browser) { :ff } }
409
- it { expect(subject).to be_true }
461
+ it { is_expected.to be_truthy }
410
462
  end
411
- context "settings.sel_browser = :firefox" do
463
+ context 'settings.sel_browser = :firefox' do
412
464
  before { allow(settings).to receive(:sel_browser) { :firefox } }
413
- it { expect(subject).to be_true }
465
+ it { is_expected.to be_truthy }
414
466
  end
415
- context "settings.sel_browser = :chrome" do
467
+ context 'settings.sel_browser = :chrome' do
416
468
  before { allow(settings).to receive(:sel_browser) { :chrome } }
417
- it { expect(subject).to be_false }
469
+ it { is_expected.to be_falsey }
418
470
  end
419
- context "settings.sel_browser is not specified" do
471
+ context 'settings.sel_browser is not specified' do
420
472
  before { allow(settings).to receive(:sel_browser) { nil } }
421
473
  it do
422
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
474
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
423
475
  expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
424
476
  end
425
477
  end
426
478
  end
427
479
  end
428
- context "when selenium_driver? is FALSE" do
480
+ context 'when selenium_driver? is FALSE' do
429
481
  before { allow(self).to receive(:selenium_driver?) { false } }
430
- context "when testingbot_driver? is TRUE" do
482
+ context 'when testingbot_driver? is TRUE' do
431
483
  let(:testingbot_driver) { true }
432
- let(:sauce_driver) { false }
433
484
  before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
434
- context "settings.tb_browser_name = :firefox" do
485
+ context 'settings.tb_browser_name = :firefox' do
435
486
  before do
436
487
  allow(settings).to receive(:tb_browser_name) { :firefox }
437
488
  allow(settings).to receive(:tb_browser_version) { 8 }
438
489
  end
439
- it { expect(subject).to be_true }
490
+ it { is_expected.to be_truthy }
440
491
  end
441
- context "settings.tb_browser_name = :ff" do
492
+ context 'settings.tb_browser_name = :ff' do
442
493
  before do
443
494
  allow(settings).to receive(:tb_browser_name) { :ff }
444
495
  allow(settings).to receive(:tb_browser_version) { 8 }
445
496
  end
446
- it { expect(subject).to be_true }
497
+ it { is_expected.to be_truthy }
447
498
  end
448
- context "settings.tb_browser_name = :iexplore" do
499
+ context 'settings.tb_browser_name = :iexplore' do
449
500
  before do
450
501
  allow(settings).to receive(:tb_browser_name) { :iexplore }
451
502
  allow(settings).to receive(:tb_browser_version) { 9 }
452
503
  end
453
- it { expect(subject).to be_false }
504
+ it { is_expected.to be_falsey }
454
505
  end
455
- context "settings.tb_browser_name is not specified" do
506
+ context 'settings.tb_browser_name is not specified' do
456
507
  before { allow(settings).to receive(:tb_browser_name) { nil } }
457
508
  it do
458
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
509
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
459
510
  expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
460
511
  end
461
512
  end
462
513
  end
463
-
514
+ context 'when selenium_grid_driver? is TRUE' do
515
+ before { allow(self).to receive(:selenium_grid_driver?) { selenium_grid_driver } }
516
+ context 'when selenium_grid_driver? is TRUE' do
517
+ let(:selenium_grid_driver) { true }
518
+ context 'settings.sel_browser = :ff' do
519
+ before { allow(settings).to receive(:sel_browser) { :ff } }
520
+ it { is_expected.to be_truthy }
521
+ end
522
+ context 'settings.sel_browser = :firefox' do
523
+ before { allow(settings).to receive(:sel_browser) { :firefox } }
524
+ it { is_expected.to be_truthy }
525
+ end
526
+ context 'settings.sel_browser = :chrome' do
527
+ before { allow(settings).to receive(:sel_browser) { :chrome } }
528
+ it { is_expected.to be_falsey }
529
+ end
530
+ context 'settings.sel_browser is not specified' do
531
+ before { allow(settings).to receive(:sel_browser) { nil } }
532
+ it do
533
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
534
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
535
+ end
536
+ end
537
+ end
538
+ end
539
+ context 'when selenium_grid_driver? is FALSE' do
540
+ before { allow(self).to receive(:selenium_grid_driver?) { false } }
541
+ context 'when testingbot_driver? is TRUE' do
542
+ let(:testingbot_driver) { true }
543
+ before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
544
+ context 'settings.tb_browser_name = :firefox' do
545
+ before do
546
+ allow(settings).to receive(:tb_browser_name) { :firefox }
547
+ allow(settings).to receive(:tb_browser_version) { 8 }
548
+ end
549
+ it { is_expected.to be_truthy }
550
+ end
551
+ context 'settings.tb_browser_name = :ff' do
552
+ before do
553
+ allow(settings).to receive(:tb_browser_name) { :ff }
554
+ allow(settings).to receive(:tb_browser_version) { 8 }
555
+ end
556
+ it { is_expected.to be_truthy }
557
+ end
558
+ context 'settings.tb_browser_name = :iexplore' do
559
+ before do
560
+ allow(settings).to receive(:tb_browser_name) { :iexplore }
561
+ allow(settings).to receive(:tb_browser_version) { 9 }
562
+ end
563
+ it { is_expected.to be_falsey }
564
+ end
565
+ context 'settings.tb_browser_name is not specified' do
566
+ before { allow(settings).to receive(:tb_browser_name) { nil } }
567
+ it do
568
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
569
+ expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
570
+ end
571
+ end
572
+ end
573
+ end
464
574
  end
465
575
  end
466
- describe "#chrome_browser?" do
576
+
577
+ describe '#chrome_browser?' do
467
578
  subject { chrome_browser? }
468
- before { allow(self).to receive(:sauce_driver?){ sauce_driver} }
469
- before { allow(self).to receive(:testingbot_driver?){ testingbot_driver} }
470
- context "when sauce_driver? is TRUE" do
579
+ before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
580
+ before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
581
+ before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
582
+ context 'when sauce_driver? is TRUE' do
471
583
  let(:sauce_driver) { true }
472
584
  let(:testingbot_driver) { true }
473
- context "settings.sl_browser_name = :chrome" do
585
+ context 'settings.sl_browser_name = :chrome' do
474
586
  before { allow(settings).to receive(:sl_browser_name) { :chrome } }
475
- it { expect(subject).to be_true }
587
+ it { is_expected.to be_truthy }
476
588
  end
477
- context "settings.sl_browser_name = :firefox" do
589
+ context 'settings.sl_browser_name = :firefox' do
478
590
  before { allow(settings).to receive(:sl_browser_name) { :firefox } }
479
- it { expect(subject).to be_false }
591
+ it { is_expected.to be_falsey }
480
592
  end
481
- context "settings.sl_browser_name is not specified" do
593
+ context 'settings.sl_browser_name is not specified' do
482
594
  before { allow(settings).to receive(:sl_browser_name) { nil } }
483
595
  it do
484
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
596
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
485
597
  expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
486
598
  end
487
599
  end
488
600
  end
489
- context "when sauce_driver? is FALSE" do
490
- let(:sauce_driver) { false }
491
- let(:testingbot_driver) { false }
601
+ context 'when sauce_driver? is FALSE' do
492
602
  before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
493
- context "when selenium_driver? is TRUE" do
603
+ context 'when selenium_driver? is TRUE' do
494
604
  let(:selenium_driver) { true }
495
- context "settings.sel_browser = :chrome" do
605
+ context 'settings.sel_browser = :chrome' do
496
606
  before { allow(settings).to receive(:sel_browser) { :chrome } }
497
- it { expect(subject).to be_true }
607
+ it { is_expected.to be_truthy }
498
608
  end
499
- context "settings.sel_browser = :firefox" do
609
+ context 'settings.sel_browser = :firefox' do
500
610
  before { allow(settings).to receive(:sel_browser) { :firefox } }
501
- it { expect(subject).to be_false }
611
+ it { is_expected.to be_falsey }
502
612
  end
503
- context "settings.sel_browser is not specified" do
613
+ context 'settings.sel_browser is not specified' do
504
614
  before { allow(settings).to receive(:sel_browser) { nil } }
505
615
  it do
506
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
616
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
507
617
  expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
508
618
  end
509
619
  end
510
620
  end
511
- context "when selenium_driver? is FALSE" do
512
- let(:selenium_driver) { false }
513
- it { expect(subject).to be_false }
621
+ context 'when selenium_driver? is FALSE' do
622
+ it { is_expected.to be_falsey }
514
623
  end
515
624
  end
516
- context "when testingbot_driver? is TRUE" do
625
+ context 'when testingbot_driver? is TRUE' do
517
626
  let(:testingbot_driver) { true }
518
- let(:sauce_driver) { false }
519
627
  before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
520
- context "settings.tb_browser_name = :chrome" do
628
+ context 'settings.tb_browser_name = :chrome' do
521
629
  before do
522
630
  allow(settings).to receive(:tb_browser_name) { :chrome }
523
631
  allow(settings).to receive(:tb_browser_version) { 9 }
524
632
  end
525
- it { expect(subject).to be_true }
633
+ it { is_expected.to be_truthy }
526
634
  end
527
- context "settings.tb_browser_name = :iexplore" do
635
+ context 'settings.tb_browser_name = :iexplore' do
528
636
  before do
529
637
  allow(settings).to receive(:tb_browser_name) { :iexplore }
530
638
  allow(settings).to receive(:tb_browser_version) { 9 }
531
639
  end
532
- it { expect(subject).to be_false }
640
+ it { is_expected.to be_falsey }
533
641
  end
534
- context "settings.tb_browser_name is not specified" do
642
+ context 'settings.tb_browser_name is not specified' do
535
643
  before { allow(settings).to receive(:tb_browser_name) { nil } }
536
644
  it do
537
- expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
645
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
538
646
  expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
539
647
  end
540
648
  end
541
649
  end
542
- context "when testingbot_driver? is FALSE" do
650
+ context 'when testingbot_driver? is FALSE' do
543
651
  before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
544
- context "when sauce_driver? is TRUE" do
545
- let(:testingbot_driver) { false }
652
+ context 'when sauce_driver? is TRUE' do
546
653
  let(:sauce_driver) { true }
547
- context "settings.sl_browser_name = :chrome" do
654
+ context 'settings.sl_browser_name = :chrome' do
548
655
  before { allow(settings).to receive(:sl_browser_name) { :chrome } }
549
- it { expect(subject).to be_true }
656
+ it { is_expected.to be_truthy }
550
657
  end
551
- context "settings.sl_browser_name = :firefox" do
658
+ context 'settings.sl_browser_name = :firefox' do
552
659
  before { allow(settings).to receive(:sl_browser_name) { :firefox } }
553
- it { expect(subject).to be_false }
660
+ it { is_expected.to be_falsey }
554
661
  end
555
- context "settings.sl_browser_name is not specified" do
662
+ context 'settings.sl_browser_name is not specified' do
556
663
  before { allow(settings).to receive(:sl_browser_name) { nil } }
557
664
  it do
558
- expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
665
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
559
666
  expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
560
667
  end
561
668
  end
562
669
  end
563
-
564
670
  end
565
- context "when selenium_driver? is TRUE" do
566
- let(:sauce_driver) { false }
567
- let(:testingbot_driver) { false }
671
+ context 'when selenium_driver? is TRUE' do
568
672
  before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
569
- context "when selenium_driver? is TRUE" do
673
+ context 'when selenium_driver? is TRUE' do
570
674
  let(:selenium_driver) { true }
571
- context "settings.sel_browser = :chrome" do
675
+ context 'settings.sel_browser = :chrome' do
572
676
  before { allow(settings).to receive(:sel_browser) { :chrome } }
573
- it { expect(subject).to be_true }
677
+ it { is_expected.to be_truthy }
574
678
  end
575
- context "settings.sel_browser = :firefox" do
679
+ context 'settings.sel_browser = :firefox' do
576
680
  before { allow(settings).to receive(:sel_browser) { :firefox } }
577
- it { expect(subject).to be_false }
681
+ it { is_expected.to be_falsey }
578
682
  end
579
- context "settings.sel_browser is not specified" do
683
+ context 'settings.sel_browser is not specified' do
580
684
  before { allow(settings).to receive(:sel_browser) { nil } }
581
685
  it do
582
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
686
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
583
687
  expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
584
688
  end
585
689
  end
586
690
  end
587
-
588
691
  end
589
- context "when selenium_driver? is FALSE" do
590
- let(:sauce_driver) { false }
591
- let(:testingbot_driver) { false }
692
+ context 'when selenium_driver? is FALSE' do
592
693
  before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
593
- context "when selenium_driver? is TRUE" do
694
+ context 'when selenium_driver? is TRUE' do
594
695
  let(:selenium_driver) { true }
595
- context "settings.sel_browser = :chrome" do
696
+ context 'settings.sel_browser = :chrome' do
596
697
  before { allow(settings).to receive(:sel_browser) { :chrome } }
597
- it { expect(subject).to be_true }
698
+ it { is_expected.to be_truthy }
699
+ end
700
+ context 'settings.sel_browser = :firefox' do
701
+ before { allow(settings).to receive(:sel_browser) { :firefox } }
702
+ it { is_expected.to be_falsey }
703
+ end
704
+ context 'settings.sel_browser is not specified' do
705
+ before { allow(settings).to receive(:sel_browser) { nil } }
706
+ it do
707
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
708
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
709
+ end
710
+ end
711
+ end
712
+ context 'when selenium_driver? is FALSE' do
713
+ it { is_expected.to be_falsey }
714
+ end
715
+ end
716
+ end
717
+
718
+ describe '#opera_browser?' do
719
+ subject { opera_browser? }
720
+ before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
721
+ before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
722
+ before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
723
+ context 'when sauce_driver? is TRUE' do
724
+ let(:sauce_driver) { true }
725
+ let(:testingbot_driver) { true }
726
+ context 'settings.sl_browser_name = :opera' do
727
+ before { allow(settings).to receive(:sl_browser_name) { :opera } }
728
+ it { is_expected.to be_truthy }
729
+ end
730
+ context 'settings.sl_browser_name = :firefox' do
731
+ before { allow(settings).to receive(:sl_browser_name) { :firefox } }
732
+ it { is_expected.to be_falsey }
733
+ end
734
+ context 'settings.sl_browser_name is not specified' do
735
+ before { allow(settings).to receive(:sl_browser_name) { nil } }
736
+ it do
737
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
738
+ expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
739
+ end
740
+ end
741
+ end
742
+ context 'when sauce_driver? is FALSE' do
743
+ before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
744
+ context 'when selenium_driver? is TRUE' do
745
+ let(:selenium_driver) { true }
746
+ context 'settings.sel_browser = :opera' do
747
+ before { allow(settings).to receive(:sel_browser) { :opera } }
748
+ it { is_expected.to be_truthy }
749
+ end
750
+ context 'settings.sel_browser = :firefox' do
751
+ before { allow(settings).to receive(:sel_browser) { :firefox } }
752
+ it { is_expected.to be_falsey }
753
+ end
754
+ context 'settings.sel_browser is not specified' do
755
+ before { allow(settings).to receive(:sel_browser) { nil } }
756
+ it do
757
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
758
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
759
+ end
760
+ end
761
+ end
762
+ context 'when selenium_driver? is FALSE' do
763
+ it { is_expected.to be_falsey }
764
+ end
765
+ end
766
+ context 'when testingbot_driver? is TRUE' do
767
+ let(:testingbot_driver) { true }
768
+ before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
769
+ context 'settings.tb_browser_name = :opera' do
770
+ before do
771
+ allow(settings).to receive(:tb_browser_name) { :opera }
772
+ allow(settings).to receive(:tb_browser_version) { 9 }
773
+ end
774
+ it { is_expected.to be_truthy }
775
+ end
776
+ context 'settings.tb_browser_name = :iexplore' do
777
+ before do
778
+ allow(settings).to receive(:tb_browser_name) { :iexplore }
779
+ allow(settings).to receive(:tb_browser_version) { 9 }
780
+ end
781
+ it { is_expected.to be_falsey }
782
+ end
783
+ context 'settings.tb_browser_name is not specified' do
784
+ before { allow(settings).to receive(:tb_browser_name) { nil } }
785
+ it do
786
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
787
+ expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
788
+ end
789
+ end
790
+ end
791
+ context 'when testingbot_driver? is FALSE' do
792
+ before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
793
+ context 'when sauce_driver? is TRUE' do
794
+ let(:sauce_driver) { true }
795
+ context 'settings.sl_browser_name = :opera' do
796
+ before { allow(settings).to receive(:sl_browser_name) { :opera } }
797
+ it { is_expected.to be_truthy }
798
+ end
799
+ context 'settings.sl_browser_name = :firefox' do
800
+ before { allow(settings).to receive(:sl_browser_name) { :firefox } }
801
+ it { is_expected.to be_falsey }
802
+ end
803
+ context 'settings.sl_browser_name is not specified' do
804
+ before { allow(settings).to receive(:sl_browser_name) { nil } }
805
+ it do
806
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
807
+ expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
808
+ end
809
+ end
810
+ end
811
+ end
812
+ context 'when selenium_driver? is TRUE' do
813
+ before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
814
+ context 'when selenium_driver? is TRUE' do
815
+ let(:selenium_driver) { true }
816
+ context 'settings.sel_browser = :opera' do
817
+ before { allow(settings).to receive(:sel_browser) { :opera } }
818
+ it { is_expected.to be_truthy }
598
819
  end
599
- context "settings.sel_browser = :firefox" do
820
+ context 'settings.sel_browser = :firefox' do
600
821
  before { allow(settings).to receive(:sel_browser) { :firefox } }
601
- it { expect(subject).to be_false }
822
+ it { is_expected.to be_falsey }
602
823
  end
603
- context "settings.sel_browser is not specified" do
824
+ context 'settings.sel_browser is not specified' do
604
825
  before { allow(settings).to receive(:sel_browser) { nil } }
605
826
  it do
606
- expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, "Please check your settings").once.and_call_original
827
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
607
828
  expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
608
829
  end
609
830
  end
610
831
  end
611
- context "when selenium_driver? is FALSE" do
612
- let(:selenium_driver) { false }
613
- it { expect(subject).to be_false }
832
+ end
833
+ context 'when selenium_driver? is FALSE' do
834
+ before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
835
+ context 'when selenium_driver? is TRUE' do
836
+ let(:selenium_driver) { true }
837
+ context 'settings.sel_browser = :opera' do
838
+ before { allow(settings).to receive(:sel_browser) { :opera } }
839
+ it { is_expected.to be_truthy }
840
+ end
841
+ context 'settings.sel_browser = :firefox' do
842
+ before { allow(settings).to receive(:sel_browser) { :firefox } }
843
+ it { is_expected.to be_falsey }
844
+ end
845
+ context 'settings.sel_browser is not specified' do
846
+ before { allow(settings).to receive(:sel_browser) { nil } }
847
+ it do
848
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
849
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
850
+ end
851
+ end
852
+ end
853
+ context 'when selenium_driver? is FALSE' do
854
+ it { is_expected.to be_falsey }
614
855
  end
615
856
  end
616
857
  end
617
- describe "#app_url" do
858
+
859
+ describe '#safari_browser?' do
860
+ subject { safari_browser? }
861
+ before { allow(self).to receive(:sauce_driver?){ sauce_driver } }
862
+ before { allow(self).to receive(:testingbot_driver?){ testingbot_driver } }
863
+ before { allow(self).to receive(:selenium_grid_driver?){ selenium_grid_driver } }
864
+ context 'when sauce_driver? is TRUE' do
865
+ let(:sauce_driver) { true }
866
+ let(:testingbot_driver) { true }
867
+ context 'settings.sl_browser_name = :safari' do
868
+ before { allow(settings).to receive(:sl_browser_name) { :safari } }
869
+ it { is_expected.to be_truthy }
870
+ end
871
+ context 'settings.sl_browser_name = :firefox' do
872
+ before { allow(settings).to receive(:sl_browser_name) { :firefox } }
873
+ it { is_expected.to be_falsey }
874
+ end
875
+ context 'settings.sl_browser_name is not specified' do
876
+ before { allow(settings).to receive(:sl_browser_name) { nil } }
877
+ it do
878
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
879
+ expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
880
+ end
881
+ end
882
+ end
883
+ context 'when sauce_driver? is FALSE' do
884
+ before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
885
+ context 'when selenium_driver? is TRUE' do
886
+ let(:selenium_driver) { true }
887
+ context 'settings.sel_browser = :safari' do
888
+ before { allow(settings).to receive(:sel_browser) { :safari } }
889
+ it { is_expected.to be_truthy }
890
+ end
891
+ context 'settings.sel_browser = :firefox' do
892
+ before { allow(settings).to receive(:sel_browser) { :firefox } }
893
+ it { is_expected.to be_falsey }
894
+ end
895
+ context 'settings.sel_browser is not specified' do
896
+ before { allow(settings).to receive(:sel_browser) { nil } }
897
+ it do
898
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
899
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
900
+ end
901
+ end
902
+ end
903
+ context 'when selenium_driver? is FALSE' do
904
+ it { is_expected.to be_falsey }
905
+ end
906
+ end
907
+ context 'when testingbot_driver? is TRUE' do
908
+ let(:testingbot_driver) { true }
909
+ before { allow(settings).to receive(:testingbot_driver?) { testingbot_driver } }
910
+ context 'settings.tb_browser_name = :safari' do
911
+ before do
912
+ allow(settings).to receive(:tb_browser_name) { :safari }
913
+ allow(settings).to receive(:tb_browser_version) { 9 }
914
+ end
915
+ it { is_expected.to be_truthy }
916
+ end
917
+ context 'settings.tb_browser_name = :iexplore' do
918
+ before do
919
+ allow(settings).to receive(:tb_browser_name) { :iexplore }
920
+ allow(settings).to receive(:tb_browser_version) { 9 }
921
+ end
922
+ it { is_expected.to be_falsey }
923
+ end
924
+ context 'settings.tb_browser_name is not specified' do
925
+ before { allow(settings).to receive(:tb_browser_name) { nil } }
926
+ it do
927
+ expect(log).to receive(:error).with(Howitzer::TbBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
928
+ expect { subject }.to raise_error(Howitzer::TbBrowserNotSpecifiedError)
929
+ end
930
+ end
931
+ end
932
+ context 'when testingbot_driver? is FALSE' do
933
+ before { allow(self).to receive(:sauce_driver?) { sauce_driver } }
934
+ context 'when sauce_driver? is TRUE' do
935
+ let(:sauce_driver) { true }
936
+ context 'settings.sl_browser_name = :safari' do
937
+ before { allow(settings).to receive(:sl_browser_name) { :safari } }
938
+ it { is_expected.to be_truthy }
939
+ end
940
+ context 'settings.sl_browser_name = :firefox' do
941
+ before { allow(settings).to receive(:sl_browser_name) { :firefox } }
942
+ it { is_expected.to be_falsey }
943
+ end
944
+ context 'settings.sl_browser_name is not specified' do
945
+ before { allow(settings).to receive(:sl_browser_name) { nil } }
946
+ it do
947
+ expect(log).to receive(:error).with(Howitzer::SlBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
948
+ expect { subject }.to raise_error(Howitzer::SlBrowserNotSpecifiedError)
949
+ end
950
+ end
951
+ end
952
+ end
953
+ context 'when selenium_driver? is TRUE' do
954
+ before { allow(self).to receive(:selenium_driver?) { selenium_driver } }
955
+ context 'when selenium_driver? is TRUE' do
956
+ let(:selenium_driver) { true }
957
+ context 'settings.sel_browser = :safari' do
958
+ before { allow(settings).to receive(:sel_browser) { :safari } }
959
+ it { is_expected.to be_truthy }
960
+ end
961
+ context 'settings.sel_browser = :firefox' do
962
+ before { allow(settings).to receive(:sel_browser) { :firefox } }
963
+ it { is_expected.to be_falsey }
964
+ end
965
+ context 'settings.sel_browser is not specified' do
966
+ before { allow(settings).to receive(:sel_browser) { nil } }
967
+ it do
968
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
969
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
970
+ end
971
+ end
972
+ end
973
+ end
974
+ context 'when selenium_driver? is FALSE' do
975
+ before { allow(self).to receive(:selenium_driver?){ selenium_driver} }
976
+ context 'when selenium_driver? is TRUE' do
977
+ let(:selenium_driver) { true }
978
+ context 'settings.sel_browser = :safari' do
979
+ before { allow(settings).to receive(:sel_browser) { :safari } }
980
+ it { is_expected.to be_truthy }
981
+ end
982
+ context 'settings.sel_browser = :firefox' do
983
+ before { allow(settings).to receive(:sel_browser) { :firefox } }
984
+ it { is_expected.to be_falsey }
985
+ end
986
+ context 'settings.sel_browser is not specified' do
987
+ before { allow(settings).to receive(:sel_browser) { nil } }
988
+ it do
989
+ expect(log).to receive(:error).with(Howitzer::SelBrowserNotSpecifiedError, 'Please check your settings').once.and_call_original
990
+ expect { subject }.to raise_error(Howitzer::SelBrowserNotSpecifiedError)
991
+ end
992
+ end
993
+ end
994
+ context 'when selenium_driver? is FALSE' do
995
+ it { is_expected.to be_falsey }
996
+ end
997
+ end
998
+ end
999
+
1000
+ describe '#app_url' do
618
1001
  subject { app_url }
619
1002
  before do
620
1003
  allow(settings).to receive(:app_base_auth_login) { app_base_auth_login_setting }
@@ -623,123 +1006,124 @@ describe "Helpers" do
623
1006
  allow(settings).to receive(:app_host) { app_host_setting }
624
1007
  end
625
1008
  let(:app_protocol_setting) { nil }
626
- let(:app_host_setting) { "redmine.strongqa.com" }
627
- context "when login and password present" do
628
- let(:app_base_auth_login_setting) { "alex" }
629
- let(:app_base_auth_pass_setting) { "pa$$w0rd" }
630
- it{ expect(subject).to eq("http://alex:pa$$w0rd@redmine.strongqa.com") }
1009
+ let(:app_host_setting) { 'redmine.strongqa.com' }
1010
+ context 'when login and password present' do
1011
+ let(:app_base_auth_login_setting) { 'alex' }
1012
+ let(:app_base_auth_pass_setting) { 'pa$$w0rd' }
1013
+ it{ is_expected.to eq('http://alex:pa$$w0rd@redmine.strongqa.com') }
631
1014
  end
632
- context "when login and password blank" do
633
- let(:app_base_auth_login_setting) { "" }
634
- let(:app_base_auth_pass_setting) { "" }
635
- it{ expect(subject).to eq("http://redmine.strongqa.com") }
1015
+ context 'when login and password blank' do
1016
+ let(:app_base_auth_login_setting) { '' }
1017
+ let(:app_base_auth_pass_setting) { '' }
1018
+ it{ is_expected.to eq('http://redmine.strongqa.com') }
636
1019
  end
637
1020
  end
638
- describe "#app_base_url" do
1021
+
1022
+ describe '#app_base_url' do
639
1023
  subject { app_base_url(prefix) }
640
1024
  before do
641
1025
  allow(settings).to receive(:app_protocol) { app_protocol_setting }
642
1026
  allow(settings).to receive(:app_host) { app_host_setting }
643
1027
  end
644
1028
  let(:app_protocol_setting) { nil }
645
- let(:app_host_setting) { "redmine.strongqa.com" }
646
- context "when login and password present" do
647
- let(:prefix) { "alex:pa$$w0rd@" }
648
- it{ expect(subject).to eq("http://alex:pa$$w0rd@redmine.strongqa.com") }
1029
+ let(:app_host_setting) { 'redmine.strongqa.com' }
1030
+ context 'when login and password present' do
1031
+ let(:prefix) { 'alex:pa$$w0rd@' }
1032
+ it{ is_expected.to eq('http://alex:pa$$w0rd@redmine.strongqa.com') }
649
1033
  end
650
- context "when login and password blank" do
1034
+ context 'when login and password blank' do
651
1035
  let(:prefix) { nil }
652
- it{ expect(subject).to eq("http://redmine.strongqa.com") }
1036
+ it{ is_expected.to eq('http://redmine.strongqa.com') }
653
1037
  end
654
1038
  end
655
- describe "#duration" do
656
- context "when more than hour" do
657
- it{ expect(duration(10000)).to eq("[2h 46m 40s]") }
1039
+
1040
+ describe '#duration' do
1041
+ context 'when more than hour' do
1042
+ it{ expect(duration(10000)).to eq('[2h 46m 40s]') }
658
1043
  end
659
- context "when 1 hour exactly" do
660
- it{ expect(duration(3600)).to eq("[1h 0m 0s]") }
1044
+ context 'when 1 hour exactly' do
1045
+ it{ expect(duration(3600)).to eq('[1h 0m 0s]') }
661
1046
  end
662
- context "when 0 hours and more than minute" do
663
- it{ expect(duration(2000)).to eq("[33m 20s]") }
1047
+ context 'when 0 hours and more than minute' do
1048
+ it{ expect(duration(2000)).to eq('[33m 20s]') }
664
1049
  end
665
- context "when 1 minute exactly" do
666
- it{ expect(duration(60)).to eq("[1m 0s]") }
1050
+ context 'when 1 minute exactly' do
1051
+ it{ expect(duration(60)).to eq('[1m 0s]') }
667
1052
  end
668
- context "when less than minute" do
669
- it{ expect(duration(45)).to eq("[0m 45s]") }
1053
+ context 'when less than minute' do
1054
+ it{ expect(duration(45)).to eq('[0m 45s]') }
670
1055
  end
671
- context "when zero" do
672
- it{ expect(duration(0)).to eq("[0m 0s]") }
1056
+ context 'when zero' do
1057
+ it{ expect(duration(0)).to eq('[0m 0s]') }
673
1058
  end
674
1059
  end
675
- describe "#ri" do
1060
+
1061
+ describe '#ri' do
676
1062
  subject { ri 'boom' }
677
1063
  it { expect {subject}.to raise_error(RuntimeError, /boom/) }
678
1064
  end
1065
+
679
1066
  describe String do
680
- let(:page_name) { "my" }
1067
+ let(:page_name) { 'my' }
681
1068
  let(:page_object) { double }
682
- before { stub_const("MyPage", page_object) }
683
- describe "#open" do
1069
+ before { stub_const('MyPage', page_object) }
1070
+ describe '#open' do
684
1071
  subject { page_name.open(:exit) }
685
1072
  before do
686
1073
  expect(page_object).to receive(:open).with(:exit).once
687
1074
  end
688
- it { expect(subject).to be_nil }
1075
+ it { is_expected.to be_nil }
689
1076
  end
690
- describe "#given" do
1077
+ describe '#given' do
691
1078
  subject { page_name.given }
692
1079
  before do
693
1080
  allow(page_name).to receive(:as_page_class){ page_object }
694
1081
  expect(page_object).to receive(:given).once
695
1082
  end
696
- it { expect(subject).to be_nil }
1083
+ it { is_expected.to be_nil }
697
1084
  end
698
- describe "#wait_for_opened" do
1085
+ describe '#wait_for_opened' do
699
1086
  subject { page_name.wait_for_opened }
700
1087
  before do
701
1088
  allow(page_name).to receive(:as_page_class){ page_object }
702
1089
  expect(page_object).to receive(:wait_for_opened).once
703
1090
  end
704
- it { expect(subject).to be_nil }
1091
+ it { is_expected.to be_nil }
705
1092
  end
706
- describe "#as_page_class" do
1093
+ describe '#as_page_class' do
707
1094
  subject { page_name.as_page_class }
708
- context "when 1 word" do
709
- it { expect(subject).to eql(page_object) }
1095
+ context 'when 1 word' do
1096
+ it { is_expected.to eql(page_object) }
710
1097
  end
711
- context "when more 1 word" do
1098
+ context 'when more 1 word' do
712
1099
  let(:page_name) { 'my super mega' }
713
- before { stub_const("MySuperMegaPage", page_object) }
714
- it { expect(subject).to eql(page_object) }
1100
+ before { stub_const('MySuperMegaPage', page_object) }
1101
+ it { is_expected.to eql(page_object) }
715
1102
  end
716
-
717
- context "when plural word" do
1103
+ context 'when plural word' do
718
1104
  let(:page_name) { 'user notifications' }
719
- before { stub_const("UserNotificationsPage", page_object) }
720
- it { expect(subject).to eql(page_object) }
1105
+ before { stub_const('UserNotificationsPage', page_object) }
1106
+ it { is_expected.to eql(page_object) }
721
1107
  end
722
1108
  end
723
- describe "#as_email_class" do
1109
+ describe '#as_email_class' do
724
1110
  subject { email_name.as_email_class }
725
1111
  let(:my_email) { double }
726
- context "when 1 word" do
1112
+ context 'when 1 word' do
727
1113
  let(:email_name) { 'my' }
728
- before { stub_const("MyEmail", my_email) }
729
- it { expect(subject).to eql(my_email) }
1114
+ before { stub_const('MyEmail', my_email) }
1115
+ it { is_expected.to eql(my_email) }
730
1116
  end
731
-
732
- context "when more 1 word" do
1117
+ context 'when more 1 word' do
733
1118
  let(:email_name) { 'my super mega' }
734
- before { stub_const("MySuperMegaEmail", my_email) }
735
- it { expect(subject).to eql(my_email) }
1119
+ before { stub_const('MySuperMegaEmail', my_email) }
1120
+ it { is_expected.to eql(my_email) }
736
1121
  end
737
-
738
- context "when plural word" do
1122
+ context 'when plural word' do
739
1123
  let(:email_name) { 'email notifications' }
740
- before { stub_const("EmailNotificationsEmail", my_email) }
741
- it { expect(subject).to eql(my_email) }
1124
+ before { stub_const('EmailNotificationsEmail', my_email) }
1125
+ it { is_expected.to eql(my_email) }
742
1126
  end
743
1127
  end
744
1128
  end
745
- end
1129
+ end