spec/whirly_spec.rb in whirly-0.2.6 vs spec/whirly_spec.rb in whirly-0.3.0
- old
+ new
@@ -3,15 +3,15 @@
require "paint"
# require "irbtools/binding"
require "stringio"
def short_sleep
- sleep 0.2
+ sleep 0.4
end
def medium_sleep
- sleep 0.6
+ sleep 0.7
end
def long_sleep
sleep 1
end
@@ -199,16 +199,16 @@
describe "Interval" do
it "spins more often when interval is lower" do
capture1 = StringIO.new
Whirly.start(stream: capture1, interval: 100)
- medium_sleep
+ long_sleep
Whirly.stop
capture2 = StringIO.new
Whirly.start(stream: capture2, interval: 50)
- medium_sleep
+ long_sleep
Whirly.stop
assert capture1.string.size < capture2.string.size
end
end
@@ -218,19 +218,19 @@
it "will use no color when :color option is falsey" do
Whirly.start(color: false)
short_sleep
Whirly.stop
- refute /\[38;5;/ =~ @capture.string
+ refute /\[38;/ =~ @capture.string
end
it "will use color when :color option is truthy" do
Whirly.start(color: true)
short_sleep
Whirly.stop
- assert /\[38;5;/ =~ @capture.string
+ assert /\[38;/ =~ @capture.string
end
it "defaults :color to true when the paint gem is available" do
Whirly.reset
Whirly.configure
@@ -249,10 +249,10 @@
it "changes the the color" do
Whirly.start
long_sleep
Whirly.stop
- colors = @capture.string.scan(/\[38;5;(\d+)m/).flatten
+ colors = @capture.string.scan(/\[38;.*?m/).flatten
assert colors.uniq.size > 1
end
end
describe "Cursor" do