Skip to content

Commit 52012b8

Browse files
committed
config tweaks
1 parent c1b8bca commit 52012b8

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

.rspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--color

spec/spec_helper.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,13 @@ class Application < ::Rails::Application
99

1010
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
1111

12-
# TODO - most of this is borrowed from rspec-core's spec_helper - should
13-
# be extracted to something we can use here
14-
def in_editor?
15-
ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
16-
end
17-
1812
class RSpec::Core::ExampleGroup
1913
def self.run_all(reporter=nil)
2014
run(reporter || RSpec::Mocks::Mock.new('reporter').as_null_object)
2115
end
2216
end
2317

24-
module MatchesForRSpecRailsSpecs
25-
extend RSpec::Matchers::DSL
26-
27-
matcher :be_included_in_files_in do |path|
28-
match do |mod|
29-
stub_metadata(
30-
:example_group => {:file_path => "#{path}whatever_spec.rb:15"}
31-
)
32-
group = RSpec::Core::ExampleGroup.describe
33-
group.included_modules.include?(mod)
34-
end
35-
end
36-
end
37-
3818
RSpec.configure do |c|
39-
c.include MatchesForRSpecRailsSpecs
40-
c.color_enabled = !in_editor?
4119
c.before(:each) do
4220
@real_world = RSpec.world
4321
RSpec.instance_variable_set(:@world, RSpec::Core::World.new)

spec/support/matchers.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
RSpec::Matchers::define :be_included_in_files_in do |path|
2+
match do |mod|
3+
stub_metadata(
4+
:example_group => {:file_path => "#{path}whatever_spec.rb:15"}
5+
)
6+
group = RSpec::Core::ExampleGroup.describe
7+
group.included_modules.include?(mod)
8+
end
9+
end

0 commit comments

Comments
 (0)