File: tracker_spec.rb

package info (click to toggle)
ruby-knapsack 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,092 kB
  • sloc: ruby: 2,883; makefile: 4
file content (51 lines) | stat: -rw-r--r-- 1,438 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
describe Knapsack::Config::Tracker do
  describe '.enable_time_offset_warning' do
    subject { described_class.enable_time_offset_warning }
    it { should be true }
  end

  describe '.time_offset_in_seconds' do
    subject { described_class.time_offset_in_seconds }
    it { should eql 30 }
  end

  describe '.generate_report' do
    subject { described_class.generate_report }

    context 'when ENV exists' do
      it 'should be true when KNAPSACK_GENERATE_REPORT=true' do
        with_env 'KNAPSACK_GENERATE_REPORT' => 'true' do
          expect(subject).to eq(true)
        end
      end

      it 'should be true when KNAPSACK_GENERATE_REPORT=0' do
        with_env 'KNAPSACK_GENERATE_REPORT' => '0' do
          expect(subject).to eq(true)
        end
      end

      it 'should be false when KNAPSACK_GENERATE_REPORT is ""' do
        with_env 'KNAPSACK_GENERATE_REPORT' => '' do
          expect(subject).to eq(false)
        end
      end

      it 'should be false when KNAPSACK_GENERATE_REPORT is "false"' do
        with_env 'KNAPSACK_GENERATE_REPORT' => 'false' do
          expect(subject).to eq(false)
        end
      end

      it 'should be false when KNAPSACK_GENERATE_REPORT is not "true" or "0"' do
        with_env 'KNAPSACK_GENERATE_REPORT' => '1' do
          expect(subject).to eq(false)
        end
      end
    end

    context "when ENV doesn't exist" do
      it { should be false }
    end
  end
end