Created
March 18, 2015 14:53
-
-
Save jswright61/65e140b562b606d33f26 to your computer and use it in GitHub Desktop.
Spec file uses wrong db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/lib/trey/youtube/jobs/health_check.rb | |
require 'spec_helper' | |
describe 'Trey::Youtube::Jobs::HealthCheck' do | |
before(:all) do | |
DB[:youtube_channel_metrics_days].truncate | |
DB[:youtube_channel_metrics_days] << {channel_id: 'channel1', date: Date.parse('2014-06-02')} | |
DB[:youtube_channel_metrics_days] << {channel_id: 'channel2', date: Date.parse('2014-01-01')} | |
DB[:youtube_video_metrics_days].truncate | |
DB[:youtube_video_metrics_days] << {channel_id: 'channel1', date: Date.parse('2014-05-15'), video_id: 'vid1'} | |
DB[:youtube_video_metrics_days] << {channel_id: 'channel1', date: Date.parse('2013-05-18'), video_id: 'vid1'} | |
DB[:youtube_video_metrics_days] << {channel_id: 'channel2', date: Date.parse('2013-11-14'), video_id: 'vid1'} | |
DB[:youtube_video_metrics_days] << {channel_id: 'channel2', date: Date.parse('2015-01-07'), video_id: 'vid2'} | |
DB[:youtube_video_metrics_days] << {channel_id: 'channel2', date: Date.parse('2015-01-11'), video_id: 'vid2'} | |
end | |
after(:all) do | |
# DB[:youtube_channel_metrics_days].truncate | |
# DB[:youtube_video_metrics_days].truncate | |
end | |
describe '#perform' do | |
it 'should return valid healthcheck data for each channel and video' do | |
Trey::Youtube::Jobs::HealthCheck.perform.should eq({ | |
"channel1" => (Date.today - 3.days).to_s, | |
"channel2" => (Date.today - 3.days).to_s | |
}) | |
# data returned is from my development db, not test db. | |
# DB statements in before affect the test db | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment