spec/from_command_spec.rb in overapp-0.5.0 vs spec/from_command_spec.rb in overapp-0.5.1
- old
+ new
@@ -2,57 +2,48 @@
describe 'FromCommand' do
include_context "tmp dir"
include_context "output dir"
- let(:command) do
- "mkdir abc && cd abc && echo stuff > abc.txt"
- end
-
- let(:config_body) do
- "c.command '#{command}', :path => 'abc'"
- end
-
- before do
- File.create "#{tmp_dir}/place.txt","fun"
- end
-
let(:project) do
res = Overapp::Project.new(:path => tmp_dir)
res.stub(:config_body) { config_body }
res
end
- it 'runs' do
+ before do
+ File.create "#{tmp_dir}/place.txt","fun"
project.write_to! output_dir
- Dir["#{output_dir}/**/*.*"].sort.should == ['abc.txt','place.txt'].sort.map { |x| "#{output_dir}/#{x}" }
end
-end
-describe 'FromCommand2' do
- include_context "tmp dir"
- include_context "output dir"
-
- let(:command) do
- "echo stuff > abc.txt"
+ def files_should_equal(files)
+ Dir["#{output_dir}/**/*.*"].sort.should == files.sort.map { |x| "#{output_dir}/#{x}" }
end
- let(:config_body) do
- "c.command '#{command}'"
- end
+ describe "with subdir" do
+ let(:command) do
+ "mkdir abc && cd abc && echo stuff > abc.txt"
+ end
- before do
- File.create "#{tmp_dir}/place.txt","fun"
- end
+ let(:config_body) do
+ "c.command '#{command}', :path => 'abc'"
+ end
- let(:project) do
- res = Overapp::Project.new(:path => tmp_dir)
- res.stub(:config_body) { config_body }
- res
+ it 'has files' do
+ files_should_equal ['abc.txt','place.txt']
+ end
end
- it 'runs' do
- project.write_to! output_dir
- Dir["#{output_dir}/**/*.*"].sort.should == ['abc.txt','place.txt'].sort.map { |x| "#{output_dir}/#{x}" }
+ describe "at root" do
+ let(:command) do
+ "echo stuff > abc.txt"
+ end
+
+ let(:config_body) do
+ "c.command '#{command}'"
+ end
+
+ it 'has files' do
+ files_should_equal ['abc.txt','place.txt']
+ end
end
end
-