summaryrefslogtreecommitdiff
path: root/spec/mspec/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mspec/spec')
-rw-r--r--spec/mspec/spec/helpers/suppress_warning_spec.rb19
-rw-r--r--spec/mspec/spec/utils/script_spec.rb13
2 files changed, 26 insertions, 6 deletions
diff --git a/spec/mspec/spec/helpers/suppress_warning_spec.rb b/spec/mspec/spec/helpers/suppress_warning_spec.rb
new file mode 100644
index 0000000000..d16361fa55
--- /dev/null
+++ b/spec/mspec/spec/helpers/suppress_warning_spec.rb
@@ -0,0 +1,19 @@
+require 'spec_helper'
+require 'mspec/guards'
+require 'mspec/helpers'
+
+describe Object, "#suppress_warning" do
+ it "hides warnings" do
+ suppress_warning do
+ warn "should not be shown"
+ end
+ end
+
+ it "yields the block" do
+ a = 0
+ suppress_warning do
+ a = 1
+ end
+ a.should == 1
+ end
+end
diff --git a/spec/mspec/spec/utils/script_spec.rb b/spec/mspec/spec/utils/script_spec.rb
index 62f6787acd..20b5d293b0 100644
--- a/spec/mspec/spec/utils/script_spec.rb
+++ b/spec/mspec/spec/utils/script_spec.rb
@@ -356,9 +356,9 @@ describe MSpecScript, "#entries" do
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")
- File.should_receive(:file?).with("file/expanded").and_return(true)
- @script.entries("file").should == ["file/expanded"]
+ File.should_receive(:expand_path).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
@@ -381,9 +381,10 @@ describe MSpecScript, "#entries" do
end
it "returns the pattern in an array if it is a file" do
- File.should_receive(:expand_path).with(@name).and_return(@name)
- File.should_receive(:file?).with(@name).and_return(true)
- @script.entries("name").should == [@name]
+ name = "#{@name}.rb"
+ File.should_receive(:expand_path).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