mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 09:40:13 +01:00
Added Rspec and Webrat plugins and started porting Selenium on Rails tests to Rspec Plain Text Stories driving Webrat driving Selenium.
This commit is contained in:
parent
0600756bbf
commit
0f7d6f7a1d
602 changed files with 47788 additions and 29 deletions
44
vendor/plugins/rspec/lib/spec/example/example_matcher.rb
vendored
Executable file
44
vendor/plugins/rspec/lib/spec/example/example_matcher.rb
vendored
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
module Spec
|
||||
module Example
|
||||
class ExampleMatcher
|
||||
def initialize(example_group_description, example_name)
|
||||
@example_group_description = example_group_description
|
||||
@example_name = example_name
|
||||
end
|
||||
|
||||
def matches?(specified_examples)
|
||||
specified_examples.each do |specified_example|
|
||||
return true if matches_literal_example?(specified_example) || matches_example_not_considering_modules?(specified_example)
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
protected
|
||||
def matches_literal_example?(specified_example)
|
||||
specified_example =~ /(^#{example_group_regex} #{example_regexp}$|^#{example_group_regex}$|^#{example_group_with_before_all_regexp}$|^#{example_regexp}$)/
|
||||
end
|
||||
|
||||
def matches_example_not_considering_modules?(specified_example)
|
||||
specified_example =~ /(^#{example_group_regex_not_considering_modules} #{example_regexp}$|^#{example_group_regex_not_considering_modules}$|^#{example_regexp}$)/
|
||||
end
|
||||
|
||||
def example_group_regex
|
||||
Regexp.escape(@example_group_description)
|
||||
end
|
||||
|
||||
def example_group_with_before_all_regexp
|
||||
Regexp.escape("#{@example_group_description} before(:all)")
|
||||
end
|
||||
|
||||
def example_group_regex_not_considering_modules
|
||||
Regexp.escape(@example_group_description.split('::').last)
|
||||
end
|
||||
|
||||
def example_regexp
|
||||
Regexp.escape(@example_name)
|
||||
end
|
||||
end
|
||||
|
||||
ExampleGroupMethods.matcher_class = ExampleMatcher
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue