progressbar 1.8.2 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.md +5 -5
- data/Rakefile +0 -0
- data/lib/progressbar.rb +2 -0
- data/lib/ruby-progressbar/base.rb +24 -2
- data/lib/ruby-progressbar/calculators/length.rb +14 -3
- data/lib/ruby-progressbar/components/time.rb +6 -2
- data/lib/ruby-progressbar/format/formatter.rb +1 -1
- data/lib/ruby-progressbar/format/molecule.rb +2 -1
- data/lib/ruby-progressbar/output.rb +14 -7
- data/lib/ruby-progressbar/outputs/null.rb +33 -0
- data/lib/ruby-progressbar/progress.rb +4 -0
- data/lib/ruby-progressbar/refinements.rb +1 -0
- data/lib/ruby-progressbar/refinements/enumerator.rb +25 -0
- data/lib/ruby-progressbar/version.rb +1 -1
- metadata +31 -70
- metadata.gz.sig +0 -0
- data/lib/ruby-progressbar/calculators/length_spec.rb +0 -9
- data/spec/fixtures/benchmark.rb +0 -28
- data/spec/ruby-progressbar/base_spec.rb +0 -949
- data/spec/ruby-progressbar/calculators/length_calculator_spec.rb +0 -19
- data/spec/ruby-progressbar/calculators/running_average_spec.rb +0 -19
- data/spec/ruby-progressbar/components/bar_spec.rb +0 -234
- data/spec/ruby-progressbar/components/percentage_spec.rb +0 -9
- data/spec/ruby-progressbar/components/rate_spec.rb +0 -9
- data/spec/ruby-progressbar/components/throttle_spec.rb +0 -157
- data/spec/ruby-progressbar/components/time_spec.rb +0 -307
- data/spec/ruby-progressbar/components/title_spec.rb +0 -12
- data/spec/ruby-progressbar/format/formatter_spec.rb +0 -9
- data/spec/ruby-progressbar/format/molecule_spec.rb +0 -30
- data/spec/ruby-progressbar/format/string_spec.rb +0 -9
- data/spec/ruby-progressbar/output_spec.rb +0 -7
- data/spec/ruby-progressbar/outputs/non_tty_spec.rb +0 -9
- data/spec/ruby-progressbar/outputs/tty_spec.rb +0 -9
- data/spec/ruby-progressbar/progress_spec.rb +0 -156
- data/spec/ruby-progressbar/time_spec.rb +0 -45
- data/spec/ruby-progressbar/timer_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -6
- data/spec/support/time.rb +0 -17
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
class TimeMockedWithTimecop
|
4
|
-
def self.now_without_mock_time; end
|
5
|
-
end
|
6
|
-
|
7
|
-
class TimeMockedWithDelorean
|
8
|
-
def self.now_without_delorean; end
|
9
|
-
end
|
10
|
-
|
11
|
-
class TimeMockedWithActiveSupport
|
12
|
-
def self.__simple_stub__now; end
|
13
|
-
end
|
14
|
-
|
15
|
-
class UnmockedTime
|
16
|
-
def self.now; end
|
17
|
-
end
|
18
|
-
|
19
|
-
class ProgressBar
|
20
|
-
RSpec.describe Time do
|
21
|
-
it 'when Time is being mocked by Timecop retrieves the unmocked Timecop time' do
|
22
|
-
expect(TimeMockedWithTimecop).to receive(:now_without_mock_time).once
|
23
|
-
|
24
|
-
Time.new(TimeMockedWithTimecop).now
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'when Time is being mocked by Delorean retrieves the unmocked Delorean time' do
|
28
|
-
expect(TimeMockedWithDelorean).to receive(:now_without_delorean).once
|
29
|
-
|
30
|
-
Time.new(TimeMockedWithDelorean).now
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'when Time is being mocked by ActiveSupport retrieves the unmocked time' do
|
34
|
-
expect(TimeMockedWithActiveSupport).to receive(:__simple_stub__now).once
|
35
|
-
|
36
|
-
Time.new(TimeMockedWithActiveSupport).now
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'when Time is not being mocked will return the actual time' do
|
40
|
-
expect(UnmockedTime).to receive(:now).once
|
41
|
-
|
42
|
-
Time.new(UnmockedTime).now
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/spec/support/time.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
###
|
2
|
-
# In our specs, I want to make sure time gets mocked so I can accurately test
|
3
|
-
# times displayed to the user.
|
4
|
-
#
|
5
|
-
class PBTimeTester
|
6
|
-
def self.now
|
7
|
-
::Time.now
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class ProgressBar
|
12
|
-
class Time
|
13
|
-
def initialize(time = ::PBTimeTester)
|
14
|
-
self.time = time
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|