diff options
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 839e6125e..4cf376624 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -107,9 +107,14 @@ def file_fixture_name(file_name) return File.join(Spec::Runner.configuration.fixture_path, "files", file_name) end -def load_file_fixture(file_name) +def load_file_fixture(file_name, as_binary=false) file_name = file_fixture_name(file_name) - content = File.read(file_name) + content = File.open(file_name, 'r') do |file| + if as_binary + file.set_encoding(Encoding::BINARY) if file.respond_to?(:set_encoding) + end + file.read + end return content end |