effective_test_bot 0.5.5 → 0.5.6

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: 17d73d440defe13b300db9a9e3c40f2a53db6070
4
- data.tar.gz: 500b99c205884123bf7b9ce81e62f824d246f9b8
3
+ metadata.gz: cc1ac662d4557b9818bec29117d6abc40cb11f96
4
+ data.tar.gz: 618b01ed2c8c6e6496917361a78e01f3b6a2e7c6
5
5
  SHA512:
6
- metadata.gz: ad2a4c20896abdd48fdee19c8667dbd56fe636912f71dc4dd53bcb973540bf6d57926ebe3db010a5b7e05fe58615395ccd875d736dc03fcdbd49b0f973373917
7
- data.tar.gz: a5233b7717d68155472fe8abd6cce85bd4b1e1e5a26bb312f1aaa169d0d8599e62c628b0c43557244bc8780ee85d892482c9d7be7b287063ad8b22cdbee4a859
6
+ metadata.gz: fd55d7c1210338f1075cba3e763c935cf31171656a72e96a5a58c22f0091693085cb134ff40896a44c849b70833b9afc368ba4c95aa10a95d074110a19be5196
7
+ data.tar.gz: 538c9f722ca137ec5ab14fb255a12ab6440d998a08fd738bdc73f845028291e810d02292273c832196766043ee21bb7e58ced10074703fa736d16956496afb45
@@ -117,6 +117,8 @@ module EffectiveTestBot
117
117
  def self.save_passed_test(name)
118
118
  EffectiveTestBot.passed_tests[name] = true
119
119
 
120
+ Dir.mkdir(passed_tests_path) unless File.exists?(passed_tests_path)
121
+
120
122
  File.open(passed_tests_filename, 'w') do |file|
121
123
  passed_tests.each { |test_name, _| file.puts(test_name) }
122
124
  end
@@ -167,8 +169,12 @@ module EffectiveTestBot
167
169
  end.compact.sort
168
170
  end
169
171
 
172
+ def self.passed_tests_path
173
+ "#{Rails.root}/tmp/test_bot"
174
+ end
175
+
170
176
  def self.passed_tests_filename
171
- "#{Rails.root}/tmp/test_bot/passed_tests.txt"
177
+ "#{passed_tests_path}/passed_tests.txt"
172
178
  end
173
179
 
174
180
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '0.5.5'.freeze
2
+ VERSION = '0.5.6'.freeze
3
3
  end
@@ -18,11 +18,11 @@ if Rails.env.test?
18
18
  # ]
19
19
 
20
20
  # Exits immediately if there is a test failure
21
- config.fail_fast = true
21
+ config.fail_fast = false
22
22
 
23
23
  # Fill form fields with these values
24
24
  # Based on the input name
25
- # :email => 'somethign@soneone.com', 'user.last_name' => 'hlwerewr'
25
+ # :email => 'j.smith@example.com', 'user.last_name' => 'Smith'
26
26
  config.form_fills = {}
27
27
 
28
28
  # Should capybara generate a series of *.png screenshots as it goes through the test?
@@ -18,12 +18,13 @@ module TestBotable
18
18
 
19
19
  def devise_test(label: nil, **options)
20
20
  [:sign_up, :sign_in_valid, :sign_in_invalid].each do |test|
21
- options[:current_test] = label || test
22
- next if EffectiveTestBot.skip?(options[:current_test])
21
+ options_for_method = options.dup
22
+ options_for_method[:current_test] = label || test
23
+ next if EffectiveTestBot.skip?(options_for_method[:current_test])
23
24
 
24
- method_name = test_bot_method_name('devise_test', options[:current_test])
25
+ method_name = test_bot_method_name('devise_test', options_for_method[:current_test])
25
26
 
26
- define_method(method_name) { devise_action_test(test: test, **options) }
27
+ define_method(method_name) { devise_action_test(test: test, **options_for_method) }
27
28
  end
28
29
  end
29
30
 
@@ -38,26 +38,32 @@ module BaseTest
38
38
 
39
39
  # It doesn't exist, so lets go to the new page and submit a form to build one
40
40
  without_screenshots do
41
- new_resource_paths = [ # TODO: enumerate all controller namespaces instead of just admin
42
- (new_resource_path rescue nil),
43
- (new_polymorphic_path(resource) rescue nil),
44
- (new_polymorphic_path([:admin, resource]) rescue nil),
45
- (new_polymorphic_path([:members, resource]) rescue nil)
46
- ].compact
41
+ # TODO: enumerate all controller namespaces instead of just admin and members
42
+ new_path = (new_resource_path rescue nil)
43
+ new_path ||= (new_polymorphic_path(resource) rescue nil)
44
+ new_path ||= (new_polymorphic_path([:admin, resource]) rescue nil)
45
+ new_path ||= (new_polymorphic_path([:members, resource]) rescue nil)
47
46
 
48
- hint = "Unable to find_or_create_resource!\nEither fixture/seed an instance of #{resource_class} or ensure that submitting form#new_#{resource_name} on #{(new_resource_paths.first rescue nil) || 'the resource new page'} creates a new #{resource_name}"
47
+ hint = "Unable to find_or_create_resource!\n"
48
+ hint += "Either fixture/seed an instance of #{resource_class} or ensure that submitting form#new_#{resource_name} "
49
+ hint += "on #{(new_path rescue nil) || 'the resource new page'} creates a new #{resource_name}"
49
50
 
50
- assert(new_resource_paths.present?, "TestBotError: Generated polymorphic route new_#{[*controller_namespace, resource_name].compact.join('_')}_path is undefined. #{hint}")
51
+ assert(new_path.present?, "TestBotError: Generated polymorphic route new_#{[*controller_namespace, resource_name].compact.join('_')}_path is undefined. #{hint}")
51
52
 
52
- visit(new_resource_paths.first)
53
+ visit(new_path)
54
+ assert_no_exceptions
55
+ assert_page_status
53
56
 
54
57
  assert_form("form#new_#{resource_name}", "TestBotError: Failed to find form#new_#{resource_name}. #{hint}") unless test_bot_skip?(:form)
55
58
 
56
59
  within_if("form#new_#{resource_name}", !test_bot_skip?(:form)) do
57
- fill_form(resource_attributes)
60
+ assert_submit_input("TestBotError: Failed to find a visible input[type='submit'] on #{page.current_path}. #{hint}")
58
61
 
59
- assert_submit_input "TestBotError: Failed to find a visible input[type='submit'] on #{page.current_path}. #{hint}"
62
+ fill_form(resource_attributes)
60
63
  submit_novalidate_form
64
+
65
+ assert_no_exceptions
66
+ assert_page_status
61
67
  end
62
68
 
63
69
  obj = resource_class.last
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.5
4
+ version: 0.5.6
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-05-03 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails