Created
July 30, 2008 23:19
-
-
Save croaky/3354 to your computer and use it in GitHub Desktop.
Tests for Hoptoad API via ActiveResource
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
# implementation at http://gist.github.com/3350 | |
class HoptoadTest < Test::Unit::TestCase | |
context 'Error.find :all' do | |
setup do | |
@errors = Error.find :all | |
end | |
should 'find errors' do | |
assert @errors.any? | |
end | |
should 'find no more than 30 errors' do | |
assert @errors.size < 30 | |
end | |
should 'find errors with a controller attribute' do | |
assert @errors.all? { |each| each.respond_to? :controller } | |
end | |
should 'find errors with a action attribute' do | |
assert @errors.all? { |each| each.respond_to? :action } | |
end | |
should 'find errors with a id attribute' do | |
assert @errors.all? { |each| each.respond_to? :id } | |
end | |
should 'find errors with a project_id attribute' do | |
assert @errors.all? { |each| each.respond_to? :project_id } | |
end | |
should 'find errors with a visible attribute' do | |
assert @errors.all? { |each| each.respond_to? :visible } | |
end | |
should 'find errors with a file attribute' do | |
assert @errors.all? { |each| each.respond_to? :file } | |
end | |
should 'find errors with a line_number attribute' do | |
assert @errors.all? { |each| each.respond_to? :line_number } | |
end | |
should 'find errors with a error_message attribute' do | |
assert @errors.all? { |each| each.respond_to? :error_message } | |
end | |
should 'find errors with a notices_count attribute' do | |
assert @errors.all? { |each| each.respond_to? :notices_count } | |
end | |
should 'find errors with a last_notice_at attribute' do | |
assert @errors.all? { |each| each.respond_to? :last_notice_at } | |
end | |
should 'find errors with a rails_env attribute' do | |
assert @errors.all? { |each| each.respond_to? :rails_env } | |
end | |
should 'find errors with a created_at attribute' do | |
assert @errors.all? { |each| each.respond_to? :created_at } | |
end | |
should 'find errors with a updated_at attribute' do | |
assert @errors.all? { |each| each.respond_to? :updated_at } | |
end | |
end | |
context 'Error.find :all, :params => { :page => 2 }' do | |
setup do | |
@errors = Error.find :all, :params => { :page => 2 } | |
end | |
should 'find errors' do | |
assert @errors.any? | |
end | |
should 'find no more than 30 errors' do | |
assert @errors.size < 30 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment