1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2018-10-27 10:48:09 +00:00
parent 970410c63c
commit ecc707e233

View file

@ -350,20 +350,20 @@ describe MSpecScript, "#entries" do
before :each do
@script = MSpecScript.new
File.stub(:expand_path).and_return("name")
File.stub(:realpath).and_return("name")
File.stub(:file?).and_return(false)
File.stub(:directory?).and_return(false)
end
it "returns the pattern in an array if it is a file" do
File.should_receive(:expand_path).with("file").and_return("file/expanded.rb")
File.should_receive(:realpath).with("file").and_return("file/expanded.rb")
File.should_receive(:file?).with("file/expanded.rb").and_return(true)
@script.entries("file").should == ["file/expanded.rb"]
end
it "returns Dir['pattern/**/*_spec.rb'] if pattern is a directory" do
File.should_receive(:directory?).with("name").and_return(true)
File.stub(:expand_path).and_return("name","name/**/*_spec.rb")
File.stub(:realpath).and_return("name", "name/**/*_spec.rb")
Dir.should_receive(:[]).with("name/**/*_spec.rb").and_return(["dir1", "dir2"])
@script.entries("name").should == ["dir1", "dir2"]
end
@ -382,13 +382,13 @@ describe MSpecScript, "#entries" do
it "returns the pattern in an array if it is a file" do
name = "#{@name}.rb"
File.should_receive(:expand_path).with(name).and_return(name)
File.should_receive(:realpath).with(name).and_return(name)
File.should_receive(:file?).with(name).and_return(true)
@script.entries("name.rb").should == [name]
end
it "returns Dir['pattern/**/*_spec.rb'] if pattern is a directory" do
File.stub(:expand_path).and_return(@name, @name+"/**/*_spec.rb")
File.stub(:realpath).and_return(@name, @name+"/**/*_spec.rb")
File.should_receive(:directory?).with(@name).and_return(true)
Dir.should_receive(:[]).with(@name + "/**/*_spec.rb").and_return(["dir1", "dir2"])
@script.entries("name").should == ["dir1", "dir2"]