Created
August 27, 2012 13:25
-
-
Save heronmedeiros/3488389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Klass | |
def self.foo | |
File.open "filename", "w" do |file| | |
file.write("text") | |
end | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "foo" do | |
it "should create 'filename' and put 'text' in it" do | |
file = mock('file') | |
File.should_receive(:open).with("filename", "w").and_yield(file) | |
file.should_receive(:write).with("text") | |
foo | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment