caching_matcher 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,3 @@
1
+ == 0.1.0 / 2010-09-07
2
+
3
+ * First release as gem
data/README.txt ADDED
@@ -0,0 +1,75 @@
1
+ caching_matcher
2
+ by Wolfram Arnold; Mighyverse.com; WTA Consulting, Inc.
3
+ http://github.com/mightyverse/caching_matcher
4
+
5
+ == DESCRIPTION:
6
+
7
+ An rspec custom matcher to assert Rails action and fragment caching.
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Assert fragment caching with custom keys
12
+ * Assert action caching by URL
13
+ * Works only with memcached backend
14
+ * There are unresolved issues with the :format URL parameter (.xml, .json, ...)
15
+
16
+ == SYNOPSIS:
17
+
18
+ In test.rb turn on caching and set cache_store to memcache:
19
+
20
+ config.action_controller.perform_caching = true
21
+ config.cache_store = :mem_cache_store
22
+
23
+
24
+ In spec_helper.rb, add into the config block:
25
+
26
+ config.include(CachingMatcher)
27
+ config.before { ActionController::Base.cache_store.clear }
28
+
29
+
30
+ In RSpec Controller Tests:
31
+
32
+ lambda {
33
+ get :index
34
+ }.should be_cached(controller, :action => 'index')
35
+
36
+ lambda {
37
+ get :edit, :id => 5
38
+ }.should_not be_cached(controller, :action => 'edit', :id => 5)
39
+
40
+ lambda {
41
+ delete :destroy, :id => 5
42
+ }.should expire(controller, :action => 'index')
43
+
44
+ should_not expire is also available.
45
+
46
+ == REQUIREMENTS:
47
+
48
+ * memcached backend
49
+
50
+ == INSTALL:
51
+
52
+ * gem install caching_matcher
53
+
54
+ == LICENSE:
55
+
56
+ Copyright (c) 2009-2010 Wolfram Arnold; Mightyverse, Inc.; WTA Consulting, Inc.
57
+
58
+ Permission is hereby granted, free of charge, to any person obtaining
59
+ a copy of this software and associated documentation files (the
60
+ 'Software'), to deal in the Software without restriction, including
61
+ without limitation the rights to use, copy, modify, merge, publish,
62
+ distribute, sublicense, and/or sell copies of the Software, and to
63
+ permit persons to whom the Software is furnished to do so, subject to
64
+ the following conditions:
65
+
66
+ The above copyright notice and this permission notice shall be
67
+ included in all copies or substantial portions of the Software.
68
+
69
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
70
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
71
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
72
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
73
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
74
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
75
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+
2
+ begin
3
+ require 'bones'
4
+ rescue LoadError
5
+ abort '### Please install the "bones" gem ###'
6
+ end
7
+
8
+ task :default => 'test:run'
9
+ task 'gem:release' => 'test:run'
10
+
11
+ Bones {
12
+ name 'caching_matcher'
13
+ authors 'Wolfram Arnold'
14
+ email 'wolfram@rubyfocus.biz'
15
+ url 'http://github.com/mightyverse/caching_matcher'
16
+ ignore_file '.gitignore'
17
+ depend_on 'rails', :version => '2.3.8', :development => true
18
+ depend_on 'activesupport', :version => '2.3.8', :development => true
19
+ depend_on 'actionpack', :version => '2.3.8', :development => true
20
+ depend_on 'rspec', :version => '>=1.3.0', :development => true
21
+ depend_on 'rspec-rails', :version => '>=1.3.2', :development => true
22
+ }
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(
4
+ File.join(File.dirname(__FILE__), %w[.. lib caching_matcher]))
5
+
6
+ # Put your code here
7
+
@@ -0,0 +1,51 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{caching_matcher}
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Wolfram Arnold"]
9
+ s.date = %q{2010-09-07}
10
+ s.default_executable = %q{caching_matcher}
11
+ s.description = %q{An rspec custom matcher to assert Rails action and fragment caching.}
12
+ s.email = %q{wolfram@rubyfocus.biz}
13
+ s.executables = ["caching_matcher"]
14
+ s.extra_rdoc_files = ["History.txt", "README.txt", "bin/caching_matcher", "version.txt"]
15
+ s.files = ["History.txt", "README.txt", "Rakefile", "bin/caching_matcher", "lib/caching_matcher.rb", "lib/caching_matcher/caching_matcher.rb", "spec/controllers/caching_matcher_spec.rb", "spec/mock_app/app/controllers/application_controller.rb", "spec/mock_app/app/controllers/items_controller.rb", "spec/mock_app/config/boot.rb", "spec/mock_app/config/environment.rb", "spec/mock_app/config/environments/test.rb", "spec/mock_app/config/initializers/cookie_verification_secret.rb", "spec/mock_app/config/initializers/mime_types.rb", "spec/mock_app/config/initializers/new_rails_defaults.rb", "spec/mock_app/config/initializers/session_store.rb", "spec/mock_app/config/locales/en.yml", "spec/mock_app/config/routes.rb", "spec/mock_app/log/test.log", "spec/spec_helper.rb", "test/test_caching_matcher.rb", "version.txt"]
16
+ s.homepage = %q{http://github.com/mightyverse/caching_matcher}
17
+ s.rdoc_options = ["--main", "README.txt"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{caching_matcher}
20
+ s.rubygems_version = %q{1.3.7}
21
+ s.summary = %q{An rspec custom matcher to assert Rails action and fragment caching}
22
+ s.test_files = ["test/test_caching_matcher.rb"]
23
+
24
+ if s.respond_to? :specification_version then
25
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
26
+ s.specification_version = 3
27
+
28
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
29
+ s.add_development_dependency(%q<rails>, [">= 2.3.8"])
30
+ s.add_development_dependency(%q<activesupport>, [">= 2.3.8"])
31
+ s.add_development_dependency(%q<actionpack>, [">= 2.3.8"])
32
+ s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
33
+ s.add_development_dependency(%q<rspec-rails>, [">= 1.3.2"])
34
+ s.add_development_dependency(%q<bones>, [">= 3.4.7"])
35
+ else
36
+ s.add_dependency(%q<rails>, [">= 2.3.8"])
37
+ s.add_dependency(%q<activesupport>, [">= 2.3.8"])
38
+ s.add_dependency(%q<actionpack>, [">= 2.3.8"])
39
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
40
+ s.add_dependency(%q<rspec-rails>, [">= 1.3.2"])
41
+ s.add_dependency(%q<bones>, [">= 3.4.7"])
42
+ end
43
+ else
44
+ s.add_dependency(%q<rails>, [">= 2.3.8"])
45
+ s.add_dependency(%q<activesupport>, [">= 2.3.8"])
46
+ s.add_dependency(%q<actionpack>, [">= 2.3.8"])
47
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
48
+ s.add_dependency(%q<rspec-rails>, [">= 1.3.2"])
49
+ s.add_dependency(%q<bones>, [">= 3.4.7"])
50
+ end
51
+ end
@@ -0,0 +1,99 @@
1
+ module CachingMatcher
2
+
3
+ class MatcherBase
4
+ # first argument: controller
5
+ # second arg: either a path string or hash of url options
6
+ def initialize(controller, path_arg)
7
+ @controller = controller
8
+ compute_cache_key(path_arg)
9
+ end
10
+
11
+ attr_reader :cache_key
12
+
13
+ private
14
+
15
+ def compute_cache_key(path_arg)
16
+ case path_arg
17
+ when String
18
+ path = path_arg
19
+ when Hash
20
+ url_options = path_arg.merge(:controller => @controller.class.to_s.underscore.split(/_controller/).first)
21
+ path = ActionController::Caching::Actions::ActionCachePath.path_for(@controller, url_options, true)
22
+ else
23
+ raise "Argument to be_cached and be_expired must be controller, followed by a path as string or URL hash"
24
+ end
25
+ @cache_key = @controller.fragment_cache_key(path)
26
+ end
27
+
28
+ protected
29
+
30
+ def run_match(event_proc)
31
+ @before = ActionController::Base.cache_store.exist?(@cache_key)
32
+ event_proc.call
33
+ @after = ActionController::Base.cache_store.exist?(@cache_key)
34
+ end
35
+ end
36
+
37
+ def prime_cache(controller, url_options)
38
+ mb = MatcherBase.new(controller, url_options)
39
+ ActionController::Base.cache_store.write(mb.cache_key, "Some data")
40
+ end
41
+
42
+ def clear_cache(controller, url_options)
43
+ mb = MatcherBase.new(controller, url_options)
44
+ ActionController::Base.cache_store.delete(mb.cache_key)
45
+ end
46
+
47
+ class BeCachedMatcher < MatcherBase
48
+
49
+ def matches?(event_proc)
50
+ run_match(event_proc)
51
+ !@before && @after
52
+ end
53
+
54
+ def failure_message_for_should
55
+ if @before
56
+ "Key: #{@cache_key} was cached before operation. Did you forget to call ActionController::Base.cache_store.clear in the before block?"
57
+ elsif !@after
58
+ "Key: #{@cache_key} was not cached after operation but should have been."
59
+ end
60
+ end
61
+
62
+ def failure_message_for_should_not
63
+ if @after
64
+ "Key: #{@cache_key} was cached after operation but should not have been."
65
+ end
66
+ end
67
+ end
68
+
69
+ def be_cached(controller,url_options)
70
+ BeCachedMatcher.new(controller,url_options)
71
+ end
72
+
73
+ class BeExpiredMatcher < MatcherBase
74
+ def matches?(event_proc)
75
+ run_match(event_proc)
76
+ @before && !@after
77
+ end
78
+ def failure_message_for_should
79
+ if !@before
80
+ "Key: #{@cache_key} was not cached before operation but should have been. Did you forget to prime the cache?"
81
+ elsif @after
82
+ "Key: #{@cache_key} was cached after operation but should not have been."
83
+ end
84
+ end
85
+
86
+ def failure_message_for_should_not
87
+ if @before
88
+ "Key: #{@cache_key} was cached before operation but should not have been. Did you forget to clear the cache in a before block?"
89
+ elsif !@after
90
+ "Key: #{@cache_key} was not cached after operation but should have been."
91
+ end
92
+ end
93
+ end
94
+
95
+ def be_expired(controller,url_options)
96
+ BeExpiredMatcher.new(controller,url_options)
97
+ end
98
+
99
+ end
@@ -0,0 +1,65 @@
1
+
2
+ module CachingMatcher
3
+
4
+ # :stopdoc:
5
+ LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
6
+ PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
7
+ # :startdoc:
8
+
9
+ # Returns the version string for the library.
10
+ #
11
+ def self.version
12
+ @version ||= File.read(path('version.txt')).strip
13
+ end
14
+
15
+ # Returns the library path for the module. If any arguments are given,
16
+ # they will be joined to the end of the libray path using
17
+ # <tt>File.join</tt>.
18
+ #
19
+ def self.libpath( *args, &block )
20
+ rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
21
+ if block
22
+ begin
23
+ $LOAD_PATH.unshift LIBPATH
24
+ rv = block.call
25
+ ensure
26
+ $LOAD_PATH.shift
27
+ end
28
+ end
29
+ return rv
30
+ end
31
+
32
+ # Returns the lpath for the module. If any arguments are given,
33
+ # they will be joined to the end of the path using
34
+ # <tt>File.join</tt>.
35
+ #
36
+ def self.path( *args, &block )
37
+ rv = args.empty? ? PATH : ::File.join(PATH, args.flatten)
38
+ if block
39
+ begin
40
+ $LOAD_PATH.unshift PATH
41
+ rv = block.call
42
+ ensure
43
+ $LOAD_PATH.shift
44
+ end
45
+ end
46
+ return rv
47
+ end
48
+
49
+ # Utility method used to require all files ending in .rb that lie in the
50
+ # directory below this file that has the same name as the filename passed
51
+ # in. Optionally, a specific _directory_ name can be passed in such that
52
+ # the _filename_ does not have to be equivalent to the directory.
53
+ #
54
+ def self.require_all_libs_relative_to( fname, dir = nil )
55
+ dir ||= ::File.basename(fname, '.*')
56
+ search_me = ::File.expand_path(
57
+ ::File.join(::File.dirname(fname), dir, '**', '*.rb'))
58
+
59
+ Dir.glob(search_me).sort.each {|rb| require rb}
60
+ end
61
+
62
+ end # module CachingMatcher
63
+
64
+ CachingMatcher.require_all_libs_relative_to(__FILE__)
65
+
@@ -0,0 +1,64 @@
1
+ require File.join(File.dirname(__FILE__), %w[.. spec_helper])
2
+
3
+ describe CachingMatcher do
4
+ controller_name :items
5
+
6
+ context "Caching Assertions" do
7
+ it 'reports cached' do
8
+ lambda {
9
+ get :index
10
+ }.should be_cached(controller, :action => 'index')
11
+ end
12
+
13
+ it 'reports uncached' do
14
+ lambda {
15
+ get :edit, :id => 5
16
+ }.should_not be_cached(controller, :action => 'edit', :id => 5)
17
+ end
18
+ end
19
+
20
+ context "Expiry Assertions" do
21
+ it 'reports expired' do
22
+ prime_cache(controller, :action => 'index')
23
+ lambda {
24
+ delete :destroy, :id => 5
25
+ }.should be_expired(controller, :action => 'index')
26
+ end
27
+
28
+ it 'reports unexpired' do
29
+ prime_cache(controller, :action => 'index')
30
+ lambda {
31
+ delete :edit, :id => 5
32
+ }.should_not be_expired(controller, :action => 'index')
33
+ end
34
+ end
35
+
36
+ context "Helpers" do
37
+ it 'can prime the cache programmatically with url hash' do
38
+ lambda {
39
+ prime_cache(controller, :action => 'index')
40
+ }.should be_cached(controller, :action => 'index')
41
+ end
42
+
43
+ it 'can prime the cache programmatically with path' do
44
+ lambda {
45
+ prime_cache(controller, 'hello_world')
46
+ }.should be_cached(controller, 'hello_world')
47
+ end
48
+
49
+ it 'can clear the cache programmatically with url hash' do
50
+ prime_cache(controller, :action => 'index')
51
+ lambda {
52
+ clear_cache(controller, :action => 'index')
53
+ }.should be_expired(controller, :action => 'index')
54
+ end
55
+
56
+ it 'can clear the cache programmatically with path' do
57
+ prime_cache(controller, 'hello_world')
58
+ lambda {
59
+ clear_cache(controller, 'hello_world')
60
+ }.should be_expired(controller, 'hello_world')
61
+ end
62
+ end
63
+ end
64
+
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,17 @@
1
+ class ItemsController < ApplicationController
2
+
3
+ caches_action :index
4
+
5
+ def index
6
+ render :text => "Index"
7
+ end
8
+
9
+ def edit
10
+ render :text => "Edit"
11
+ end
12
+
13
+ def destroy
14
+ expire_action url_for(:action => 'index')
15
+ render :text => "Destroy"
16
+ end
17
+ end
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,41 @@
1
+ # Be sure to restart your server when you modify this file
2
+
3
+ # Specifies gem version of Rails to use when vendor/rails is not present
4
+ RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
5
+
6
+ # Bootstrap the Rails environment, frameworks, and default configuration
7
+ require File.join(File.dirname(__FILE__), 'boot')
8
+
9
+ Rails::Initializer.run do |config|
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+
14
+ # Add additional load paths for your own custom dirs
15
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
16
+
17
+ # Specify gems that this application depends on and have them installed with rake gems:install
18
+ # config.gem "bj"
19
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
20
+ # config.gem "sqlite3-ruby", :lib => "sqlite3"
21
+ # config.gem "aws-s3", :lib => "aws/s3"
22
+
23
+ # Only load the plugins named here, in the order given (default is alphabetical).
24
+ # :all can be used as a placeholder for all plugins not explicitly named
25
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
26
+
27
+ # Skip frameworks you're not going to use. To use Rails without a database,
28
+ # you must remove the Active Record framework.
29
+ config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
30
+
31
+ # Activate observers that should always be running
32
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
33
+
34
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
35
+ # Run "rake -D time" for a list of tasks for finding time zone names.
36
+ config.time_zone = 'UTC'
37
+
38
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
39
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
40
+ # config.i18n.default_locale = :de
41
+ end
@@ -0,0 +1,32 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = true
15
+ config.action_view.cache_template_loading = true
16
+
17
+ # Disable request forgery protection in test environment
18
+ config.action_controller.allow_forgery_protection = false
19
+
20
+ # Tell Action Mailer not to deliver emails to the real world.
21
+ # The :test delivery method accumulates sent emails in the
22
+ # ActionMailer::Base.deliveries array.
23
+ config.action_mailer.delivery_method = :test
24
+
25
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
26
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
27
+ # like if you have constraints or database-specific column types
28
+ # config.active_record.schema_format = :sql
29
+
30
+ config.gem 'rspec-rails', :version => '>= 1.3.2', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
31
+
32
+ config.cache_store = :mem_cache_store
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.cookie_verifier_secret = '97cc4e208746ae1bfd9b85841756b44eebde353bc08ffe28ceb9dbc5ac0f50c251942710072fbafd5944e7efaabeccf83ffdbcb6fae386a79f8f6f3e7c951591';
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,21 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ ActionController::Routing.generate_best_match = false
15
+
16
+ # Use ISO 8601 format for JSON serialized times and dates.
17
+ ActiveSupport.use_standard_json_time_format = true
18
+
19
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
20
+ # if you're including raw json in an HTML page.
21
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying cookie session data integrity.
4
+ # If you change this key, all old sessions will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.session = {
8
+ :key => '_rails-2.3.8_session',
9
+ :secret => 'd284ec0e18b0d49b380996f29145d500b197492931a18c8c9c2d120e322e64511b810f914bb0d332a72d234ce2ad7e4d65c8e7e28a6beadf00113ac40de0626f'
10
+ }
11
+
12
+ # Use the database for sessions instead of the cookie-based default,
13
+ # which shouldn't be used to store highly confidential information
14
+ # (create the session table with "rake db:sessions:create")
15
+ # ActionController::Base.session_store = :active_record_store
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,4 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ map.connect ':controller/:action/:id'
3
+ map.connect ':controller/:action/:id.:format'
4
+ end