Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use "native" fakefs paths in tests

  • Loading branch information...
commit f8bbda595c387e58c924d6c6057831738ba24595 1 parent 3709c5e
@marcisme authored
View
6 spec/guard/copy/target_spec.rb
@@ -81,7 +81,7 @@ module Guard
dir('target')
target = Copy::Target.new('target')
target.resolve
- target.paths.should == ['target']
+ target.paths.should == [ffs('target')]
end
end
@@ -91,7 +91,7 @@ module Guard
dir('t2')
target = Copy::Target.new('t*')
target.resolve
- target.paths.should == ['t1', 't2']
+ target.paths.should == [ffs('t1'), ffs('t2')]
end
end
@@ -101,7 +101,7 @@ module Guard
dir('target_new', 2012)
target = Copy::Target.new('t*', :glob => :newest)
target.resolve
- target.paths.should == ['target_new']
+ target.paths.should == [ffs('target_new')]
end
end
View
20 spec/guard/copy_spec.rb
@@ -156,8 +156,8 @@ module Guard
UI.should_receive(:info).with("Guard::Copy will copy files from:")
UI.should_receive(:info).with(" source")
UI.should_receive(:info).with("to:")
- UI.should_receive(:info).with(" t1")
- UI.should_receive(:info).with(" t2")
+ UI.should_receive(:info).with(" #{ffs('t1')}")
+ UI.should_receive(:info).with(" #{ffs('t2')}")
guard.start
end
@@ -170,8 +170,8 @@ module Guard
UI.should_receive(:info).with("Guard::Copy will delete files removed from:")
UI.should_receive(:info).with(" source")
UI.should_receive(:info).with("from:")
- UI.should_receive(:info).with(" t1")
- UI.should_receive(:info).with(" t2")
+ UI.should_receive(:info).with(" #{ffs('t1')}")
+ UI.should_receive(:info).with(" #{ffs('t2')}")
UI.should_receive(:info).any_number_of_times # don't worry about unrelated info
guard.start
end
@@ -194,7 +194,7 @@ module Guard
dir('target')
guard = Copy.new([], :from => 'source', :to => 'target')
UI.should_receive(:error).with('Guard::Copy - cannot copy, directory path does not exist:')
- UI.should_receive(:error).with(' target/some/path/to/some')
+ UI.should_receive(:error).with(" #{ffs('target/some/path/to/some')}")
guard.start
expect {
guard.run_on_changes(['source/some/path/to/some/file'])
@@ -233,8 +233,8 @@ module Guard
dir('t2')
guard = Copy.new([], :from => 'source', :to => ['t1', 't2'], :verbose => true)
guard.start
- UI.should_receive(:info).with('copying to t1/foo')
- UI.should_receive(:info).with('copying to t2/foo')
+ UI.should_receive(:info).with("copying to #{ffs('t1/foo')}")
+ UI.should_receive(:info).with("copying to #{ffs('t2/foo')}")
guard.run_on_changes(['source/foo'])
end
@@ -260,7 +260,7 @@ module Guard
dir('target')
guard = Copy.new([], :from => 'source', :to => 'target', :delete => true)
UI.should_receive(:error).with("Guard::Copy - cannot delete, file does not exist:")
- UI.should_receive(:error).with(" target/foo")
+ UI.should_receive(:error).with(" #{ffs('target/foo')}")
guard.start
expect { guard.run_on_removals(['source/foo']) }.to throw_symbol(:task_has_failed)
end
@@ -315,8 +315,8 @@ module Guard
file('t2/foo')
guard = Copy.new([], :from => 'source', :to => ['t1', 't2'], :delete => true, :verbose => true)
guard.start
- UI.should_receive(:info).with('deleting t1/foo')
- UI.should_receive(:info).with('deleting t2/foo')
+ UI.should_receive(:info).with("deleting #{ffs('t1/foo')}")
+ UI.should_receive(:info).with("deleting #{ffs('t2/foo')}")
guard.run_on_removals(['source/foo'])
end
View
9 spec/spec_helper.rb
@@ -10,14 +10,15 @@
# we need to be able to set mtime for newest directory tests
attr_accessor :mtime
- # fakefs returns full paths, which is inconsistent with real globs
- def to_s
- name
- end
end
module FileHelpers
+ # convert the path to the fakefs path
+ def ffs(path)
+ File.join(File.expand_path(File.join('..', '..'), __FILE__), path)
+ end
+
def file(f)
dir(File.dirname(f))
FileUtils.touch(f)
Please sign in to comment.
Something went wrong with that request. Please try again.