Browse files

Remove stubbing from integration test.

  • Loading branch information...
1 parent 9d15848 commit 4178d5c525aba9e70edc11b6245a6c20de3d5107 @xaviershay xaviershay committed Feb 5, 2013
Showing with 15 additions and 9 deletions.
  1. +9 −9 spec/rake_task_spec.rb
  2. +6 −0 spec/spec_helper.rb
View
18 spec/rake_task_spec.rb
@@ -48,19 +48,19 @@ def violations
end
it 'defaults to using a canefile without a block' do
- conf = "--gte 90,99"
- conf_file = make_file conf
+ in_tmp_dir do
+ conf = "--gte 90,99"
+ conf_file = File.open('.cane', 'w') {|f| f.write conf }
- Cane::File.stub(exists?: true, contents: File.read(conf_file))
+ task = Cane::RakeTask.new(:canefile_quality)
- task = Cane::RakeTask.new(:canefile_quality)
+ task.should_receive(:abort)
+ out = capture_stdout do
+ Rake::Task['canefile_quality'].invoke
+ end
- task.should_receive(:abort)
- out = capture_stdout do
- Rake::Task['canefile_quality'].invoke
+ out.should include("Quality threshold crossed")
end
-
- out.should include("Quality threshold crossed")
end
after do
View
6 spec/spec_helper.rb
@@ -28,6 +28,12 @@ def make_file(content)
tempfile.path
end
+def in_tmp_dir(&block)
+ Dir.mktmpdir do |dir|
+ Dir.chdir(dir, &block)
+ end
+end
+
RSpec::Matchers.define :have_violation do |label|
match do |check|
violations = check.violations

0 comments on commit 4178d5c

Please sign in to comment.