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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc1ac662d4557b9818bec29117d6abc40cb11f96
|
4
|
+
data.tar.gz: 618b01ed2c8c6e6496917361a78e01f3b6a2e7c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd55d7c1210338f1075cba3e763c935cf31171656a72e96a5a58c22f0091693085cb134ff40896a44c849b70833b9afc368ba4c95aa10a95d074110a19be5196
|
7
|
+
data.tar.gz: 538c9f722ca137ec5ab14fb255a12ab6440d998a08fd738bdc73f845028291e810d02292273c832196766043ee21bb7e58ced10074703fa736d16956496afb45
|
data/lib/effective_test_bot.rb
CHANGED
@@ -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
|
-
"#{
|
177
|
+
"#{passed_tests_path}/passed_tests.txt"
|
172
178
|
end
|
173
179
|
|
174
180
|
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 =
|
21
|
+
config.fail_fast = false
|
22
22
|
|
23
23
|
# Fill form fields with these values
|
24
24
|
# Based on the input name
|
25
|
-
# :email => '
|
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
|
-
|
22
|
-
|
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',
|
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, **
|
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
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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!\
|
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(
|
51
|
+
assert(new_path.present?, "TestBotError: Generated polymorphic route new_#{[*controller_namespace, resource_name].compact.join('_')}_path is undefined. #{hint}")
|
51
52
|
|
52
|
-
visit(
|
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
|
-
|
60
|
+
assert_submit_input("TestBotError: Failed to find a visible input[type='submit'] on #{page.current_path}. #{hint}")
|
58
61
|
|
59
|
-
|
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.
|
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-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|