Class: Screw::Driver::Suite
- Inherits:
-
Object
- Object
- Screw::Driver::Suite
show all
- Includes:
- Rails
- Defined in:
- lib/suite.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Rails
#generate_rails_urls, #rails?, #rails_urls
Constructor Details
#initialize(context, args) ⇒ Suite
Returns a new instance of Suite.
12
13
14
15
16
|
# File 'lib/suite.rb', line 12
def initialize(context, args)
@context = context
parse_args(args)
reset!
end
|
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
10
11
12
|
# File 'lib/suite.rb', line 10
def context
@context
end
|
#failures ⇒ Object
Returns the value of attribute failures.
10
11
12
|
# File 'lib/suite.rb', line 10
def failures
@failures
end
|
#load_paths ⇒ Object
Returns the value of attribute load_paths.
10
11
12
|
# File 'lib/suite.rb', line 10
def load_paths
@load_paths
end
|
#path ⇒ Object
Returns the value of attribute path.
10
11
12
|
# File 'lib/suite.rb', line 10
def path
@path
end
|
#test_count ⇒ Object
Returns the value of attribute test_count.
10
11
12
|
# File 'lib/suite.rb', line 10
def test_count
@test_count
end
|
Instance Method Details
#browser ⇒ Object
55
56
57
|
# File 'lib/suite.rb', line 55
def browser
@browser
end
|
#exit ⇒ Object
67
68
69
70
|
# File 'lib/suite.rb', line 67
def exit
browser.kill
exit! failures.empty? ? 0 : 1
end
|
#failed!(result) ⇒ Object
22
23
24
25
|
# File 'lib/suite.rb', line 22
def failed!(result)
@test_count += 1
@failures << result
end
|
#fixtures? ⇒ Boolean
63
64
65
|
# File 'lib/suite.rb', line 63
def fixtures?
File.exists?(File.join(working_directory, 'fixtures'))
end
|
#generate_urls ⇒ Object
36
37
38
39
40
41
|
# File 'lib/suite.rb', line 36
def generate_urls
generate_js_urls
generate_css_urls
generate_rails_urls if rails?
generate_fixture_urls if fixtures?
end
|
#link_urls ⇒ Object
47
48
49
|
# File 'lib/suite.rb', line 47
def link_urls
doc.search('link').map { |script| script['href'] }.compact
end
|
#passed! ⇒ Object
18
19
20
|
# File 'lib/suite.rb', line 18
def passed!
@test_count += 1
end
|
#reset! ⇒ Object
27
28
29
30
|
# File 'lib/suite.rb', line 27
def reset!
@test_count = 0
@failures = []
end
|
#script_urls ⇒ Object
43
44
45
|
# File 'lib/suite.rb', line 43
def script_urls
doc.search('script').map { |script| script['src'] }.compact
end
|
#server? ⇒ Boolean
59
60
61
|
# File 'lib/suite.rb', line 59
def server?
@server
end
|
#to_s ⇒ Object
51
52
53
|
# File 'lib/suite.rb', line 51
def to_s
doc.to_html
end
|
#working_directory ⇒ Object
32
33
34
|
# File 'lib/suite.rb', line 32
def working_directory
File.dirname(@path)
end
|
#write_dot!(str) ⇒ Object
72
73
74
75
|
# File 'lib/suite.rb', line 72
def write_dot!(str)
$stdout.print(str)
$stdout.flush
end
|