File: dumper_spec.rb

package info (click to toggle)
ruby-nenv 0.3.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: ruby: 517; sh: 4; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'yaml'

require 'nenv/environment/dumper'

RSpec.describe Nenv::Environment::Dumper do
  subject { described_class.setup.(value) }

  context "with \"abc\"" do
    let(:value) { 'abc' }
    it { is_expected.to eq('abc') }
  end

  context 'with 123' do
    let(:value) { 123 }
    it { is_expected.to eq('123') }
  end

  context 'with nil' do
    let(:value) { nil }
    it { is_expected.to eq(nil) }
  end

  context 'with a block' do
    subject do
      described_class.setup { |data| YAML.dump(data) }.(value)
    end

    context 'with a yaml string' do
      let(:value) { { foo: 3 } }
      let(:yaml) { "---\n:foo: 3\n" }
      it { is_expected.to eq(yaml) }
    end
  end
end