diff options
Diffstat (limited to 'spec/scripts/lib/glfm/shared_spec.rb')
-rw-r--r-- | spec/scripts/lib/glfm/shared_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/scripts/lib/glfm/shared_spec.rb b/spec/scripts/lib/glfm/shared_spec.rb index f6792b93718..3ce9d44ba3d 100644 --- a/spec/scripts/lib/glfm/shared_spec.rb +++ b/spec/scripts/lib/glfm/shared_spec.rb @@ -9,6 +9,16 @@ RSpec.describe Glfm::Shared do end.new end + describe '#write_file' do + it 'works' do + filename = Dir::Tmpname.create('basename') do |path| + instance.write_file(path, 'test') + end + + expect(File.read(filename)).to eq 'test' + end + end + describe '#run_external_cmd' do it 'works' do expect(instance.run_external_cmd('echo "hello"')).to eq("hello\n") @@ -24,6 +34,14 @@ RSpec.describe Glfm::Shared do end end + describe '#dump_yaml_with_formatting' do + it 'works' do + hash = { a: 'b' } + yaml = instance.dump_yaml_with_formatting(hash, literal_scalars: true) + expect(yaml).to eq("---\na: |-\n b\n") + end + end + describe '#output' do # NOTE: The #output method is normally always mocked, to prevent output while the specs are # running. However, in order to provide code coverage for the method, we have to invoke |