Permalink
Browse files

Update specs and sandbox app config for Rails 4

  • Loading branch information...
1 parent fc41c6d commit 951dbeb8d6ec217718e43e76e8fedd3c8cfc51f0 @spohlenz committed May 5, 2013
View
1 gemfiles/rails-3.1.gemfile
@@ -4,7 +4,6 @@ gem 'rails', '3.1.12'
group :test do
gem "rspec-rails"
- gem "guard-rspec"
gem "capybara", "~> 2.0.2"
end
View
1 gemfiles/rails-3.2.gemfile
@@ -4,7 +4,6 @@ gem 'rails', '3.2.13'
group :test do
gem "rspec-rails"
- gem "guard-rspec"
gem "capybara", "~> 2.0.2"
end
View
1 gemfiles/rails-4.0.gemfile
@@ -4,7 +4,6 @@ gem 'rails', :github => "rails/rails", :branch => "4-0-stable"
group :test do
gem "rspec-rails"
- gem "guard-rspec"
gem "capybara", "~> 2.0.2"
end
View
3 sandbox/config/environments/development.rb
@@ -5,6 +5,9 @@
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
+
+ # Do not eager load code on boot.
+ config.eager_load = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
View
6 sandbox/config/environments/production.rb
@@ -3,6 +3,12 @@
# Code is not reloaded between requests
config.cache_classes = true
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both thread web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
View
8 sandbox/config/environments/test.rb
@@ -6,14 +6,16 @@
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
+
+ # Do not eager load code on boot. This avoids loading your whole application
+ # just for the purpose of running a single test. If you are using a tool that
+ # preloads Rails for running tests, you may have to set it to true.
+ config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_assets = true
config.static_cache_control = "public, max-age=3600"
- # Log error messages when you accidentally call methods on nil
- config.whiny_nils = true
-
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
View
4 sandbox/config/initializers/secret_token.rb
@@ -5,3 +5,7 @@
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Sandbox::Application.config.secret_token = '10b31f60e3e66ae0d844e2dda97aa51d731e1623401e82bd2b82e5a7c62b974c582d01238d7f928125326122853c3e8d973b26610b9aaee9f29416359c7a26cc'
+
+# Make sure your secret_key_base is kept private
+# if you're sharing your code publicly.
+Sandbox::Application.config.secret_key_base = '10b31f60e3e66ae0d844e2dda97aa51d731e1623401e82bd2b82e5a7c62b974c582d01238d7f928125326122853c3e8d973b26610b9aaee9f29416359c7a26cc'
View
2 sandbox/config/routes.rb
@@ -1,4 +1,4 @@
Sandbox::Application.routes.draw do
- match ':action', :controller => "editor"
+ get ':action', :controller => "editor"
root :to => "editor#index"
end
View
13 spec/helpers/helper_spec.rb
@@ -2,11 +2,18 @@
module TinyMCE::Rails
describe Helper do
- include Sprockets::Helpers::RailsHelper
+ if defined?(Sprockets::Rails::Helper)
+ include Sprockets::Rails::Helper
+
+ self.assets_environment = Rails.application.assets
+ self.assets_prefix = Rails.application.config.assets.prefix
+ else
+ include Sprockets::Helpers::RailsHelper
+ end
describe "#tinymce_assets" do
it "returns a TinyMCE javascript tag" do
- tinymce_assets.should have_selector("script[type='text/javascript'][src='/assets/tinymce.js']")
+ tinymce_assets.should have_selector("script[src='/assets/tinymce.js']")
end
end
@@ -22,7 +29,7 @@ module TinyMCE::Rails
it "initializes TinyMCE using global configuration" do
result = tinymce
- result.should have_selector("script[type='text/javascript']")
+ result.should have_selector("script")
result.should include('tinyMCE.init({')
result.should include('"theme":"advanced"')
result.should include('"plugins":"paste,table,fullscreen"')
View
11 spec/spec_helper.rb
@@ -1,13 +1,16 @@
ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../../sandbox/config/environment", __FILE__)
+
+require File.expand_path("../../sandbox/config/application", __FILE__)
+
+Sandbox::Application.config.assets.paths << File.expand_path("../assets", __FILE__)
+Sandbox::Application.initialize!
+
require 'rspec/rails'
require 'rspec/autorun'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
-Dir[File.expand_path("../support/**/*.rb", __FILE__)].each {|f| require f}
-
-Rails.application.assets.append_path File.expand_path("../assets", __FILE__)
+Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
RSpec.configure do |config|
end

0 comments on commit 951dbeb

Please sign in to comment.