Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6152a11a3a
Fetching contributors…

Cannot retrieve contributors at this time

26 lines (22 sloc) 1.002 kb
require File.dirname(__FILE__) + '/test_helper.rb'
class TestDate < Test::Unit::TestCase
def setup
Mirrored::Base.establish_connection(:magnolia, 'jnunemaker', 'password')
end
test 'should get all dates' do
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/dates.xml')).read
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/dates'), :string => data)
dates = Mirrored::Date.find(:all)
assert_equal 663, dates.size
assert_equal Date.civil(2005, 5, 10), dates.first.date
assert_equal '87', dates.first.count
end
test 'should get all dates for tag' do
data = open(File.join(File.dirname(__FILE__), 'fixtures/xml/dates_for_tag.xml')).read
FakeWeb.register_uri(URI.join(Mirrored::Base.api_url, 'posts/dates?tag=ruby'), :string => data)
dates = Mirrored::Date.find(:all, :tag => 'ruby')
assert_equal 241, dates.size
assert_equal Date.civil(2006, 2, 8), dates.first.date
assert_equal '1', dates.first.count
end
end
Jump to Line
Something went wrong with that request. Please try again.