diff --git a/.gitignore b/.gitignore index a310fe4..3021b7c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ spec/dummy/tmp/ spec/dummy/.sass-cache spec/dummy/public *.gem +routes.txt diff --git a/Gemfile b/Gemfile index cf4cb0e..ca32f7c 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem "jquery-rails" gem 'couch_potato' , :git => 'git://github.com/bterkuile/couch_potato.git' gem 'simply_stored' , :git => 'git://github.com/bterkuile/simply_stored.git' -gem 'devise' +gem 'devise', '2.0.4' gem 'devise_simply_stored' gem 'tinymce-rails' gem 'haml-rails' @@ -31,7 +31,10 @@ group :test do gem 'rspec-rails' gem 'factory_girl_rails' gem 'capybara' + gem 'pry' end group :development do - gem 'ruby-debug19', :require => 'ruby-debug' + gem 'pry' + gem 'thin' + #gem 'ruby-debug19', :require => 'ruby-debug' end diff --git a/Gemfile.lock b/Gemfile.lock index 9116911..1bffc75 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,17 +1,17 @@ GIT remote: git://github.com/bterkuile/couch_potato.git - revision: 2f0252bc1b93675ccc4f0ff6a193c2acff59bc2e + revision: ff7505c432cabfccb55cfa732a548d9449d8250c specs: - couch_potato (0.6.0) + couch_potato (0.7.0.pre.1) activemodel couchrest (>= 1.0.1) json (~> 1.6.0) GIT remote: git://github.com/bterkuile/simply_stored.git - revision: abe990e1d97763ef90d3ff010d449bf2adf5a227 + revision: 0359fa86f4025e0a84953c68c7e6e351e9601cbf specs: - simply_stored (0.5.4) + simply_stored (1.0.0) activesupport couch_potato (>= 0.2.15) rest-client (>= 1.4.2) @@ -35,37 +35,37 @@ PATH GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.3) - actionpack (= 3.2.3) + actionmailer (3.2.6) + actionpack (= 3.2.6) mail (~> 2.4.4) - actionpack (3.2.3) - activemodel (= 3.2.3) - activesupport (= 3.2.3) + actionpack (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.1) rack (~> 1.4.0) rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.1.2) - activemodel (3.2.3) - activesupport (= 3.2.3) + sprockets (~> 2.1.3) + activemodel (3.2.6) + activesupport (= 3.2.6) builder (~> 3.0.0) - activerecord (3.2.3) - activemodel (= 3.2.3) - activesupport (= 3.2.3) + activerecord (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.3) - activemodel (= 3.2.3) - activesupport (= 3.2.3) - activesupport (3.2.3) + activeresource (3.2.6) + activemodel (= 3.2.6) + activesupport (= 3.2.6) + activesupport (3.2.6) i18n (~> 0.6) multi_json (~> 1.0) - archive-tar-minitar (0.5.2) + addressable (2.2.8) arel (3.0.2) bcrypt-ruby (3.0.1) - bourbon (1.4.0) + bourbon (2.1.0) sass (>= 3.1) builder (3.0.0) capybara (1.1.2) @@ -75,18 +75,19 @@ GEM rack-test (>= 0.5.4) selenium-webdriver (~> 2.0) xpath (~> 0.1.4) - childprocess (0.3.1) + childprocess (0.3.2) ffi (~> 1.0.6) cocaine (0.2.1) + coderay (1.0.7) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.2.0) - columnize (0.3.6) + coffee-script-source (1.3.3) couchrest (1.1.2) mime-types (~> 1.15) multi_json (~> 1.0.0) rest-client (~> 1.6.1) + daemons (1.1.8) devise (2.0.4) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.0.3) @@ -98,15 +99,16 @@ GEM email_validator (1.3.0) activemodel erubis (2.7.0) - execjs (1.3.0) + eventmachine (0.12.10) + execjs (1.4.0) multi_json (~> 1.0) - factory_girl (3.0.0) + factory_girl (3.5.0) activesupport (>= 3.0.0) - factory_girl_rails (3.0.0) - factory_girl (~> 3.0.0) + factory_girl_rails (3.5.0) + factory_girl (~> 3.5.0) railties (>= 3.0.0) ffi (1.0.11) - haml (3.1.4) + haml (3.1.6) haml-rails (0.3.4) actionpack (~> 3.0) activesupport (~> 3.0) @@ -114,28 +116,33 @@ GEM railties (~> 3.0) hike (1.2.1) i18n (0.6.0) - journey (1.0.3) - jquery-rails (2.0.1) + journey (1.0.4) + jquery-rails (2.0.2) railties (>= 3.2.0, < 5.0) thor (~> 0.14) - json (1.6.6) - linecache19 (0.5.12) - ruby_core_source (>= 0.1.4) + json (1.6.7) + libwebsocket (0.1.3) + addressable mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.18) + method_source (0.7.1) + mime-types (1.19) multi_json (1.0.4) - nokogiri (1.5.2) + nokogiri (1.5.5) orm_adapter (0.0.7) - paperclip (3.0.1) + paperclip (3.1.2) activemodel (>= 3.0.0) activerecord (>= 3.0.0) activesupport (>= 3.0.0) cocaine (>= 0.0.2) mime-types polyglot (0.3.3) + pry (0.9.9.6) + coderay (~> 1.0.5) + method_source (~> 0.7.1) + slop (>= 2.4.4, < 3) rack (1.4.1) rack-cache (1.2) rack (>= 0.4) @@ -143,72 +150,67 @@ GEM rack rack-test (0.6.1) rack (>= 1.0) - rails (3.2.3) - actionmailer (= 3.2.3) - actionpack (= 3.2.3) - activerecord (= 3.2.3) - activeresource (= 3.2.3) - activesupport (= 3.2.3) + rails (3.2.6) + actionmailer (= 3.2.6) + actionpack (= 3.2.6) + activerecord (= 3.2.6) + activeresource (= 3.2.6) + activesupport (= 3.2.6) bundler (~> 1.0) - railties (= 3.2.3) - railties (3.2.3) - actionpack (= 3.2.3) - activesupport (= 3.2.3) + railties (= 3.2.6) + railties (3.2.6) + actionpack (= 3.2.6) + activesupport (= 3.2.6) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) - thor (~> 0.14.6) + thor (>= 0.14.6, < 2.0) rake (0.9.2.2) rdoc (3.12) json (~> 1.4) rest-client (1.6.7) mime-types (>= 1.16) - rspec (2.9.0) - rspec-core (~> 2.9.0) - rspec-expectations (~> 2.9.0) - rspec-mocks (~> 2.9.0) - rspec-core (2.9.0) - rspec-expectations (2.9.0) + rspec (2.10.0) + rspec-core (~> 2.10.0) + rspec-expectations (~> 2.10.0) + rspec-mocks (~> 2.10.0) + rspec-core (2.10.1) + rspec-expectations (2.10.0) diff-lcs (~> 1.1.3) - rspec-mocks (2.9.0) - rspec-rails (2.9.0) + rspec-mocks (2.10.1) + rspec-rails (2.10.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec (~> 2.9.0) - ruby-debug-base19 (0.11.25) - columnize (>= 0.3.1) - linecache19 (>= 0.5.11) - ruby_core_source (>= 0.1.4) - ruby-debug19 (0.11.6) - columnize (>= 0.3.1) - linecache19 (>= 0.5.11) - ruby-debug-base19 (>= 0.11.19) - ruby_core_source (0.1.5) - archive-tar-minitar (>= 0.5.2) - rubyzip (0.9.6.1) - sass (3.1.15) + rspec (~> 2.10.0) + rubyzip (0.9.9) + sass (3.1.19) sass-rails (3.2.5) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) - selenium-webdriver (2.20.0) + selenium-webdriver (2.24.0) childprocess (>= 0.2.5) - ffi (~> 1.0) + libwebsocket (~> 0.1.3) multi_json (~> 1.0) rubyzip - sprockets (2.1.2) + slop (2.4.4) + sprockets (2.1.3) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - thor (0.14.6) + thin (1.3.1) + daemons (>= 1.0.9) + eventmachine (>= 0.12.6) + rack (>= 1.0.0) + thor (0.15.3) tilt (1.3.3) - tinymce-rails (3.4.9) + tinymce-rails (3.5.2) railties (>= 3.1.1) treetop (1.4.10) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.32) + tzinfo (0.3.33) warden (1.1.1) rack (>= 1.0) xpath (0.1.4) @@ -223,15 +225,16 @@ DEPENDENCIES cmtool! coffee-script couch_potato! - devise + devise (= 2.0.4) devise_simply_stored email_validator factory_girl_rails haml-rails jquery-rails paperclip + pry rspec-rails - ruby-debug19 sass-rails simply_stored! + thin tinymce-rails diff --git a/app/helpers/cmtool/application_helper.rb b/app/helpers/cmtool/application_helper.rb index 8d36441..8820d91 100644 --- a/app/helpers/cmtool/application_helper.rb +++ b/app/helpers/cmtool/application_helper.rb @@ -29,7 +29,7 @@ module Cmtool alias are_you_sure? are_you_sure def warnings - @cmtool_warnings + @cmtool_warnings || [] end def boolean_text(yes) diff --git a/config/routes.rb b/config/routes.rb index 529821d..cf849d0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -27,10 +27,14 @@ Cmtool::Engine.routes.draw do # ADMIN FORMS resources :contact_forms do - post :add + collection do + post :add + end end resources :newsletter_subscriptions do - post :add + collection do + post :add + end end # USER MANAGEMENT diff --git a/lib/cmtool/engine.rb b/lib/cmtool/engine.rb index 04631cf..f5240fe 100644 --- a/lib/cmtool/engine.rb +++ b/lib/cmtool/engine.rb @@ -1,3 +1,4 @@ +=begin require 'couch_potato' require 'simply_stored' require 'email_validator' @@ -9,8 +10,14 @@ require 'tinymce-rails' require 'paperclip' require 'jquery-rails' require 'bourbon' +=end module Cmtool class Engine < ::Rails::Engine isolate_namespace Cmtool + initializer "cmtool" do + end + ActiveSupport.on_load(:action_view) do + ::ActionView::Base.send :include, Cmtool::ApplicationHelper + end end end diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb new file mode 100644 index 0000000..f8e4094 --- /dev/null +++ b/spec/controllers/pages_controller_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe Cmtool::PagesController do + describe 'GET index' do + it "should render standard view when tree is available" do + #binding.pry + create_pages_tree + ->{ get :index }.should_not raise_error + end + end + + +end diff --git a/spec/dummy/config/couchdb.yml b/spec/dummy/config/couchdb.yml index 4603844..38238b2 100644 --- a/spec/dummy/config/couchdb.yml +++ b/spec/dummy/config/couchdb.yml @@ -3,7 +3,7 @@ development: database: cmtool test: validation_framework: :active_model #optional - database: cmtool + database: cmtool_test production: validation_framework: :active_model #optional database: cmtool diff --git a/spec/dummy/config/initializers/use_pry.rb b/spec/dummy/config/initializers/use_pry.rb new file mode 100644 index 0000000..cd325c1 --- /dev/null +++ b/spec/dummy/config/initializers/use_pry.rb @@ -0,0 +1,10 @@ +Dummy::Application.configure do + # Use Pry instead of IRB + silence_warnings do + begin + require 'pry' + IRB = Pry + rescue LoadError + end + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d61bb91..6d8130a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,6 +19,7 @@ Capybara.default_driver = :selenium RSpec.configure do |config| config.mock_with :rspec config.include FactoryGirl::Syntax::Methods + #config.application = Cmtool::Engine #config.include CompanyFactory config.include Cmtool::Engine.routes.url_helpers config.include Devise::TestHelpers, :type => :controller @@ -35,6 +36,10 @@ RSpec.configure do |config| #render_views end + config.before :each do + @routes = Cmtool::Engine.routes + end + config.before :all do end config.before :each, type: :request do