Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelcarter committed Mar 18, 2013
2 parents a3b98db + c97b009 commit 3d95d2b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 78 deletions.
17 changes: 9 additions & 8 deletions .travis.yml
@@ -1,4 +1,6 @@
before_install: gem update --system
before_install:
- gem update --system
- gem update bundler
rvm:
- 1.8.7
- ree
Expand All @@ -8,22 +10,21 @@ gemfile:
- gemfiles/rails-3.0.gemfile
- gemfiles/rails-3.1.gemfile
- gemfiles/rails-3.2.gemfile
- gemfiles/rails-4.gemfile
env:
- DEFER_GC=false RAILS_EDGE=true
script: "rake spec"
matrix:
exclude:
- rvm: 1.8.7
gemfile: gemfiles/rails-4.gemfile
env: DEFER_GC=false RAILS_EDGE=true
- rvm: ree
include:
- rvm: 1.9.3
gemfile: gemfiles/rails-4.gemfile
env: DEFER_GC=false RAILS_EDGE=true
- rvm: 1.9.2
- rvm: 2.0.0
gemfile: gemfiles/rails-4.gemfile
env: DEFER_GC=false RAILS_EDGE=true
allow_failures:
- rvm: 1.9.3
gemfile: gemfiles/rails-4.gemfile
env: DEFER_GC=false RAILS_EDGE=true
- rvm: 2.0.0
gemfile: gemfiles/rails-4.gemfile
env: DEFER_GC=false RAILS_EDGE=true
4 changes: 1 addition & 3 deletions Appraisals
Expand Up @@ -12,8 +12,6 @@ end

if ENV["RAILS_EDGE"] == "true"
appraise 'rails-4' do
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'activerecord-deprecated_finders', :git=>'https://github.com/rails/activerecord-deprecated_finders.git'
gem 'journey', :git=>'https://github.com/rails/journey.git'
gem 'rails', '~> 4.0.0.beta1'
end
end
17 changes: 0 additions & 17 deletions Rakefile
Expand Up @@ -3,7 +3,6 @@ require 'bundler/setup'
require 'appraisal'
require 'rdoc/task'
require 'rspec/core/rake_task'
require 'tasks/verify_rcov'

Bundler::GemHelper.install_tasks

Expand Down Expand Up @@ -38,19 +37,3 @@ desc 'Test the formtastic plugin with specdoc formatting and colors'
RSpec::Core::RakeTask.new('specdoc') do |t|
t.pattern = FileList['spec/**/*_spec.rb']
end

desc 'Run all examples with RCov'
RSpec::Core::RakeTask.new('rcov') do |t|
t.pattern = FileList['spec/**/*_spec.rb']
t.rcov = true
t.rcov_opts = %w(--exclude gems/*,spec/*,.bundle/*, --aggregate coverage.data)
end

RCov::VerifyTask.new(:verify_coverage) do |t|
t.require_exact_threshold = false
t.threshold = (RUBY_VERSION == "1.8.7" ? 95 : 0)
end

desc "Run all examples and verify coverage"
task :spec_and_verify_coverage => [:rcov, :verify_coverage] do
end
1 change: 0 additions & 1 deletion formtastic.gemspec
Expand Up @@ -30,7 +30,6 @@ Gem::Specification.new do |s|
s.add_development_dependency(%q<hpricot>, ["~> 0.8.3"])
s.add_development_dependency(%q<BlueCloth>) # for YARD
s.add_development_dependency(%q<yard>, ["~> 0.6"])
s.add_development_dependency(%q<rcov>, ["~> 0.9.9"])
s.add_development_dependency(%q<colored>)
s.add_development_dependency(%q<tzinfo>)
s.add_development_dependency(%q<ammeter>, ["0.2.5"])
Expand Down
4 changes: 1 addition & 3 deletions gemfiles/rails-4.gemfile
Expand Up @@ -2,8 +2,6 @@

source :rubygems

gem "rails", :git=>"git://github.com/rails/rails.git"
gem "activerecord-deprecated_finders", :git=>"https://github.com/rails/activerecord-deprecated_finders.git"
gem "journey", :git=>"https://github.com/rails/journey.git"
gem "rails", "~> 4.0.0.beta1"

gemspec :path=>"../"
12 changes: 10 additions & 2 deletions lib/formtastic/inputs/base/errors.rb
Expand Up @@ -14,10 +14,12 @@ def error_sentence_html

def error_list_html
error_class = options[:error_class] || builder.default_error_list_class

list_elements = []
errors.each do |error|
list_elements << template.content_tag(:li, Formtastic::Util.html_safe(error.html_safe))
end

template.content_tag(:ul, Formtastic::Util.html_safe(list_elements.join("\n")), :class => error_class)
end

Expand All @@ -38,7 +40,13 @@ def errors
errors = []
if object && object.respond_to?(:errors)
error_keys.each do |key|
errors << object.errors[key] unless object.errors[key].blank?
unless object.errors[key].blank?
if builder.attribute_names_on_errors
errors << object.errors[key].each_with_index.map { |err, idx| (idx==0) ? "#{key.to_s.titleize} #{err}" : err }
else
errors << object.errors[key]
end
end
end
end
errors.flatten.compact.uniq
Expand All @@ -50,7 +58,7 @@ def error_keys
keys << association_primary_key if belongs_to? || has_many?
keys.flatten.compact.uniq
end

end
end
end
Expand Down
5 changes: 5 additions & 0 deletions lib/generators/templates/formtastic.rb
Expand Up @@ -74,3 +74,8 @@
# this to true. Doing so will add a `novalidate` attribute to the `<form>` tag.
# See http://diveintohtml5.org/forms.html#validation for more info.
# Formtastic::FormBuilder.perform_browser_validations = true

# You can set attribute names to show at the beginning of error messages by setting
# this to true. For example, 'must not be blank' would become "Title must not be blank" or
# 'Name must not be blank'.
# Formtastic::Formbuilder.attribute_names_on_errors = false
44 changes: 0 additions & 44 deletions lib/tasks/verify_rcov.rb

This file was deleted.

0 comments on commit 3d95d2b

Please sign in to comment.