MS SM fix ajax_stream?
This commit is contained in:
parent
ea700716ab
commit
e1aa709c85
2 changed files with 27 additions and 13 deletions
|
|
@ -72,11 +72,7 @@ class Stream::Aspect < Stream::Base
|
||||||
#
|
#
|
||||||
# @return [Boolean] see #for_all_aspects?
|
# @return [Boolean] see #for_all_aspects?
|
||||||
def ajax_stream?
|
def ajax_stream?
|
||||||
if AppConfig[:redis_cache]
|
!AppConfig[:redis_cache] && for_all_aspects?
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# The title that will display at the top of the stream's
|
# The title that will display at the top of the stream's
|
||||||
|
|
|
||||||
|
|
@ -134,20 +134,38 @@ describe Stream::Aspect do
|
||||||
|
|
||||||
describe '.ajax_stream?' do
|
describe '.ajax_stream?' do
|
||||||
before do
|
before do
|
||||||
|
@original_value = AppConfig[:redis_cache]
|
||||||
@stream = Stream::Aspect.new(stub, stub)
|
@stream = Stream::Aspect.new(stub, stub)
|
||||||
end
|
end
|
||||||
it 'is true stream is for all aspects?' do
|
|
||||||
pending
|
after do
|
||||||
@stream.stub(:for_all_aspects?).and_return(true)
|
AppConfig[:redis_cache] = @original_value
|
||||||
@stream.ajax_stream?.should be_true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'is false if it is not for all aspects' do
|
context 'if we are not caching with redis' do
|
||||||
pending
|
before do
|
||||||
@stream.stub(:for_all_aspects?).and_return(false)
|
AppConfig[:redis_cache] = false
|
||||||
@stream.ajax_stream?.should be_false
|
end
|
||||||
|
|
||||||
|
it 'is true if stream is for all aspects?' do
|
||||||
|
@stream.stub(:for_all_aspects?).and_return(true)
|
||||||
|
@stream.ajax_stream?.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'is false if it is not for all aspects' do
|
||||||
|
@stream.stub(:for_all_aspects?).and_return(false)
|
||||||
|
@stream.ajax_stream?.should be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'if we are caching with redis' do
|
||||||
|
it 'returns false' do
|
||||||
|
AppConfig[:redis_cache] = true
|
||||||
|
@stream.ajax_stream?.should be_false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'shared behaviors' do
|
describe 'shared behaviors' do
|
||||||
before do
|
before do
|
||||||
@stream = Stream::Aspect.new(alice, alice.aspects.map(&:id))
|
@stream = Stream::Aspect.new(alice, alice.aspects.map(&:id))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue