effective_test_bot 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8916fd859c891dfc94211148166080d47f389d6
4
- data.tar.gz: c169dfb60da9420fe436f9bf87aab60cc2e2b405
3
+ metadata.gz: 30419a4b996dc2b0178006e804e1a3ecec0857a2
4
+ data.tar.gz: e17ad442c55d3986c0eddbfb626d3f7972ab6398
5
5
  SHA512:
6
- metadata.gz: c783031691e9777190e9324df2095c804b9af0651003995eebbab47ca8c0e2d0ec3213745ded7fd9bfafa5b5c9aa657ec183c245d4cebf4e546dd331713eb1e9
7
- data.tar.gz: 93877759a09977b9417b4e8873be3481be89ca0eaf8d4a03e633dd7ae64734b825fa06aae6653f773b63351f9bf386a784e48e20009b5ddfb8a4ee3b5fb4d146
6
+ metadata.gz: c5588d9ffb6a02b72ea17b719d8af563fd235f694120445e559b5b651a7912686ef3d7d28d8cd108140054e931c1389e8a783a2c55b5b4aaef7ffb7f19aefdde
7
+ data.tar.gz: 40a99d2ff37fa7f84f2d01434968330d3a8ff915b76bb4402a229f6dfac44762aaa396b9a1a7d4fe50ac6336f0f79ab5442584d93e2ad1cae6cf4eb895f133b9
@@ -13,6 +13,7 @@ module EffectiveTestBot
13
13
  mattr_accessor :tour_mode_extreme
14
14
  mattr_accessor :animated_gif_delay
15
15
  mattr_accessor :animated_gif_background_color
16
+ mattr_accessor :backtrace_lines
16
17
 
17
18
  mattr_accessor :passed_tests # This isn't a config variable.
18
19
 
@@ -22,7 +22,7 @@ module EffectiveTestBot
22
22
  end
23
23
 
24
24
  def save(exception)
25
- lines = [exception.message] + exception.backtrace.first(12)
25
+ lines = [exception.message] + exception.backtrace.first(EffectiveTestBot.backtrace_lines)
26
26
 
27
27
  dir = File.join(Dir.pwd, 'tmp', 'test_bot')
28
28
  file = File.join(dir, 'exception.txt')
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '0.5.8'.freeze
2
+ VERSION = '0.5.9'.freeze
3
3
  end
@@ -20,6 +20,9 @@ if Rails.env.test?
20
20
  # Exits immediately if there is a test failure
21
21
  config.fail_fast = false
22
22
 
23
+ # Display x number of lines of a backtrace
24
+ config.backtrace_lines = 12
25
+
23
26
  # Fill form fields with these values
24
27
  # Based on the input name
25
28
  # :email => 'j.smith@example.com', 'user.last_name' => 'Smith'
@@ -52,5 +55,6 @@ if Rails.env.test?
52
55
  # bottom area filled by this color
53
56
  # For best appearance, have this match your site's background color
54
57
  config.animated_gif_background_color = 'white'
58
+
55
59
  end
56
60
  end
@@ -70,7 +70,7 @@ module EffectiveTestBotFormFiller
70
70
  skip_field_screenshot = false
71
71
 
72
72
  case [field.tag_name, field['type']].compact.join('_')
73
- when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_checkbox', 'input_radio', 'input_url'
73
+ when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_checkbox', 'input_radio', 'input_url', 'input_color'
74
74
  field.set(value_for_field(field, fills))
75
75
  when 'textarea'
76
76
  value = value_for_field(field, fills)
@@ -191,6 +191,9 @@ module EffectiveTestBotFormFiller
191
191
  when 'input_checkbox'
192
192
  value_for_input_checkbox_field(field, fill_value)
193
193
 
194
+ when 'input_color'
195
+ Faker::Color.hex_color
196
+
194
197
  when 'input_email'
195
198
  Faker::Internet.email
196
199
 
@@ -200,6 +203,7 @@ module EffectiveTestBotFormFiller
200
203
  else
201
204
  "#{File.dirname(__FILE__)}/../fixtures/logo.png"
202
205
  end
206
+
203
207
  when 'input_number'
204
208
  value_for_input_numeric_field(field, "input[type='number'][name$='[#{attribute}]']")
205
209
 
@@ -225,6 +229,7 @@ module EffectiveTestBotFormFiller
225
229
  @filled_country_fields = option.try(:value) if attribute == 'country_code' # So Postal Code can be set to a valid one
226
230
 
227
231
  option.try(:text) || ''
232
+
228
233
  when 'input_tel'
229
234
  d = 10.times.map { DIGITS.sample }
230
235
  d[0] + d[1] + d[2] + '-' + d[3] + d[4] + d[5] + '-' + d[6] + d[7] + d[8] + d[9]
@@ -241,9 +246,9 @@ module EffectiveTestBotFormFiller
241
246
  end
242
247
 
243
248
  def value_for_input_checkbox_field(field, fill_value)
244
- if ::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(fill_value)
249
+ if truthy?(fill_value)
245
250
  true
246
- elsif ::ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.include?(fill_value)
251
+ elsif falsey?(fill_value)
247
252
  false
248
253
  elsif fill_value.present?
249
254
  fill_values = Array(fill_value) # Allow an array of fill values to be passed
@@ -393,4 +398,20 @@ module EffectiveTestBotFormFiller
393
398
  (@test_bot_excluded_fields_xpath.present? && field.path.include?(@test_bot_excluded_fields_xpath))
394
399
  end
395
400
 
401
+ def truthy?(value)
402
+ if defined?(::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES) # Rails 5
403
+ ::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(value)
404
+ else
405
+ ActiveRecord::Type::Boolean.new.cast(value)
406
+ end
407
+ end
408
+
409
+ def falsey?(value)
410
+ if defined?(::ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES) # Rails 5
411
+ ::ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.include?(value)
412
+ else
413
+ ::ActiveRecord::Type::Boolean.new.cast(value) == false
414
+ end
415
+ end
416
+
396
417
  end
@@ -101,7 +101,7 @@ module BaseTest
101
101
  end
102
102
 
103
103
  def new_resource_path # new
104
- path = new_polymorphic_path([*controller_namespace, resource])
104
+ new_polymorphic_path([*controller_namespace, resource_class])
105
105
  end
106
106
 
107
107
  def edit_resource_path(resource) # edit
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_test_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-29 00:00:00.000000000 Z
11
+ date: 2016-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails