Permalink
Browse files

Fixing some issues with the specs to get them to run on Ruby 1.9.x. S…

…pecs now runs, but most of them fails. =/

Signed-off-by: Justin French <justin@indent.com.au>
  • Loading branch information...
1 parent b537807 commit 542d3089bdd0cf1449f39a77b8d7f04be906c4af @grimen grimen committed with Sep 1, 2009
View
@@ -1,5 +1,8 @@
+# coding: utf-8
require 'rake'
require 'rake/rdoctask'
+
+gem 'rspec-rails', '>= 1.0.0'
require 'spec/rake/spectask'
begin
@@ -9,7 +12,9 @@ begin
SUMMARY = "A Rails form builder plugin/gem with semantically rich and accessible markup"
HOMEPAGE = "http://github.com/justinfrench/formtastic/tree/master"
+ gem 'technicalpickles-jeweler', '>= 1.0.0'
require 'jeweler'
+
Jeweler::Tasks.new do |s|
s.name = GEM
s.summary = SUMMARY
@@ -1,3 +1,4 @@
+# coding: utf-8
# Get current OS - needed for clipboard functionality
case RUBY_PLATFORM
when /darwin/ then
View
@@ -1 +1,2 @@
+# coding: utf-8
puts IO.read(File.join(File.dirname(__FILE__), 'README.textile'))
View
@@ -1,3 +1,5 @@
+# coding: utf-8
+
# Override the default ActiveRecordHelper behaviour of wrapping the input.
# This gets taken care of semantically by adding an error class to the LI tag
# containing the input.
@@ -1,3 +1,4 @@
+# coding: utf-8
module JustinFrench #:nodoc:
module Formtastic #:nodoc:
class SemanticFormBuilder < ::Formtastic::SemanticFormBuilder #:nodoc:
View
@@ -1,3 +1,4 @@
+# coding: utf-8
require File.join(File.dirname(__FILE__), *%w[.. lib formtastic])
require File.join(File.dirname(__FILE__), *%w[.. lib justin_french formtastic])
ActionView::Base.send :include, Formtastic::SemanticFormHelper
View
@@ -1,3 +1,4 @@
+# coding: utf-8
require File.dirname(__FILE__) + '/test_helper'
require 'formtastic'
@@ -1022,7 +1023,7 @@ def custom(arg1, arg2, options = {})
it 'should generate a label for the input' do
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="post_title"')
+ output_buffer.should have_tag('form li label[@for="post_title"]')
output_buffer.should have_tag('form li label', /Title/)
end
@@ -1095,7 +1096,7 @@ def custom(arg1, arg2, options = {})
end
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="project_title"')
+ output_buffer.should have_tag('form li label[@for="project_title"]')
output_buffer.should have_tag('form li label', /Title/)
output_buffer.should have_tag("form li input")
@@ -1122,7 +1123,7 @@ def custom(arg1, arg2, options = {})
end
it "should have a #{type} class on the wrapper" do
- output_buffer.should have_tag('form li.#{type}')
+ output_buffer.should have_tag('form li.#{type}') # << # FIXME: This seems to be incorrect, but passes. Eh? (grimen)
end
it 'should have a post_title_input id on the wrapper' do
@@ -1131,7 +1132,7 @@ def custom(arg1, arg2, options = {})
it 'should generate a label for the input' do
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="post_body"')
+ output_buffer.should have_tag('form li label[@for="post_body"]')
output_buffer.should have_tag('form li label', /Body/)
end
@@ -1192,7 +1193,7 @@ def custom(arg1, arg2, options = {})
it 'should generate labels' do
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="project_title"')
+ output_buffer.should have_tag('form li label[@for="project_title"]')
output_buffer.should have_tag('form li label', /Title/)
end
end
@@ -1263,7 +1264,7 @@ def custom(arg1, arg2, options = {})
it 'should generate a label for the input' do
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="post_time_zone"')
+ output_buffer.should have_tag('form li label[@for="post_time_zone"]')
output_buffer.should have_tag('form li label', /Time zone/)
end
@@ -1289,7 +1290,7 @@ def custom(arg1, arg2, options = {})
it 'should generate labels' do
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="project_time_zone"')
+ output_buffer.should have_tag('form li label[@for="project_time_zone"]')
output_buffer.should have_tag('form li label', /Time zone/)
end
@@ -1339,7 +1340,7 @@ def custom(arg1, arg2, options = {})
it 'should generate a label for the input' do
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="post_country"')
+ output_buffer.should have_tag('form li label[@for="post_country"]')
output_buffer.should have_tag('form li label', /Country/)
end
@@ -2156,8 +2157,9 @@ def custom(arg1, arg2, options = {})
@new_post.stub!(:publish_at)
@new_post.stub!(:column_for_attribute).and_return(mock('column', :type => :date))
- semantic_form_for(@new_post) do |@builder|
- concat(@builder.input(:publish_at, :as => :date))
+ semantic_form_for(@new_post) do |builder|
+ concat(builder.input(:publish_at, :as => :date))
+ @builder = builder
end
end
@@ -2338,8 +2340,9 @@ def custom(arg1, arg2, options = {})
describe 'when no object is given' do
before(:each) do
output_buffer.replace ''
- semantic_form_for(:project, :url => 'http://test.host') do |@builder|
- concat(@builder.input(:publish_at, :as => :datetime))
+ semantic_form_for(:project, :url => 'http://test.host') do |builder|
+ concat(builder.input(:publish_at, :as => :datetime))
+ @builder = builder
end
end
@@ -2432,7 +2435,7 @@ def custom(arg1, arg2, options = {})
it 'should generate a label containing the input' do
output_buffer.should have_tag('form li label')
- output_buffer.should have_tag('form li label[@for="post_allow_comments"')
+ output_buffer.should have_tag('form li label[@for="post_allow_comments"]')
output_buffer.should have_tag('form li label', /Allow comments/)
output_buffer.should have_tag('form li label input[@type="checkbox"]')
end
@@ -2459,7 +2462,7 @@ def custom(arg1, arg2, options = {})
concat(builder.input(:allow_comments, :as => :boolean))
end
- output_buffer.should have_tag('form li label[@for="project_allow_comments"')
+ output_buffer.should have_tag('form li label[@for="project_allow_comments"]')
output_buffer.should have_tag('form li label', /Allow comments/)
output_buffer.should have_tag('form li label input[@type="checkbox"]')
View
@@ -1,14 +1,26 @@
+# coding: utf-8
require 'rubygems'
+
+# To get the specs to run on Ruby 1.9.x.
+gem 'test-unit', '= 2.0.2'
+gem 'activesupport', '>= 2.3.3'
+gem 'actionpack', '>= 2.3.3'
+gem 'rspec', '>= 1.2.6'
+gem 'rspec-rails', '>= 1.2.6'
+gem 'rspec_hpricot_matchers', '>= 1.0.0'
+gem 'hpricot', '>= 0.8.1'
+
require 'spec'
require 'activesupport'
-require 'active_support'
require 'actionpack'
+require 'active_support'
require 'action_controller'
require 'action_view'
require 'rexml/document'
require 'rspec_hpricot_matchers'
+
Spec::Runner.configure do |config|
config.include(RspecHpricotMatchers)
end
-$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -1,3 +1,5 @@
+# coding: utf-8
+
namespace :formtastic do
GEM_ROOT = File.join(File.dirname(__FILE__), '..').freeze

0 comments on commit 542d308

Please sign in to comment.