Last active
August 29, 2015 14:00
-
-
Save robmiller/11194161 to your computer and use it in GitHub Desktop.
mutant exception example
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
# foo.rb | |
def foo | |
@db = PStore.new(data_file) | |
rescue PStore::Error | |
raise DatabaseError.new("Database directory #{data_file} does not exist") | |
end | |
# foo_spec.rb | |
describe "#foo" do | |
it "should raise an error when database directory is inaccessible" do | |
expect { Database.new(nonexistent_dir) }.to raise_error(DatabaseError, | |
"Database directory #{nonexistent_dir} does not exist") | |
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
-rescue PStore::Error | |
+rescue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment