time_to_read 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24b42f86eeff5b2e17481a8942b60c6614851f78
4
- data.tar.gz: 79e95a32883bcf93799fbcc35839ef36ca79338a
3
+ metadata.gz: f25405ea085606f125438d9979bbd64ec0c1cb83
4
+ data.tar.gz: dd2d6f19f9eff4a25ac47ef87f9c4c23bd3c3c79
5
5
  SHA512:
6
- metadata.gz: ab93072243f14cbd48cb1b9024605249a34f54c926dce8a87ff57a18e285245f1f8e7a40301f98b8f097985ecf45aab74027f812b891a5d2291f4f388f07cc51
7
- data.tar.gz: 38b9bb09e4d0f12349f2e00199356505b8b5b3a3e43ec1c099d5386d61c94dcbbcc3faf501dd11e446881b988495795e95aba5e86dc46c2c0c0f1a05b87de354
6
+ metadata.gz: be371607b49fb1e5173723ae37391f02a9656970813ef3d1cb3a02906334a45320b73ac606398240290ab08016c1b72475d486bb48525c4594d08236ac7430e9
7
+ data.tar.gz: 964391bd3167604df6387dcf6624c0426584d0ae1fdd1a64518d8f18c3e86bd2ba8175f957dc9ae4fd0994f0948945f079da472ef6f9114d0641b53bf00bb09e
data/lib/time_to_read.rb CHANGED
@@ -8,10 +8,10 @@ module TimeToRead
8
8
  if time >= 60
9
9
  hours = read_time_hours(time).to_s
10
10
  minutes = read_time_minutes(time - hours.to_i * 60).to_s
11
- answer = hours + minutes
11
+ answer = '~' + hours + minutes
12
12
  elsif time < 60 && time > 1
13
13
  minutes = read_time_minutes(time).to_s
14
- answer = minutes
14
+ answer = '~' + minutes
15
15
  else
16
16
  answer = 'Less than a minute'
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module TimeToRead
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -5,29 +5,29 @@ describe "TimeToRead" do
5
5
  describe "time_to_read" do
6
6
  it "returns the reading time in phrase form when there is an even number of minutes" do
7
7
  text = "word " * 500
8
- expect(text.time_to_read(250)).to eql "2 minutes"
9
- end
10
-
11
- it "returns the reading time in phrase form when there are seconds" do
12
- text = "word " * 625
13
- expect(text.time_to_read(250)).to eql "2 minutes"
8
+ expect(text.time_to_read(250)).to eql "~ 2 minutes"
14
9
  end
15
10
 
16
11
  it "returns the reading time in phrase form when read time is an hour" do
17
12
  text = "word " * 15000
18
- expect(text.time_to_read(250)).to eql "1 hour"
13
+ expect(text.time_to_read(250)).to eql "~ 1 hour"
19
14
  end
20
15
 
21
- it "returns the reading time in phrase form when read time include an hour, minutes, and seconds" do
16
+ it "returns the reading time in phrase form when read time include an hour & minutes" do
22
17
  text = "word " * 22550
23
- expect(text.time_to_read(250)).to eql "1 hour 30 minutes"
18
+ expect(text.time_to_read(250)).to eql "~ 1 hour 30 minutes"
19
+ end
20
+
21
+ it 'returns less than a minute' do
22
+ text = 'word ' * 5
23
+ expect(text.time_to_read(250)).to eql "Less than a minute"
24
24
  end
25
25
  end
26
26
 
27
27
  describe "hours_in_words" do
28
28
  it "correctly pluralizes 'hour' when hours to read is greater than one" do
29
29
  text = "word " * 30000
30
- expect(text.time_to_read(250)).to eql "2 hours"
30
+ expect(text.time_to_read(250)).to eql "~ 2 hours"
31
31
  end
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: time_to_read
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abby Ihrig