78
79
80
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/tack/adapters/rspec_adapter.rb', line 78
def tests_for(file, pattern)
Spec::Runner.options.instance_variable_set(:@formatters, [Spec::Runner::Formatter::TackFormatter.new(Spec::Runner.options.formatter_options)])
Spec::Runner.options.instance_variable_set(:@example_groups, [])
Spec::Runner.options.instance_variable_set(:@files, [file])
Spec::Runner.options.instance_variable_set(:@files_loaded, false)
runner = Spec::Runner::ExampleGroupRunner.new(Spec::Runner.options)
runner.load_files([file])
example_groups = runner.send(:example_groups)
examples = example_groups.inject([]) do |arr, group|
arr += group.examples
end
examples.map {|example| [file, example.description]}.select {|file,description| description.match(pattern)}
end
|