Created
June 8, 2013 16:47
-
-
Save brianewing/5735832 to your computer and use it in GitHub Desktop.
RSpec testing the parsing of various YML config options taking advantage of Ruby heredoc syntax with a block
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
# helper | |
def with_stubbed_yml_config(yml, &block) | |
# stub, yield, unstub | |
end | |
# in examples.. | |
with_stubbed_yml_config(<<-YML) { url.should == 'http://test:5984' } | |
test: | |
:host: test | |
YML | |
with_stubbed_yml_config(<<-YML) { url.should == 'https://foo:bar@test:5984' } | |
test: | |
:host: test | |
:port: 5984 | |
:ssl: true | |
:username: foo | |
:password: bar | |
YML |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment