Sha256: 9883a4f9eacfaf491804cad35dca7ded63f406be0410ec1bc78c9765d9bde252
Contents?: true
Size: 1.94 KB
Versions: 2
Compression:
Stored size: 1.94 KB
Contents
require 'test_helper' begin; require 'activerecord'; rescue LoadError; end begin; require 'dm-core'; rescue LoadError; end require 'gravatarify' class GravatarifyIntegrationTest < Test::Unit::TestCase def setup; Gravatarify.options.clear end context "ActiveRecord::Base" do if defined?(ActiveRecord) should "include Gravatarify::ObjectSupport" do assert ActiveRecord::Base.included_modules.include?(Gravatarify::ObjectSupport) end should "respond to #gravatarify" do assert_respond_to ActiveRecord::Base, :gravatarify end else context "tests" do should "be run (but looks like ActiveRecord is not available)" do flunk "ActiveRecord not available -> thus tests are incomplete (error can be ignored though!)" end end end end context "DataMapper model (User)" do if defined?(DataMapper) setup do class User include DataMapper::Resource property :id, Serial property :name, String property :email, String property :author_email, String gravatarify end end should "include Gravatarify::ObjectSupport" do assert User.included_modules.include?(Gravatarify::ObjectSupport) end should "respond to #gravatarify" do assert_respond_to User, :gravatarify end context "as instance" do should "be able to build correct gravatar_url's!" do u = User.new(:email => "peter.gibbons@initech.com") assert_equal "http://0.gravatar.com/avatar/cb7865556d41a3d800ae7dbb31d51d54.jpg", u.gravatar_url end end else context "tests" do should "be run (but looks like DataMapper is not available)" do flunk "DataMapper not available -> thus tests are incomplete (error can be ignored though!)" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gravatarify-0.7.0 | test/gravatarify_integration_test.rb |
gravatarify-0.6.0 | test/gravatarify_integration_test.rb |