spreewald 1.5.5 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +113 -97
- data/Rakefile +3 -3
- data/bin/spreewald +64 -23
- data/features/binary.feature +246 -0
- data/features/support/aruba.rb +1 -0
- data/lib/spreewald/web_steps.rb +1 -3
- data/lib/spreewald_support/version.rb +1 -1
- data/spreewald.gemspec +10 -0
- data/support/parser.rb +25 -0
- data/support/paths_manager.rb +35 -0
- data/support/step_definition.rb +46 -0
- data/support/step_definition_file.rb +50 -0
- data/support/step_manager.rb +32 -0
- data/tests/rails-2.3/app +1 -0
- data/tests/rails-2.3/config/cucumber.yml +1 -0
- data/tests/rails-2.3/config/database.yml +1 -0
- data/tests/rails-2.3/db +1 -0
- data/tests/rails-2.3/features/shared +1 -0
- data/tests/rails-2.3/features/support/paths.rb +1 -0
- data/tests/rails-2.3/features/support/selectors.rb +1 -0
- data/tests/rails-2.3/public +1 -0
- data/tests/rails-3.2/capybara-1/app +1 -0
- data/tests/rails-3.2/capybara-1/config/cucumber.yml +1 -0
- data/tests/rails-3.2/capybara-1/config/database.yml +1 -0
- data/tests/rails-3.2/capybara-1/db +1 -0
- data/tests/rails-3.2/capybara-1/features/shared +1 -0
- data/tests/rails-3.2/capybara-1/features/support/paths.rb +1 -0
- data/tests/rails-3.2/capybara-1/features/support/selectors.rb +1 -0
- data/tests/rails-3.2/capybara-1/public +1 -0
- data/tests/rails-3.2/capybara-2/Rakefile +1 -0
- data/tests/rails-3.2/capybara-2/app +1 -0
- data/tests/rails-3.2/capybara-2/config +1 -0
- data/tests/rails-3.2/capybara-2/db +1 -0
- data/tests/rails-3.2/capybara-2/features +1 -0
- data/tests/rails-3.2/capybara-2/public +1 -0
- metadata +165 -67
- data/support/documentation_generator.rb +0 -119
- data/tests/rails-2.3/config/cucumber.yml +0 -2
- data/tests/rails-2.3/config/database.yml +0 -3
- data/tests/rails-2.3/features/support/paths.rb +0 -16
- data/tests/rails-2.3/features/support/selectors.rb +0 -43
- data/tests/rails-3.2/capybara-1/config/cucumber.yml +0 -2
- data/tests/rails-3.2/capybara-1/config/database.yml +0 -3
- data/tests/rails-3.2/capybara-1/features/support/paths.rb +0 -16
- data/tests/rails-3.2/capybara-1/features/support/selectors.rb +0 -43
- data/tests/rails-3.2/capybara-2/Rakefile +0 -18
@@ -1,119 +0,0 @@
|
|
1
|
-
module DocumentationGenerator
|
2
|
-
|
3
|
-
module CommentExtractor
|
4
|
-
def parse_and_format_comment(comment)
|
5
|
-
comment.gsub!(/.*coding:.*UTF-8.*/, '')
|
6
|
-
comment.strip!
|
7
|
-
comment_lines = comment.split("\n").take_while { |line| line =~ /^\s*#/ }
|
8
|
-
comment_lines && comment_lines.join("\n").gsub(/^\s*# ?/, '')
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class StepDefinition
|
13
|
-
|
14
|
-
extend CommentExtractor
|
15
|
-
|
16
|
-
def initialize(definition, comment = nil)
|
17
|
-
@definition = definition
|
18
|
-
@comment = comment
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.try_and_parse(code)
|
22
|
-
definition = code[/^\s*((When|Then|Given|AfterStep).*)do/, 1]
|
23
|
-
return unless definition
|
24
|
-
comment = parse_and_format_comment(code)
|
25
|
-
return if comment =~ /\bnodoc\b/
|
26
|
-
new(definition.strip, comment)
|
27
|
-
end
|
28
|
-
|
29
|
-
def format
|
30
|
-
<<-TEXT
|
31
|
-
* **#{format_definition}**
|
32
|
-
|
33
|
-
#{@comment.gsub(/^/, ' ')}
|
34
|
-
TEXT
|
35
|
-
end
|
36
|
-
|
37
|
-
def format_definition
|
38
|
-
if @definition =~ /AfterStep/
|
39
|
-
@definition[/@\w*/]
|
40
|
-
else
|
41
|
-
capture_groups = %w[([^\"]*) ([^"]*) (.*) (.*?) [^"]+ ([^\"]+) ([^']*) ([^/]*) (.+) (.*[^:])]
|
42
|
-
capture_groups.map! &Regexp.method(:escape)
|
43
|
-
|
44
|
-
@definition.
|
45
|
-
gsub('/^', '').
|
46
|
-
gsub('$/', '').
|
47
|
-
gsub(' ?', ' ').
|
48
|
-
gsub('(?:|I )', 'I ').
|
49
|
-
gsub('?:', '').
|
50
|
-
gsub(Regexp.new(capture_groups.join '|'), '...').
|
51
|
-
gsub(/\\\//, '/')
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
class StepDefinitionFile
|
57
|
-
|
58
|
-
FILE_COMMENT_END = 'FILE_COMMENT_END'
|
59
|
-
|
60
|
-
include CommentExtractor
|
61
|
-
|
62
|
-
def initialize(filename)
|
63
|
-
@filename = filename
|
64
|
-
@code = File.read(filename)
|
65
|
-
@steps = []
|
66
|
-
extract_comment
|
67
|
-
add_steps
|
68
|
-
end
|
69
|
-
|
70
|
-
def extract_comment
|
71
|
-
if @code.include?(FILE_COMMENT_END)
|
72
|
-
file_comment = @code.split(FILE_COMMENT_END).first
|
73
|
-
@comment = parse_and_format_comment(file_comment)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def add_steps
|
78
|
-
@code.split("\n\n").each do |block|
|
79
|
-
step = StepDefinition.try_and_parse(block)
|
80
|
-
if step
|
81
|
-
@steps << step
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def format
|
87
|
-
<<-TEXT
|
88
|
-
### #{format_filename}
|
89
|
-
|
90
|
-
#{@comment}
|
91
|
-
|
92
|
-
#{format_steps}
|
93
|
-
TEXT
|
94
|
-
end
|
95
|
-
|
96
|
-
def format_filename
|
97
|
-
@filename.split('/').last
|
98
|
-
end
|
99
|
-
|
100
|
-
def format_steps
|
101
|
-
@steps.collect { |step| step.format }.join("\n\n")
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
class StepDefinitionsDirectory
|
106
|
-
def initialize(directory)
|
107
|
-
@step_definition_files = []
|
108
|
-
Dir["#{directory}/*.rb"].to_a.sort.each do |filename|
|
109
|
-
next if filename =~ /all_steps/
|
110
|
-
@step_definition_files << StepDefinitionFile.new(filename)
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
def format
|
115
|
-
@step_definition_files.collect { |step_definition_file| step_definition_file.format }.join("\n\n")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
|
3
|
-
def path_to(page_name)
|
4
|
-
case page_name
|
5
|
-
when /^"(.*)"$/
|
6
|
-
$1
|
7
|
-
|
8
|
-
else
|
9
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
10
|
-
"Now, go and add a mapping in #{__FILE__}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
World(NavigationHelpers)
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module HtmlSelectorsHelpers
|
2
|
-
# Maps a name to a selector. Used primarily by the
|
3
|
-
#
|
4
|
-
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
-
#
|
6
|
-
# step definitions in web_steps.rb
|
7
|
-
#
|
8
|
-
def selector_for(locator)
|
9
|
-
case locator
|
10
|
-
|
11
|
-
when /^a panel?$/
|
12
|
-
'.panel'
|
13
|
-
|
14
|
-
when /^the timeline?$/
|
15
|
-
'.timeline'
|
16
|
-
|
17
|
-
# Add more mappings here.
|
18
|
-
# Here is an example that pulls values out of the Regexp:
|
19
|
-
#
|
20
|
-
# when /^the (notice|error|info) flash$/
|
21
|
-
# ".flash.#{$1}"
|
22
|
-
|
23
|
-
# You can also return an array to use a different selector
|
24
|
-
# type, like:
|
25
|
-
#
|
26
|
-
# when /the header/
|
27
|
-
# [:xpath, "//header"]
|
28
|
-
|
29
|
-
# This allows you to provide a quoted selector as the scope
|
30
|
-
# for "within" steps as was previously the default for the
|
31
|
-
# web steps:
|
32
|
-
when /^"(.+)"$/
|
33
|
-
$1
|
34
|
-
|
35
|
-
else
|
36
|
-
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
37
|
-
"Now, go and add a mapping in #{__FILE__}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
World(HtmlSelectorsHelpers)
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module NavigationHelpers
|
2
|
-
|
3
|
-
def path_to(page_name)
|
4
|
-
case page_name
|
5
|
-
when /^"(.*)"$/
|
6
|
-
$1
|
7
|
-
|
8
|
-
else
|
9
|
-
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
10
|
-
"Now, go and add a mapping in #{__FILE__}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
World(NavigationHelpers)
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module HtmlSelectorsHelpers
|
2
|
-
# Maps a name to a selector. Used primarily by the
|
3
|
-
#
|
4
|
-
# When /^(.+) within (.+)$/ do |step, scope|
|
5
|
-
#
|
6
|
-
# step definitions in web_steps.rb
|
7
|
-
#
|
8
|
-
def selector_for(locator)
|
9
|
-
case locator
|
10
|
-
|
11
|
-
when /^a panel?$/
|
12
|
-
'.panel'
|
13
|
-
|
14
|
-
when /^the timeline?$/
|
15
|
-
'.timeline'
|
16
|
-
|
17
|
-
# Add more mappings here.
|
18
|
-
# Here is an example that pulls values out of the Regexp:
|
19
|
-
#
|
20
|
-
# when /^the (notice|error|info) flash$/
|
21
|
-
# ".flash.#{$1}"
|
22
|
-
|
23
|
-
# You can also return an array to use a different selector
|
24
|
-
# type, like:
|
25
|
-
#
|
26
|
-
# when /the header/
|
27
|
-
# [:xpath, "//header"]
|
28
|
-
|
29
|
-
# This allows you to provide a quoted selector as the scope
|
30
|
-
# for "within" steps as was previously the default for the
|
31
|
-
# web steps:
|
32
|
-
when /^"(.+)"$/
|
33
|
-
$1
|
34
|
-
|
35
|
-
else
|
36
|
-
raise "Can't find mapping from \"#{locator}\" to a selector.\n" +
|
37
|
-
"Now, go and add a mapping in #{__FILE__}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
World(HtmlSelectorsHelpers)
|
@@ -1,18 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
require 'cucumber/rake/task'
|
3
|
-
|
4
|
-
desc 'Default: Run all specs for a specific rails version.'
|
5
|
-
task :default => :features
|
6
|
-
|
7
|
-
desc 'Run all specs for rails 3.2'
|
8
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
9
|
-
feature = if ENV['SINGLE_FEATURE']
|
10
|
-
"../../shared/features/shared/#{ ENV['SINGLE_FEATURE'] }"
|
11
|
-
else
|
12
|
-
'features/shared'
|
13
|
-
end
|
14
|
-
|
15
|
-
# tell cucumber where it finds it files (subdirectories and symlinks are confusing it)
|
16
|
-
t.cucumber_opts = "--require features --require features/shared #{feature}"
|
17
|
-
end
|
18
|
-
|