Permalink
Browse files

embedded simple rails app for testing, added integration test

  • Loading branch information...
1 parent 864d0bc commit 9101a2f38f10d145e1327e8db64fe535538b489b @fxposter fxposter committed Jul 10, 2011
Showing with 15,686 additions and 78 deletions.
  1. +1 −1 .gitignore
  2. +0 −8 Appraisals
  3. +0 −6 Gemfile
  4. +6 −2 README.rdoc
  5. +15 −1 Rakefile
  6. +6 −0 gemfiles/Gemfile.base
  7. +3 −0 gemfiles/Gemfile.rails3_0
  8. +2 −0 gemfiles/Gemfile.rails3_1
  9. +1 −1 lib/generators/nested_form/install_generator.rb
  10. +1 −1 lib/nested_form.rb
  11. +1 −1 lib/nested_form/{railtie.rb → engine.rb}
  12. +0 −1 nested_form.gemspec
  13. +7 −0 spec/dummy/Rakefile
  14. +5 −0 spec/dummy/app/assets/javascripts/application.js
  15. +8,981 −0 spec/dummy/app/assets/javascripts/jquery.js
  16. +1 −0 spec/dummy/app/assets/javascripts/jquery_nested_form.js
  17. +2 −0 spec/dummy/app/assets/javascripts/projects.js
  18. +6,082 −0 spec/dummy/app/assets/javascripts/prototype.js
  19. +1 −0 spec/dummy/app/assets/javascripts/prototype_nested_form.js
  20. +7 −0 spec/dummy/app/assets/stylesheets/application.css
  21. +4 −0 spec/dummy/app/assets/stylesheets/projects.css
  22. +3 −0 spec/dummy/app/controllers/application_controller.rb
  23. +5 −0 spec/dummy/app/controllers/projects_controller.rb
  24. +2 −0 spec/dummy/app/helpers/application_helper.rb
  25. +2 −0 spec/dummy/app/helpers/projects_helper.rb
  26. 0 spec/dummy/app/mailers/.gitkeep
  27. 0 spec/dummy/app/models/.gitkeep
  28. +3 −0 spec/dummy/app/models/milestone.rb
  29. +4 −0 spec/dummy/app/models/project.rb
  30. +3 −0 spec/dummy/app/models/task.rb
  31. +11 −0 spec/dummy/app/views/layouts/application.html.erb
  32. +14 −0 spec/dummy/app/views/projects/new.html.erb
  33. +4 −0 spec/dummy/config.ru
  34. +42 −0 spec/dummy/config/application.rb
  35. +10 −0 spec/dummy/config/boot.rb
  36. +25 −0 spec/dummy/config/database.yml
  37. +5 −0 spec/dummy/config/environment.rb
  38. +27 −0 spec/dummy/config/environments/development.rb
  39. +54 −0 spec/dummy/config/environments/production.rb
  40. +39 −0 spec/dummy/config/environments/test.rb
  41. +7 −0 spec/dummy/config/initializers/backtrace_silencers.rb
  42. +10 −0 spec/dummy/config/initializers/inflections.rb
  43. +5 −0 spec/dummy/config/initializers/mime_types.rb
  44. +7 −0 spec/dummy/config/initializers/secret_token.rb
  45. +8 −0 spec/dummy/config/initializers/session_store.rb
  46. +12 −0 spec/dummy/config/initializers/wrap_parameters.rb
  47. +5 −0 spec/dummy/config/locales/en.yml
  48. +59 −0 spec/dummy/config/routes.rb
  49. BIN spec/dummy/db/development.sqlite3
  50. +23 −0 spec/dummy/db/migrate/20110710143903_initial_tables.rb
  51. +29 −0 spec/dummy/db/schema.rb
  52. BIN spec/dummy/db/test.sqlite3
  53. +26 −0 spec/dummy/public/404.html
  54. +26 −0 spec/dummy/public/422.html
  55. +26 −0 spec/dummy/public/500.html
  56. 0 spec/dummy/public/favicon.ico
  57. +1 −0 spec/dummy/public/javascripts
  58. +6 −0 spec/dummy/script/rails
  59. +7 −0 spec/dummy/test/functional/projects_controller_test.rb
  60. +4 −0 spec/dummy/test/unit/helpers/projects_helper_test.rb
  61. 0 spec/dummy/tmp/cache/.gitkeep
  62. +31 −0 spec/form_spec.rb
  63. +9 −52 spec/spec_helper.rb
  64. +6 −4 {lib/generators/nested_form/templates → vendor/assets/javascripts}/jquery_nested_form.js
  65. 0 {lib/generators/nested_form/templates → vendor/assets/javascripts}/prototype_nested_form.js
View
@@ -4,4 +4,4 @@
Gemfile.lock
.bundle
log
-gemfiles
+gemfiles/*.lock
View
@@ -1,8 +0,0 @@
-appraise 'rails3' do
- gem 'rails', '~> 3.0.0'
- gem 'formtastic'
-end
-
-appraise 'rails3_1' do
- gem 'rails', '~> 3.1.0.rc4'
-end
View
@@ -1,6 +0,0 @@
-source "http://rubygems.org/"
-gemspec
-gem 'sqlite3'
-gem 'simple_form'
-gem 'rake'
-gem 'appraisal'
View
@@ -17,14 +17,18 @@ Now you can override default behavior of inserting new subforms into your form (
return $(link).closest('form').find(assoc + '_fields').append($(content));
}
-=== Rails 3.1 support (asset pipeline is not yet supported)
+=== Rails 3.1 support (with asset pipeline)
There's a small fix for Rails 3.1 form handling.
Also support of Rails 3.1 led me to huge refactor of specs setup (now using Helper specs from rspec-rails instead of custom implementation spec context).
-Last, but not least - I used appraisal[https://github.com/thoughtbot/appraisal] gem to run specs for rails 3 and 3.1.
Formtastic is supported only with Rails 3.0, Rails 3.1 integration is not available now.
+Asset pipeline is supported. So you can use
+
+ //= require jquery_nested_form
+ // or
+ //= require prototype_nested_form
== Setup
View
@@ -1,5 +1,5 @@
require 'rubygems'
-require 'appraisal'
+# require 'appraisal'
require 'rake'
require 'rspec/core/rake_task'
@@ -9,3 +9,17 @@ RSpec::Core::RakeTask.new do |t|
end
task :default => :spec
+namespace :spec do
+ task :install do
+ puts `bundle install --gemfile=gemfiles/Gemfile.rails3_0`
+ puts `bundle install --gemfile=gemfiles/Gemfile.rails3_1`
+ end
+
+ task :all do
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../gemfiles/Gemfile.rails3_0', __FILE__)
+ Rake::Task["spec"].execute
+
+ ENV['BUNDLE_GEMFILE'] = File.expand_path('../gemfiles/Gemfile.rails3_1', __FILE__)
+ Rake::Task["spec"].execute
+ end
+end
View
@@ -0,0 +1,6 @@
+source "http://rubygems.org/"
+gem "sqlite3"
+gem "simple_form"
+gem "rake"
+gem "capybara"
+gemspec :path => '../'
@@ -0,0 +1,3 @@
+instance_eval File.read('gemfiles/Gemfile.base')
+gem "formtastic"
+gem "rails", "~> 3.0.0"
@@ -0,0 +1,2 @@
+instance_eval File.read('gemfiles/Gemfile.base')
+gem "rails", "~> 3.1.0.rc4"
@@ -2,7 +2,7 @@ module NestedForm
module Generators
class InstallGenerator < Rails::Generators::Base
def self.source_root
- File.dirname(__FILE__) + "/templates"
+ File.expand_path('../../../../vendor/assets/javascripts', __FILE__)
end
def copy_jquery_file
View
@@ -1 +1 @@
-require "nested_form/railtie"
+require "nested_form/engine"
@@ -1,7 +1,7 @@
require 'rails'
module NestedForm
- class Railtie < ::Rails::Railtie
+ class Engine < ::Rails::Engine
initializer 'nested_form' do |app|
ActiveSupport.on_load(:action_view) do
require "nested_form/view_helper"
View
@@ -12,7 +12,6 @@ Gem::Specification.new do |s|
s.add_development_dependency "rspec-rails", "~> 2.6.0"
s.add_development_dependency "mocha"
- # s.add_development_dependency "rails", "~> 3.1.0.rc"
s.rubyforge_project = s.name
s.required_rubygems_version = ">= 1.3.4"
View
@@ -0,0 +1,7 @@
+#!/usr/bin/env rake
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require File.expand_path('../config/application', __FILE__)
+
+Dummy::Application.load_tasks
@@ -0,0 +1,5 @@
+// This is a manifest file that'll be compiled into including all the files listed below.
+// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
+// be included in the compiled file accessible from http://example.com/assets/application.js
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// the compiled file.
Oops, something went wrong.

0 comments on commit 9101a2f

Please sign in to comment.