jordansissel / ruby-flores

Exploration in randomized testing (fuzzing, stress testing, etc)
Apache License 2.0
10 stars 4 forks source link

Move `file_helpers` from input beats to this library #6

Open ph opened 8 years ago

ph commented 8 years ago

When I have added client verification to beats in https://github.com/logstash-plugins/logstash-input-beats/pull/56, I have created a small rspec helper to work with files. This is handy since a lot of library requires physical certificate and key to work correctly.

Theses helpers make sure the file is created in a temporary file and the file is deleted when the test finished to run so it doesn't pollute your local file system.

You can use it like this in your code:

let_tmp_file(:mysuperfile_path) { "Hello world" )
# The variable :mysuperfile_path will now return a full path to the temporary file with the content passed as the block.