Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
Fixed the Historics unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Dallas committed Aug 29, 2012
1 parent ab43aee commit d7a2bbb
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions test/test_historics.rb
Expand Up @@ -49,30 +49,27 @@ class TestHistorics < Test::Unit::TestCase
end

should "be able to prepare the query" do
@user.api_client.setResponse(200, {
setResponseToSingleHistoric({
'dpus' => @testdata['historic_dpus'],
'id' => @testdata['historic_playback_id'],
'availability' => @testdata['historic_availability']
}, 200, 150)
})
@historic.prepare()
end

should "not be able to prepare it more than once" do
@user.api_client.setResponse(200, {
setResponseToSingleHistoric({
'dpus' => @testdata['historic_dpus'],
'id' => @testdata['historic_playback_id'],
'availability' => @testdata['historic_availability']
}, 200, 150)
})
@historic.prepare()
assert_raise(DataSift::InvalidDataError) { @historic.prepare() }
end

should "be able to change the name after preparing" do
@user.api_client.setResponse(200, {
setResponseToSingleHistoric({
'dpus' => @testdata['historic_dpus'],
'id' => @testdata['historic_playback_id'],
'availability' => @testdata['historic_availability']
}, 200, 150)
})
@historic.prepare()

assert_equal @testdata['historic_name'], @historic.name
Expand All @@ -85,47 +82,43 @@ class TestHistorics < Test::Unit::TestCase
end

should "be able to start the query" do
@user.api_client.setResponse(200, {
setResponseToSingleHistoric({
'dpus' => @testdata['historic_dpus'],
'id' => @testdata['historic_playback_id'],
'availability' => @testdata['historic_availability']
}, 200, 150)
})
@historic.prepare()

set204Response()
@historic.start()
end

should "be able to stop the query" do
@user.api_client.setResponse(200, {
setResponseToSingleHistoric({
'dpus' => @testdata['historic_dpus'],
'id' => @testdata['historic_playback_id'],
'availability' => @testdata['historic_availability']
}, 200, 150)
})
@historic.prepare()

set204Response()
@historic.stop()
end

should "be able to delete the query" do
@user.api_client.setResponse(200, {
setResponseToSingleHistoric({
'dpus' => @testdata['historic_dpus'],
'id' => @testdata['historic_playback_id'],
'availability' => @testdata['historic_availability']
}, 200, 150)
})
@historic.prepare()

set204Response()
@historic.delete()
end

should "not be able to start the query after deletion" do
@user.api_client.setResponse(200, {
setResponseToSingleHistoric({
'dpus' => @testdata['historic_dpus'],
'id' => @testdata['historic_playback_id'],
'availability' => @testdata['historic_availability']
}, 200, 150)
})
@historic.prepare()

set204Response()
Expand Down

0 comments on commit d7a2bbb

Please sign in to comment.