Permalink
Browse files

Using Bundler

  • Loading branch information...
1 parent f236633 commit 6f27778a4d80ac21a2029ef5af0795c7cfd808a8 @carpodaster carpodaster committed Apr 20, 2011
Showing with 63 additions and 9 deletions.
  1. +7 −0 Gemfile
  2. +38 −0 Gemfile.lock
  3. +18 −9 test/microformats_helper_test.rb
View
@@ -0,0 +1,7 @@
+source "http://rubygems.org"
+
+group :test do
+ gem 'activesupport', '>= 2.3', :require => "active_support"
+ gem 'actionpack', '>= 2.3', :require => "action_controller"
+ gem 'redgreen' # soz for the noise, but I like it pretty ^^
+end
View
@@ -0,0 +1,38 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionpack (3.0.7)
+ activemodel (= 3.0.7)
+ activesupport (= 3.0.7)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.5.0)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.14)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.7)
+ activesupport (= 3.0.7)
+ builder (~> 2.1.2)
+ i18n (~> 0.5.0)
+ activesupport (3.0.7)
+ builder (2.1.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.5.0)
+ rack (1.2.2)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ redgreen (1.2.2)
+ tzinfo (0.3.26)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ actionpack (>= 2.3)
+ activesupport (>= 2.3)
+ redgreen
@@ -1,16 +1,24 @@
-# Rubygems is where Rails is located
-require 'rubygems'
-require File.dirname(__FILE__) + '/../lib/microformats_helper'
+begin
+ require "rubygems"
+ require "bundler/setup"
+rescue LoadError
+ raise "Could not load the bundler gem. Install it with `gem install bundler` and do a `bundle install`."
+end
# Here's the helper file we need
+require File.dirname(__FILE__) + '/../lib/microformats_helper'
require 'test/unit'
-require 'action_controller'
-begin
- gem 'redgreen' # soz for the noise, but I like it pretty ^^
- require 'redgreen'
-rescue LoadError; end
+Bundler.require(:test)
+class ActiveSupport::TestCase
+ # Treats +text+ as DOM and uses selectors to check for element occurences.
+ # http://www.echographia.com/blog/2009/08/22/assert_select-from-arbitrary-text/
+ def assert_select_from(text, *args)
+ @selected = HTML::Document.new(text).root.children
+ assert_select(*args)
+ end
+end
-class MicroformatsHelperTest < Test::Unit::TestCase
+class MicroformatsHelperTest < ActiveSupport::TestCase
# This is the helper with the 'tag' method
include ActionView::Helpers::TagHelper
@@ -64,4 +72,5 @@ def test_hcard_tel
output = hcard(:fn => "John Doe", :tel => { "home" => "555-5555", "fax" => "544-5544" })
assert_equal "<span class=\"vcard\">\n<span class=\"fn n\">John Doe</span>\n\n<span class=\"tel\"><span class=\"tel-label-home type\">Home: </span><span class=\"value\">555-5555</span>\n<span class=\"tel-label-fax type\">Fax: </span><span class=\"value\">544-5544</span>\n</span>\n</span>", output
end
+
end

0 comments on commit 6f27778

Please sign in to comment.