Pauli''s List Subscriptions
2006-Oct-12 21:26 UTC
[Rspec-users] how to spec elements of config file usage
Hi! I''m pretty newbie in Ruby and certainly in rspec. I''m writing a wrapper to a 3rd party API in Ruby, and will use a config file to persist the API user keys. In setting up my specs I want to say things like: "should raise exception if config file not found" "should raise exception if config file does not contain key" I figure that I''ll swap config files in the beginning of each spec. If I ''require rake'' in my spec script, I''ll be able to use the File methods from rake to swap out versions of my config file - right? Any reason not to do it that way, i.e. some other Ruby library is better? Other recommended methods to handle specs around presence / contents of file system objects? Thanks, Pauli