Wednesday, 15 September 2010

ruby - Rspec raise_error within context doesn't seem to work -


wrote me this, and passed it.

  This raises a GitConfigNotFound error when the YAML config file can not be found 'Permitted (YAML). To get (: load_file) .with (Rails.root.join ('config', 'git_config.yml')) .and_raise (Errno :: ENOENT) Expected {described_class :: config}. Raise_error GitConfigNotFound End  

Then I put it in context to match my other tests and it failed. Formatted as shown below, does anyone have such insight that why is this happening?

  Reference 'A GitConfigNotFound will increase exceptions if the git config file is missing' before permitting (YAML). To obtain (: load_file) .with (Rails.root.join ('config', 'Git_config.yml')) .and_raise (Errno :: ENOENT) to end {{(described_class :: config.) Raise_error GitConfigNotFound}  

This is giving me this output, which I think it seems, but does not hold it for any reason:

  1) GitConfigsLoader will take exception to a GitConfigNotFound if the git config file is unavailable / error: it's {hope (description_class :: config). Raise_error} GitConfigNotFound: Error: git_config.yml not found. # ./lib/git_configs_loader.rb:9: 'Defend in Conflict' # ./lib/git_configs_loader.rb:7:in 'config' # ./spec/lib/git_configs_loader_spec.rb37:in` In Block (Level 3) & Lt; Top (required) & gt; 'Maybe this is what was meant by Peter Alfwin, but in the end I answered the answer in response to each other. I was using  expected {...}  instead of  expected (...) . Parents execute instantly and instantly kill and are not caught by  .to raise_exception . Executes the block to use the braces and allows  raise_error  to capture the error. 

  Reference 'When a git_config.yml file is not active' first allow ('YAML). To get (: load_file) .and_ridge (Errno :: ENOENT) it will end {hopefully {description_clash :: configuration}. Raise_exception GitConfigNotFound} Termination  

No comments:

Post a Comment