Created
March 11, 2010 06:53
-
-
Save smtlaissezfaire/328919 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Spec | |
module Example | |
class ExampleGroupFactory | |
# Used to support spec/unit and spec/integration | |
def self.determine_superclass(opts) | |
spec_path = opts[:spec_path].to_s.gsub("/spec/unit", "/spec") | |
id = if opts[:type] | |
opts[:type] | |
elsif spec_path =~ /controller/ || spec_path =~ /spec\/integration\/routing_spec/ | |
:controller | |
elsif spec_path =~ /spec\/integration/ | |
:model | |
elsif spec_path =~ /spec(\\|\/)(#{@example_group_types.keys.join('|')})/ | |
$2 == '' ? nil : $2.to_sym | |
end | |
get(id) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment