Commit e422115bc6185a3f4136bbc14145c3738540a4fe
1 parent
18df09eb
Exists in
staging
and in
42 other branches
rails3: fix feed_handler tests
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
test/factories.rb
... | ... | @@ -278,7 +278,7 @@ module Noosfero::Factory |
278 | 278 | # FeedReaderBlock |
279 | 279 | ############################################### |
280 | 280 | def defaults_for_feed_reader_block |
281 | - { :address => Rails.root + '/test/fixtures/files/feed.xml' } | |
281 | + { :address => File.join(Rails.root, 'test/fixtures/files/feed.xml') } | |
282 | 282 | end |
283 | 283 | |
284 | 284 | ############################################### | ... | ... |
test/unit/feed_handler_test.rb
... | ... | @@ -90,7 +90,7 @@ class FeedHandlerTest < ActiveSupport::TestCase |
90 | 90 | [:external_feed, :feed_reader_block].each do |container_class| |
91 | 91 | |
92 | 92 | should "reset the errors count after a successfull run (#{container_class})" do |
93 | - container = build(container_class, :update_errors => 1, :address => Rails.root + '/test/fixtures/files/feed.xml') | |
93 | + container = create(container_class, :update_errors => 1, :address => File.join(Rails.root, 'test/fixtures/files/feed.xml')) | |
94 | 94 | handler.expects(:actually_process_container).with(container) |
95 | 95 | handler.process(container) |
96 | 96 | assert_equal 0, container.update_errors |
... | ... | @@ -122,6 +122,8 @@ class FeedHandlerTest < ActiveSupport::TestCase |
122 | 122 | 5.times { handler.process(container) } |
123 | 123 | |
124 | 124 | # after disabled period, tries to process the container again |
125 | + handler.stubs(:actually_process_container).with(container) | |
126 | + container.stubs(:only_once).returns(false) | |
125 | 127 | last_error = Time.now |
126 | 128 | Time.stubs(:now).returns(last_error + FeedHandler.disabled_period + 1.second) |
127 | 129 | handler.process(container) | ... | ... |