correct broken spec

This commit is contained in:
Sam 2014-11-12 10:27:34 +11:00
parent ec496a71b1
commit 5fd0841563
3 changed files with 20 additions and 14 deletions

View File

@ -3,18 +3,6 @@ require 'distributed_cache'
describe DistributedCache do
def wait_for(&blk)
i = 0
result = false
while !result && i < 300
result = blk.call
i += 1
sleep 0.001
end
result.should == true
end
let! :cache1 do
DistributedCache.new("test")
end

View File

@ -22,12 +22,17 @@ describe SiteText do
SiteText.text_for("got.sso").frozen? == true
SiteSetting.enable_sso = true
SiteText.text_for("got.sso").should == "got sso: true"
wait_for do
SiteText.text_for("got.sso") == "got sso: true"
end
text.value = "I gots sso: %{enable_sso}"
text.save!
SiteText.text_for("got.sso").should == "I gots sso: true"
wait_for do
SiteText.text_for("got.sso") == "I gots sso: true"
end
SiteText.text_for("got.sso", enable_sso: "frog").should == "I gots sso: frog"
end

View File

@ -51,4 +51,17 @@ module Helpers
yield(guardian) if block_given?
Guardian.stubs(new: guardian).with(user)
end
def wait_for(&blk)
i = 0
result = false
while !result && i < 300
result = blk.call
i += 1
sleep 0.001
end
result.should == true
end
end