Permalink
Browse files

config tweaks

  • Loading branch information...
dchelimsky committed Apr 24, 2011
1 parent c1b8bca commit 52012b856bade49c7dbba6550ecac9691954c8ea
Showing with 10 additions and 22 deletions.
  1. +1 −0 .rspec
  2. +0 −22 spec/spec_helper.rb
  3. +9 −0 spec/support/matchers.rb
View
1 .rspec
@@ -0,0 +1 @@
+--color
View
@@ -9,35 +9,13 @@ class Application < ::Rails::Application
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
-# TODO - most of this is borrowed from rspec-core's spec_helper - should
-# be extracted to something we can use here
-def in_editor?
- ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
-end
-
class RSpec::Core::ExampleGroup
def self.run_all(reporter=nil)
run(reporter || RSpec::Mocks::Mock.new('reporter').as_null_object)
end
end
-module MatchesForRSpecRailsSpecs
- extend RSpec::Matchers::DSL
-
- matcher :be_included_in_files_in do |path|
- match do |mod|
- stub_metadata(
- :example_group => {:file_path => "#{path}whatever_spec.rb:15"}
- )
- group = RSpec::Core::ExampleGroup.describe
- group.included_modules.include?(mod)
- end
- end
-end
-
RSpec.configure do |c|
- c.include MatchesForRSpecRailsSpecs
- c.color_enabled = !in_editor?
c.before(:each) do
@real_world = RSpec.world
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)
View
@@ -0,0 +1,9 @@
+RSpec::Matchers::define :be_included_in_files_in do |path|
+ match do |mod|
+ stub_metadata(
+ :example_group => {:file_path => "#{path}whatever_spec.rb:15"}
+ )
+ group = RSpec::Core::ExampleGroup.describe
+ group.included_modules.include?(mod)
+ end
+end

0 comments on commit 52012b8

Please sign in to comment.