├── .bundle
└── install.log
├── .gitignore
├── .rspec
├── .travis.yml
├── Gemfile
├── README.md
├── Rakefile
├── lib
├── mongo_session_store-rails3.rb
├── mongo_session_store-rails4.rb
├── mongo_session_store.rb
└── mongo_session_store
│ ├── mongo_mapper_store.rb
│ ├── mongo_store.rb
│ ├── mongo_store_base.rb
│ ├── mongoid_store.rb
│ └── version.rb
├── mongo_session_store-rails3.gemspec
├── mongo_session_store-rails4.gemspec
├── perf
└── benchmark.rb
└── spec
├── integration_with_devise_spec.rb
├── mongo_store_base_spec.rb
├── rails_3.1_app
├── .gitignore
├── README
├── Rakefile
├── app
│ ├── assets
│ │ ├── javascripts
│ │ │ └── application.js
│ │ └── stylesheets
│ │ │ └── application.css
│ ├── controllers
│ │ ├── application_controller.rb
│ │ └── home_controller.rb
│ ├── helpers
│ │ └── application_helper.rb
│ ├── mailers
│ │ └── .gitkeep
│ ├── models
│ │ ├── .gitkeep
│ │ └── user.rb
│ └── views
│ │ ├── devise
│ │ ├── confirmations
│ │ │ └── new.html.erb
│ │ ├── mailer
│ │ │ ├── confirmation_instructions.html.erb
│ │ │ ├── reset_password_instructions.html.erb
│ │ │ └── unlock_instructions.html.erb
│ │ ├── passwords
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── registrations
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── sessions
│ │ │ └── new.html.erb
│ │ ├── shared
│ │ │ └── _links.erb
│ │ └── unlocks
│ │ │ └── new.html.erb
│ │ ├── home
│ │ └── index.html.erb
│ │ └── layouts
│ │ └── application.html.erb
├── config.ru
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── devise.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── secret_token.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ ├── devise.en.yml
│ │ └── en.yml
│ ├── mongo.yml
│ ├── mongoid.yml
│ └── routes.rb
├── db
│ ├── migrate
│ │ └── 20120222195914_create_users_table.rb
│ └── schema.rb
├── lib
│ └── tasks
│ │ └── .gitkeep
├── log
│ └── .gitkeep
├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
├── script
│ └── rails
└── vendor
│ ├── assets
│ └── stylesheets
│ │ └── .gitkeep
│ └── plugins
│ └── .gitkeep
├── rails_3.2_app
├── .gitignore
├── README
├── Rakefile
├── app
│ ├── assets
│ │ ├── javascripts
│ │ │ └── application.js
│ │ └── stylesheets
│ │ │ └── application.css
│ ├── controllers
│ │ ├── application_controller.rb
│ │ └── home_controller.rb
│ ├── helpers
│ │ └── application_helper.rb
│ ├── mailers
│ │ └── .gitkeep
│ ├── models
│ │ ├── .gitkeep
│ │ └── user.rb
│ └── views
│ │ ├── devise
│ │ ├── confirmations
│ │ │ └── new.html.erb
│ │ ├── mailer
│ │ │ ├── confirmation_instructions.html.erb
│ │ │ ├── reset_password_instructions.html.erb
│ │ │ └── unlock_instructions.html.erb
│ │ ├── passwords
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── registrations
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── sessions
│ │ │ └── new.html.erb
│ │ ├── shared
│ │ │ └── _links.erb
│ │ └── unlocks
│ │ │ └── new.html.erb
│ │ ├── home
│ │ └── index.html.erb
│ │ └── layouts
│ │ └── application.html.erb
├── config.ru
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── devise.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── secret_token.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ ├── devise.en.yml
│ │ └── en.yml
│ ├── mongo.yml
│ ├── mongoid.yml
│ └── routes.rb
├── db
│ ├── migrate
│ │ └── 20120222195914_create_users_table.rb
│ └── schema.rb
├── lib
│ └── tasks
│ │ └── .gitkeep
├── log
│ └── .gitkeep
├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
├── script
│ └── rails
└── vendor
│ ├── assets
│ └── stylesheets
│ │ └── .gitkeep
│ └── plugins
│ └── .gitkeep
├── rails_4.0_app
├── .gitignore
├── Rakefile
├── app
│ ├── assets
│ │ ├── images
│ │ │ └── .keep
│ │ ├── javascripts
│ │ │ └── application.js
│ │ └── stylesheets
│ │ │ └── application.css
│ ├── controllers
│ │ ├── application_controller.rb
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── home_controller.rb
│ ├── helpers
│ │ └── application_helper.rb
│ ├── mailers
│ │ └── .keep
│ ├── models
│ │ ├── .keep
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── user.rb
│ └── views
│ │ ├── devise
│ │ ├── confirmations
│ │ │ └── new.html.erb
│ │ ├── mailer
│ │ │ ├── confirmation_instructions.html.erb
│ │ │ ├── reset_password_instructions.html.erb
│ │ │ └── unlock_instructions.html.erb
│ │ ├── passwords
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── registrations
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── sessions
│ │ │ └── new.html.erb
│ │ ├── shared
│ │ │ └── _links.erb
│ │ └── unlocks
│ │ │ └── new.html.erb
│ │ ├── home
│ │ └── index.html.erb
│ │ └── layouts
│ │ └── application.html.erb
├── bin
│ ├── bundle
│ ├── rails
│ └── rake
├── config.ru
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── devise.rb
│ │ ├── filter_parameter_logging.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── secret_token.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ ├── devise.en.yml
│ │ └── en.yml
│ ├── mongo.yml
│ ├── mongoid.yml
│ └── routes.rb
├── db
│ ├── migrate
│ │ └── 20140301171212_add_devise_users.rb
│ ├── schema.rb
│ └── seeds.rb
├── lib
│ ├── assets
│ │ └── .keep
│ └── tasks
│ │ └── .keep
├── log
│ └── .keep
└── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
├── rails_4.1_app
├── .gitignore
├── Rakefile
├── app
│ ├── assets
│ │ ├── images
│ │ │ └── .keep
│ │ ├── javascripts
│ │ │ └── application.js
│ │ └── stylesheets
│ │ │ └── application.css
│ ├── controllers
│ │ ├── application_controller.rb
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── home_controller.rb
│ ├── helpers
│ │ └── application_helper.rb
│ ├── mailers
│ │ └── .keep
│ ├── models
│ │ ├── .keep
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── user.rb
│ └── views
│ │ ├── devise
│ │ ├── confirmations
│ │ │ └── new.html.erb
│ │ ├── mailer
│ │ │ ├── confirmation_instructions.html.erb
│ │ │ ├── reset_password_instructions.html.erb
│ │ │ └── unlock_instructions.html.erb
│ │ ├── passwords
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── registrations
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── sessions
│ │ │ └── new.html.erb
│ │ ├── shared
│ │ │ └── _links.erb
│ │ └── unlocks
│ │ │ └── new.html.erb
│ │ ├── home
│ │ └── index.html.erb
│ │ └── layouts
│ │ └── application.html.erb
├── bin
│ ├── bundle
│ ├── rails
│ ├── rake
│ └── spring
├── config.ru
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── cookies_serializer.rb
│ │ ├── devise.rb
│ │ ├── filter_parameter_logging.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ ├── devise.en.yml
│ │ └── en.yml
│ ├── mongo.yml
│ ├── mongoid.yml
│ ├── routes.rb
│ └── secrets.yml
├── db
│ ├── migrate
│ │ └── 20140301171212_add_devise_users.rb
│ ├── schema.rb
│ └── seeds.rb
├── lib
│ ├── assets
│ │ └── .keep
│ └── tasks
│ │ └── .keep
├── log
│ └── .keep
└── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
├── rails_4.2_app
├── .gitignore
├── Rakefile
├── app
│ ├── assets
│ │ ├── images
│ │ │ └── .keep
│ │ ├── javascripts
│ │ │ └── application.js
│ │ └── stylesheets
│ │ │ └── application.css
│ ├── controllers
│ │ ├── application_controller.rb
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── home_controller.rb
│ ├── helpers
│ │ └── application_helper.rb
│ ├── mailers
│ │ └── .keep
│ ├── models
│ │ ├── .keep
│ │ ├── concerns
│ │ │ └── .keep
│ │ └── user.rb
│ └── views
│ │ ├── devise
│ │ ├── confirmations
│ │ │ └── new.html.erb
│ │ ├── mailer
│ │ │ ├── confirmation_instructions.html.erb
│ │ │ ├── reset_password_instructions.html.erb
│ │ │ └── unlock_instructions.html.erb
│ │ ├── passwords
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── registrations
│ │ │ ├── edit.html.erb
│ │ │ └── new.html.erb
│ │ ├── sessions
│ │ │ └── new.html.erb
│ │ ├── shared
│ │ │ └── _links.erb
│ │ └── unlocks
│ │ │ └── new.html.erb
│ │ ├── home
│ │ └── index.html.erb
│ │ └── layouts
│ │ └── application.html.erb
├── bin
│ ├── bundle
│ ├── rails
│ ├── rake
│ ├── setup
│ └── spring
├── config.ru
├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── assets.rb
│ │ ├── backtrace_silencers.rb
│ │ ├── cookies_serializer.rb
│ │ ├── devise.rb
│ │ ├── filter_parameter_logging.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ └── en.yml
│ ├── mongo.yml
│ ├── mongoid.yml
│ ├── routes.rb
│ └── secrets.yml
├── db
│ ├── migrate
│ │ └── 20140301171212_add_devise_users.rb
│ ├── schema.rb
│ └── seeds.rb
├── lib
│ ├── assets
│ │ └── .keep
│ └── tasks
│ │ └── .keep
├── log
│ └── .keep
└── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── favicon.ico
│ └── robots.txt
├── rails_helper.rb
└── spec_helper.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | /pkg
3 | /doc
4 | /coverage
5 | Gemfile.lock
6 | Gemfile_Rails_*.lock
7 | *.gem
8 | .rvmrc
9 | *.swo
10 | *.swp
11 |
--------------------------------------------------------------------------------
/.rspec:
--------------------------------------------------------------------------------
1 | --color
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | script: "rake"
3 | rvm:
4 | - 1.9.3
5 | - 2.0.0
6 | - 2.1.5
7 | - "2.2"
8 | - ruby-head
9 | - jruby-19mode
10 | - jruby-head
11 | - rbx-2.2.9
12 | matrix:
13 | allow_failures:
14 | - rvm: jruby-head
15 | - rvm: ruby-head
16 | - rvm: rbx-2.2.9
17 | before_script:
18 | - wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.1.tgz -O /tmp/mongodb.tgz
19 | - tar -xvf /tmp/mongodb.tgz
20 | - mkdir /tmp/data
21 | - ${PWD}/mongodb-linux-x86_64-3.0.1/bin/mongod --dbpath /tmp/data --bind_ip 127.0.0.1 &> /dev/null &
22 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | RAILS_VERS = case ENV['RAILS_VERS']
4 | when '3.1'
5 | '~>3.1.12'
6 | when '3.2'
7 | '~>3.2.18'
8 | when '4.0'
9 | '~>4.0.5'
10 | when '4.1'
11 | '~>4.1.9'
12 | when '4.2'
13 | '~>4.2.0'
14 | when nil
15 | nil
16 | else
17 | raise "Invalid RAILS_VERS. Available versions are 3.1, 3.2, 4.0, 4.1, and 4.2."
18 | end
19 |
20 | gemspec :name => 'mongo_session_store-rails4'
21 |
22 | group :development, :test do
23 | gem 'rake'
24 |
25 | case ENV['MONGO_SESSION_STORE_ORM']
26 | when 'mongo_mapper'
27 | gem 'mongo_mapper', '>= 0.13.1'
28 | when 'mongoid'
29 | if ENV['RAILS_VERS'] =~ /^4\.\d/
30 | gem 'mongoid', '>= 4.0.2'
31 | elsif ENV['RAILS_VERS'] =~ /^3\.2\d/
32 | gem 'mongoid', '>= 3.1.0'
33 | else
34 | gem 'mongoid', '>= 3.0.0'
35 | end
36 | when 'mongo'
37 | gem 'mongo'
38 | else
39 | gem 'mongo' # So rake test_all can wait for Mongo to start
40 | end
41 |
42 | gem 'pry'
43 |
44 | if RUBY_PLATFORM == 'java'
45 | gem 'jdbc-sqlite3'
46 | gem 'activerecord-jdbc-adapter'
47 | gem 'activerecord-jdbcsqlite3-adapter'
48 | gem 'jruby-openssl'
49 | gem 'jruby-rack'
50 | else
51 | gem 'sqlite3' # for devise User storage
52 | end
53 |
54 | if RAILS_VERS
55 | gem 'rails', RAILS_VERS
56 | else
57 | gem 'rails'
58 | end
59 | gem 'test-unit'
60 |
61 | gem 'rspec-rails', '2.12.0'
62 | gem 'devise'
63 | end
64 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'rake'
3 | require 'bundler'
4 | Bundler::GemHelper.install_tasks :name => 'mongo_session_store-rails4'
5 |
6 | def run_with_output(command)
7 | puts "Running: #{command}"
8 | system(command)
9 | end
10 |
11 | def set_versions(rails_vers, orm)
12 | success = true
13 | unless File.exists?("Gemfile_Rails_#{rails_vers}_#{orm}_#{RUBY_VERSION}.lock")
14 | success &&= run_with_output("export RAILS_VERS=#{rails_vers}; export MONGO_SESSION_STORE_ORM=#{orm}; bundle update")
15 | success &&= run_with_output("cp Gemfile.lock Gemfile_Rails_#{rails_vers}_#{orm}_#{RUBY_VERSION}.lock")
16 | else
17 | success &&= run_with_output("rm Gemfile.lock")
18 | success &&= run_with_output("cp Gemfile_Rails_#{rails_vers}_#{orm}_#{RUBY_VERSION}.lock Gemfile.lock")
19 | end
20 | success
21 | end
22 |
23 | @rails_versions = ['3.1', '3.2', '4.0', '4.1', '4.2']
24 | @orms = ['mongo_mapper', 'mongoid', 'mongo']
25 |
26 | task :default => :test_all
27 |
28 | desc 'Test each session store against Rails 3.1, 3.2, 4.0, 4.1, and 4.2'
29 | task :test_all do
30 | # inspired by http://pivotallabs.com/users/jdean/blog/articles/1728-testing-your-gem-against-multiple-rubies-and-rails-versions-with-rvm
31 |
32 | # Wait for mongod to start on Travis.
33 | # From the Mongo Ruby Driver gem.
34 | if ENV['TRAVIS']
35 | require 'mongo'
36 | client = Mongo::Client.new(['127.0.0.1:27017'])
37 | begin
38 | puts "Waiting for MongoDB..."
39 | client.command(Mongo::Server::Monitor::STATUS)
40 | rescue Mongo::ServerSelector::NoServerAvailable => e
41 | sleep(2)
42 | # 1 Retry
43 | puts "Waiting for MongoDB..."
44 | client.cluster.scan!
45 | client.command(Mongo::ServerSelector::NoServerAvailable)
46 | end
47 | end
48 |
49 | @failed_suites = []
50 |
51 | @rails_versions.each do |rails_version|
52 | @orms.each do |orm|
53 | success = set_versions(rails_version, orm)
54 |
55 | unless success && run_with_output("export RAILS_VERS=#{rails_version}; export MONGO_SESSION_STORE_ORM=#{orm}; bundle exec rspec spec")
56 | @failed_suites << "Rails #{rails_version} / #{orm}"
57 | end
58 | end
59 | end
60 |
61 | if @failed_suites.any?
62 | puts "\033[0;31mFailed:"
63 | puts @failed_suites.join("\n")
64 | print "\033[0m"
65 | exit(1)
66 | else
67 | print "\033[0;32mAll passed! Success! "
68 | "Yahoooo!!!".chars.each { |c| sleep 0.4; print c; STDOUT.flush }
69 | puts "\033[0m"
70 | end
71 | end
72 |
73 | @rails_versions.each do |rails_version|
74 | @orms.each do |orm|
75 | desc "Set Gemfile.lock to #{rails_version} with #{orm}"
76 | task :"use_#{rails_version.gsub('.', '')}_#{orm}" do
77 | set_versions(rails_version, orm)
78 | end
79 |
80 | desc "Test against #{rails_version} with #{orm}"
81 | task :"test_#{rails_version.gsub('.', '')}_#{orm}" do
82 | set_versions(rails_version, orm)
83 | success = run_with_output("export RAILS_VERS=#{rails_version}; export MONGO_SESSION_STORE_ORM=#{orm}; bundle exec rspec spec")
84 | exit(1) unless success
85 | end
86 |
87 | desc "Rebundle for #{rails_version} with #{orm}"
88 | task :"rebundle_#{rails_version.gsub('.', '')}_#{orm}" do
89 | run_with_output "rm Gemfile_Rails_#{rails_version}_#{orm}_#{RUBY_VERSION}.lock Gemfile.lock"
90 | set_versions(rails_version, orm)
91 | end
92 | end
93 | end
--------------------------------------------------------------------------------
/lib/mongo_session_store-rails3.rb:
--------------------------------------------------------------------------------
1 | require 'mongo_session_store'
2 |
--------------------------------------------------------------------------------
/lib/mongo_session_store-rails4.rb:
--------------------------------------------------------------------------------
1 | require 'mongo_session_store'
2 |
--------------------------------------------------------------------------------
/lib/mongo_session_store.rb:
--------------------------------------------------------------------------------
1 | require 'securerandom'
2 |
3 | $:.unshift File.dirname(__FILE__)
4 |
5 | module MongoSessionStore
6 | autoload :VERSION, 'mongo_session_store/version'
7 |
8 | def self.collection_name=(name)
9 | @collection_name = name
10 |
11 | if defined?(MongoStore::Session)
12 | MongoStore::Session.reset_collection
13 | end
14 |
15 | if defined?(MongoMapperStore::Session)
16 | MongoMapperStore::Session.set_collection_name(name)
17 | end
18 |
19 | if defined?(MongoidStore::Session)
20 | MongoidStore::Session.store_in :collection => MongoSessionStore.collection_name
21 | end
22 |
23 | @collection_name
24 | end
25 |
26 | def self.collection_name
27 | @collection_name
28 | end
29 |
30 | # default collection name for all the stores
31 | self.collection_name = "sessions"
32 | end
33 |
34 | # we don't use autoloading because of thread concerns
35 | # hence, this mess
36 | load_errors = []
37 |
38 | %w(mongo_mapper_store mongoid_store mongo_store).each do |store_name|
39 | begin
40 | require "mongo_session_store/#{store_name}"
41 | rescue LoadError => e
42 | load_errors << e
43 | end
44 | end
45 |
46 | if load_errors.count == 3
47 | message = "Could not load any session store!\n" + load_errors.map(&:message).join("\n")
48 | raise LoadError, message
49 | end
50 |
--------------------------------------------------------------------------------
/lib/mongo_session_store/mongo_mapper_store.rb:
--------------------------------------------------------------------------------
1 | require 'mongo_mapper'
2 | require 'mongo_session_store/mongo_store_base'
3 |
4 | module ActionDispatch
5 | module Session
6 | class MongoMapperStore < MongoStoreBase
7 |
8 | class Session
9 | include MongoMapper::Document
10 | set_collection_name MongoSessionStore.collection_name
11 |
12 | key :_id, String
13 | key :data, Binary, :default => Marshal.dump({})
14 |
15 | timestamps!
16 | end
17 |
18 | end
19 | end
20 | end
21 |
22 | MongoMapperStore = ActionDispatch::Session::MongoMapperStore
23 |
--------------------------------------------------------------------------------
/lib/mongo_session_store/mongo_store.rb:
--------------------------------------------------------------------------------
1 | require 'mongo'
2 | require 'mongo_session_store/mongo_store_base'
3 |
4 | module ActionDispatch
5 | module Session
6 | class MongoStore < MongoStoreBase
7 | class Session
8 | attr_accessor :_id, :data, :created_at, :updated_at
9 |
10 | def initialize(options = {})
11 | @_id = options[:_id]
12 | @data = options[:data] || BSON::Binary.new(Marshal.dump({}), :generic)
13 | @created_at = options[:created_at]
14 | @updated_at = options[:updated_at]
15 | end
16 |
17 | def self.load(options = {})
18 | options[:data] = options["data"] if options["data"]
19 | new(options)
20 | end
21 |
22 | def scope
23 | collection.find(:_id => _id)
24 | end
25 |
26 | def destroy
27 | scope.delete_one
28 | end
29 |
30 | def save
31 | @created_at ||= Time.now
32 | @updated_at = Time.now
33 |
34 | attributes = {
35 | :data => BSON::Binary.new(@data, :generic),
36 | :created_at => @created_at,
37 | :updated_at => @updated_at
38 | }
39 |
40 | scope.replace_one(attributes, upsert: true)
41 | end
42 |
43 | def data=(stuff)
44 | @data = stuff.to_s
45 | end
46 |
47 | def self.where(query = {})
48 | collection.find(query).map { |doc| load(doc) }
49 | end
50 |
51 | def self.last
52 | where.last
53 | end
54 |
55 | def self.database
56 | if @database
57 | @database
58 | else
59 | raise "MongoStore needs a database, e.g. MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: \"my_app_development\")"
60 | end
61 | end
62 |
63 | def self.database=(database)
64 | @database = database
65 | end
66 |
67 | def self.collection
68 | @collection ||= database[MongoSessionStore.collection_name]
69 | end
70 |
71 | def self.reset_collection
72 | @collection = nil
73 | end
74 |
75 | def collection
76 | self.class.collection
77 | end
78 | end
79 | end
80 | end
81 | end
82 |
83 | MongoStore = ActionDispatch::Session::MongoStore
84 |
--------------------------------------------------------------------------------
/lib/mongo_session_store/mongo_store_base.rb:
--------------------------------------------------------------------------------
1 | require 'action_dispatch/middleware/session/abstract_store'
2 |
3 | module ActionDispatch
4 | module Session
5 | class MongoStoreBase < AbstractStore
6 |
7 | SESSION_RECORD_KEY = 'rack.session.record'.freeze
8 | begin
9 | ENV_SESSION_OPTIONS_KEY = Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY
10 | rescue NameError
11 | # Rack 1.2.x has access to the ENV_SESSION_OPTIONS_KEY
12 | end
13 |
14 | def self.session_class
15 | self::Session
16 | end
17 |
18 | private
19 | def session_class
20 | self.class.session_class
21 | end
22 |
23 | def generate_sid
24 | # 20 random bytes in url-safe base64
25 | SecureRandom.base64(20).gsub('=','').gsub('+','-').gsub('/','_')
26 | end
27 |
28 | def get_session(env, sid)
29 | sid, record = find_or_initialize_session(sid)
30 | env[SESSION_RECORD_KEY] = record
31 | [sid, unpack(record.data)]
32 | end
33 |
34 | def set_session(env, sid, session_data, options = {})
35 | id, record = get_session_record(env, sid)
36 | record.data = pack(session_data)
37 | # Rack spec dictates that set_session should return true or false
38 | # depending on whether or not the session was saved or not.
39 | # However, ActionPack seems to want a session id instead.
40 | record.save ? id : false
41 | end
42 |
43 | def find_or_initialize_session(id)
44 | session = (id && session_class.where(:_id => id).first) || session_class.new(:_id => generate_sid)
45 | [session._id, session]
46 | end
47 |
48 | def get_session_record(env, sid)
49 | if env[ENV_SESSION_OPTIONS_KEY][:id].nil? || !env[SESSION_RECORD_KEY]
50 | sid, env[SESSION_RECORD_KEY] = find_or_initialize_session(sid)
51 | end
52 |
53 | [sid, env[SESSION_RECORD_KEY]]
54 | end
55 |
56 | def destroy_session(env, session_id, options)
57 | destroy(env)
58 | generate_sid unless options[:drop]
59 | end
60 |
61 | def destroy(env)
62 | if sid = current_session_id(env)
63 | _, record = get_session_record(env, sid)
64 | record.destroy
65 | env[SESSION_RECORD_KEY] = nil
66 | end
67 | end
68 |
69 | def pack(data)
70 | Marshal.dump(data)
71 | end
72 |
73 | def unpack(packed)
74 | return nil unless packed
75 | data = packed.respond_to?(:data) ? packed.data : packed.to_s
76 | Marshal.load(StringIO.new(data))
77 | end
78 |
79 | end
80 | end
81 | end
82 |
--------------------------------------------------------------------------------
/lib/mongo_session_store/mongoid_store.rb:
--------------------------------------------------------------------------------
1 | require 'mongoid'
2 | require 'mongo_session_store/mongo_store_base'
3 |
4 | module ActionDispatch
5 | module Session
6 | class MongoidStore < MongoStoreBase
7 | BINARY_CLASS = defined?(Moped::BSON::Binary) ? Moped::BSON::Binary : BSON::Binary
8 |
9 | class Session
10 | include Mongoid::Document
11 | include Mongoid::Timestamps
12 |
13 | store_in :collection => MongoSessionStore.collection_name
14 |
15 | if Mongoid::Fields::Validators::Macro::OPTIONS.include? :overwrite
16 | field :_id, :type => String, :overwrite => true
17 | else
18 | field :_id, :type => String
19 | end
20 | field :data, :type => BINARY_CLASS, :default => -> { marshaled_binary({}) }
21 | attr_accessible :_id, :data if respond_to?(:attr_accessible)
22 |
23 | def marshaled_binary(data)
24 | self.class.marshaled_binary(data)
25 | end
26 |
27 | def self.marshaled_binary(data)
28 | if BINARY_CLASS.to_s == 'BSON::Binary'
29 | BSON::Binary.new(Marshal.dump(data), :generic)
30 | else
31 | Moped::BSON::Binary.new(:generic, Marshal.dump(data))
32 | end
33 | end
34 | end
35 |
36 | private
37 | def pack(data)
38 | session_class.marshaled_binary(data)
39 | end
40 |
41 | def unpack(packed)
42 | return nil unless packed
43 | Marshal.load(extract_data(packed))
44 | end
45 |
46 | def extract_data(packed)
47 | if packed.class.to_s == 'BSON::Binary'
48 | packed.data
49 | else
50 | packed.to_s
51 | end
52 | end
53 | end
54 | end
55 | end
56 |
57 | MongoidStore = ActionDispatch::Session::MongoidStore
58 |
--------------------------------------------------------------------------------
/lib/mongo_session_store/version.rb:
--------------------------------------------------------------------------------
1 | module MongoSessionStore
2 | VERSION = "6.0.0"
3 | end
4 |
--------------------------------------------------------------------------------
/mongo_session_store-rails3.gemspec:
--------------------------------------------------------------------------------
1 | require File.expand_path('../lib/mongo_session_store/version', __FILE__)
2 |
3 | Gem::Specification.new do |s|
4 | s.name = File.basename(__FILE__).gsub(".gemspec", "")
5 | s.version = MongoSessionStore::VERSION
6 |
7 | s.authors = ["Brian Hempel", "Nicolas M\303\251rouze", "Tony Pitale", "Chris Brickley"]
8 | s.email = ["plasticchicken@gmail.com"]
9 | s.files = `git ls-files`.split("\n")
10 | s.test_files = `git ls-files -- {test,spec,features,perf}/*`.split("\n")
11 | s.homepage = "http://github.com/brianhempel/mongo_session_store"
12 | s.license = "MIT"
13 | s.require_paths = ["lib"]
14 | s.rubygems_version = "1.3.7"
15 | s.summary = "Rails session stores for MongoMapper, Mongoid, or any other ODM. Rails 3.1, 3.2, 4.0, 4.1, and 4.2 compatible."
16 |
17 | s.add_dependency "actionpack", ">= 3.1"
18 | end
19 |
--------------------------------------------------------------------------------
/mongo_session_store-rails4.gemspec:
--------------------------------------------------------------------------------
1 | require File.expand_path('../lib/mongo_session_store/version', __FILE__)
2 |
3 | Gem::Specification.new do |s|
4 | s.name = File.basename(__FILE__).gsub(".gemspec", "")
5 | s.version = MongoSessionStore::VERSION
6 |
7 | s.authors = ["Brian Hempel", "Nicolas M\303\251rouze", "Tony Pitale", "Chris Brickley"]
8 | s.email = ["plasticchicken@gmail.com"]
9 | s.files = `git ls-files`.split("\n")
10 | s.test_files = `git ls-files -- {test,spec,features,perf}/*`.split("\n")
11 | s.homepage = "http://github.com/brianhempel/mongo_session_store"
12 | s.license = "MIT"
13 | s.require_paths = ["lib"]
14 | s.rubygems_version = "1.3.7"
15 | s.summary = "Rails session stores for MongoMapper, Mongoid, or any other ODM. Rails 3.1, 3.2, 4.0, 4.1, and 4.2 compatible."
16 |
17 | s.add_dependency "actionpack", ">= 3.1"
18 | end
19 |
--------------------------------------------------------------------------------
/perf/benchmark.rb:
--------------------------------------------------------------------------------
1 | require 'benchmark'
2 | require 'rubygems'
3 | require 'bundler/setup'
4 | require 'action_dispatch'
5 | require File.expand_path('../../lib/mongo_session_store-rails3', __FILE__)
6 |
7 | MongoMapper.database = "test_session_stores"
8 | # get around Mongoid's unnecessary "requires MongoDB 2.0.0" error which is NOT triggered when loading from mongo.yml!
9 | Mongoid.config.from_hash('database' => "test_session_stores", 'logger' => false)
10 |
11 | RUNS = 2000
12 |
13 | def benchmark(test_name, &block)
14 | sleep 2 # cool off for my poor laptop
15 | time = Benchmark.realtime do
16 | RUNS.times do
17 | yield
18 | end
19 | end
20 | puts "#{(time/RUNS*100_000).round / 100.0}ms per #{test_name}"
21 | end
22 |
23 | def benchmark_store(store)
24 | collection = store.class.session_class.collection
25 | collection.remove
26 |
27 | large_session = {
28 | :something => "not nothing",
29 | :left => "not right",
30 | :welcome => "not despised",
31 | :visits => [
32 | "http://www.google.com",
33 | "localhost:3000",
34 | "http://localhost:3000/increment_session",
35 | "http://www.iso.org/iso/country_codes/iso_3166_code_lists/iso-3166-1_decoding_table.htm",
36 | "http://www.geonames.org/search.html?q=2303+australia&country="
37 | ],
38 | :one_k_of_data => "a"*1024,
39 | :another_k => "b"*1024,
40 | :more_data => [5]*500,
41 | :too_much_data_for_a_cookie => "c"*8000,
42 | :a_bunch_of_floats_in_embedded_docs => [{:float_a => 3.141, :float_b => -1.1}]*100
43 | }
44 |
45 | ids = []
46 |
47 | env = {
48 | 'rack.session' => large_session,
49 | 'rack.session.options' => { :id => store.send(:generate_sid) }
50 | }
51 | benchmark "session save" do
52 | id = store.send(:generate_sid)
53 | ids << id
54 | store.send(:set_session, env.merge({'rack.session.options' => { :id => id }}), id, env['rack.session'])
55 | # store.send(:commit_session, env.merge({'rack.session.options' => { :id => ids.last }}), 200, {}, [])
56 | end
57 |
58 | ids.shuffle!
59 |
60 | env = {
61 | 'rack.request.cookie_string' => "",
62 | 'HTTP_COOKIE' => "",
63 | 'rack.request.cookie_hash' => { '_session_id' => store.class.session_class.last._id }
64 | }
65 | benchmark "session load" do
66 | id = ids.pop
67 | local_env = env.merge({'rack.request.cookie_hash' => { '_session_id' => id }})
68 | # store.send(:prepare_session, local_env)
69 | sid, data = store.send(:get_session, local_env, id)
70 | # something = local_env['rack.session']["something"] # trigger the load
71 | raise data.inspect unless data[:something] == "not nothing" && data[:a_bunch_of_floats_in_embedded_docs][0] == {:float_a => 3.141, :float_b => -1.1}
72 | end
73 |
74 | stats = collection.stats
75 | puts " Total Size: #{stats['size']}"
76 | puts " Object count: #{stats['count']}"
77 | puts " Average object size: #{stats['avgObjSize']}"
78 | puts " Index sizes: #{stats['indexSizes'].inspect}"
79 | end
80 |
81 | mongo_mapper_store = MongoMapperStore.new(nil)
82 | mongoid_store = MongoidStore.new(nil)
83 | mongo_store = MongoStore.new(nil)
84 |
85 | puts "MongoMapperStore..."
86 | benchmark_store(mongo_mapper_store)
87 |
88 | puts "MongoidStore..."
89 | benchmark_store(mongoid_store)
90 |
91 | puts "MongoStore..."
92 | benchmark_store(mongo_store)
--------------------------------------------------------------------------------
/spec/integration_with_devise_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | describe Devise::SessionsController do
4 | def create_user
5 | post_data = {
6 | 'user[email]' => 'person@example.com',
7 | 'user[password]' => 'secret',
8 | 'user[password_confirmation]' => 'secret'
9 | }
10 | post '/users', post_data
11 | end
12 |
13 | def login
14 | post_data = {
15 | 'user[email]' => 'person@example.com',
16 | 'user[password]' => 'secret',
17 | 'user[password_confirmation]' => 'secret'
18 | }
19 | post '/users/sign_in', post_data
20 | end
21 |
22 | def logout
23 | delete '/users/sign_out'
24 | end
25 |
26 | def i_should_be_logged_in
27 | controller.user_signed_in?.should be_true
28 | get '/'
29 | response.body.squish.should =~ /You are logged in as person@example.com/
30 | end
31 |
32 | def i_should_not_be_logged_in
33 | controller.user_signed_in?.should be_false
34 | get '/'
35 | response.body.squish.should =~ /You are logged out/
36 | end
37 |
38 | it "does not explode" do
39 | end
40 |
41 | it "allows user creation" do
42 | User.count.should == 0
43 | create_user
44 | response.status.should == 302
45 | get response.redirect_url
46 | User.count.should == 1
47 | response.body.squish.should =~ /You are logged in as person@example.com/
48 | response.body.squish.should =~ /You have signed up successfully/
49 | end
50 |
51 | it "allows user logout" do
52 | create_user
53 | i_should_be_logged_in
54 | logout
55 | response.status.should == 302
56 | i_should_not_be_logged_in
57 | response.body.squish.should =~ /Signed out successfully/
58 | end
59 |
60 | it "allows user login" do
61 | create_user
62 | logout
63 | i_should_not_be_logged_in
64 | login
65 | response.status.should == 302
66 | i_should_be_logged_in
67 | response.body.squish.should =~ /Signed in successfully/
68 | end
69 |
70 | it "uses the right session store class" do
71 | store = Rails.application.config.session_store
72 | store.session_class.to_s.should == "ActionDispatch::Session::#{ENV["MONGO_SESSION_STORE_ORM"].camelize}Store::Session"
73 | end
74 |
75 | it "stores the session in the sessions collection" do
76 | collection = db["sessions"]
77 | collection.find.count.should == 0
78 | create_user
79 | collection.find.count.should == 1
80 | end
81 |
82 | it "allows renaming of the collection that stores the sessions" do
83 | collection = db["dance_parties"]
84 | collection.find.count.should == 0
85 | MongoSessionStore.collection_name = "dance_parties"
86 | create_user
87 | collection.find.count.should == 1
88 | end
89 | end
90 |
--------------------------------------------------------------------------------
/spec/mongo_store_base_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'securerandom'
3 | require 'ostruct'
4 | require 'mongo_session_store/mongo_store_base'
5 |
6 | describe ActionDispatch::Session::MongoStoreBase do
7 | ENV_SESSION_OPTIONS_KEY = ActionDispatch::Session::MongoStoreBase::ENV_SESSION_OPTIONS_KEY
8 | SESSION_RECORD_KEY = ActionDispatch::Session::MongoStoreBase::SESSION_RECORD_KEY
9 |
10 | Session = ActionDispatch::Session::MongoStoreBase::Session = Class.new(OpenStruct)
11 |
12 | before do
13 | @app = nil
14 | @store = ActionDispatch::Session::MongoStoreBase.new(@app)
15 | @env = {}
16 | end
17 |
18 | describe "#get_session" do
19 | it "generates a new session id if given a nil session id" do
20 | Session.stub(where: [])
21 |
22 | sid, session_data = @store.send(:get_session, @env, nil)
23 |
24 | sid.should_not == nil
25 | session_data.should == nil
26 | @env[SESSION_RECORD_KEY].class.should == Session
27 | @env[SESSION_RECORD_KEY]._id.should == sid
28 | end
29 |
30 | it "generates a new session id if session is not found" do
31 | old_sid = SecureRandom.hex
32 | Session.stub(where: [])
33 |
34 | sid, session_data = @store.send(:get_session, @env, old_sid)
35 |
36 | sid.should_not == old_sid
37 | session_data.should == nil
38 | @env[SESSION_RECORD_KEY].class.should == Session
39 | @env[SESSION_RECORD_KEY]._id.should == sid
40 | end
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/.gitignore:
--------------------------------------------------------------------------------
1 | .bundle
2 | db/*.sqlite3
3 | log/*.log
4 | tmp/
5 | .sass-cache/
6 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/Rakefile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env rake
2 | # Add your own tasks in files placed in lib/tasks ending in .rake,
3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4 |
5 | require File.expand_path('../config/application', __FILE__)
6 |
7 | Rails31App::Application.load_tasks
8 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into including all the files listed below.
2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3 | // be included in the compiled file accessible from http://example.com/assets/application.js
4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5 | // the compiled file.
6 | //
7 | //= require_tree .
8 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory
3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4 | * the top of the compiled file, but it's generally better to create a new file per style scope.
5 | *= require_self
6 | *= require_tree .
7 | */
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | protect_from_forgery
3 | end
4 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/controllers/home_controller.rb:
--------------------------------------------------------------------------------
1 | class HomeController < ApplicationController
2 | def index
3 | end
4 | end
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/mailers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.1_app/app/mailers/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/models/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.1_app/app/models/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ActiveRecord::Base
2 | # Include default devise modules. Others available are:
3 | # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable, :registerable, :validatable
5 | #:recoverable, :rememberable, :trackable, :validatable
6 | end
7 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 |
Resend confirmation instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.submit "Resend confirmation instructions" %>
10 | <% end %>
11 |
12 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Welcome <%= @resource.email %>!
2 |
3 | You can confirm your account through the link below:
4 |
5 | <%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
6 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password, and you can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
4 |
5 | Click the link below to unlock your account:
6 |
7 | <%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>
8 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 | Change your password
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :reset_password_token %>
6 |
7 | <%= f.label :password, "New password" %>
8 | <%= f.password_field :password %>
9 |
10 | <%= f.label :password_confirmation, "Confirm new password" %>
11 | <%= f.password_field :password_confirmation %>
12 |
13 | <%= f.submit "Change my password" %>
14 | <% end %>
15 |
16 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 | Forgot your password?
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.submit "Send me reset password instructions" %>
10 | <% end %>
11 |
12 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit <%= resource_name.to_s.humanize %>
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.label :password %> (leave blank if you don't want to change it)
10 | <%= f.password_field :password %>
11 |
12 | <%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 |
15 | <%= f.label :current_password %> (we need your current password to confirm your changes)
16 | <%= f.password_field :current_password %>
17 |
18 | <%= f.submit "Update" %>
19 | <% end %>
20 |
21 | Cancel my account
22 |
23 | Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.
24 |
25 | <%= link_to "Back", :back %>
26 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign up
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.label :password %>
10 | <%= f.password_field :password %>
11 |
12 | <%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 |
15 | <%= f.submit "Sign up" %>
16 | <% end %>
17 |
18 | <%= render :partial => "devise/shared/links" %>
19 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign in
2 |
3 | <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4 | <%= f.label :email %>
5 | <%= f.email_field :email %>
6 |
7 | <%= f.label :password %>
8 | <%= f.password_field :password %>
9 |
10 | <% if devise_mapping.rememberable? -%>
11 | <%= f.check_box :remember_me %> <%= f.label :remember_me %>
12 | <% end -%>
13 |
14 | <%= f.submit "Sign in" %>
15 | <% end %>
16 |
17 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/shared/_links.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Sign in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend unlock instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.submit "Resend unlock instructions" %>
10 | <% end %>
11 |
12 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/home/index.html.erb:
--------------------------------------------------------------------------------
1 | You are logged
2 | <% if user_signed_in? %>
3 | in as <%= current_user.email %>.
4 |
8 | <% else %>
9 | out. <%= link_to "Sign in", new_user_session_path %>
10 | <% end %>
--------------------------------------------------------------------------------
/spec/rails_3.1_app/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Rails31App
5 | <%= csrf_meta_tags %>
6 |
7 |
8 |
9 | <%= flash[:notice] %>
10 | <%= flash[:alert] %>
11 |
12 | <%= yield %>
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails31App::Application
5 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | # Pick the frameworks you want:
4 | require "active_record/railtie"
5 | require "action_controller/railtie"
6 | require "action_mailer/railtie"
7 | require "active_resource/railtie"
8 | # require "rails/test_unit/railtie"
9 |
10 | # If you have a Gemfile, require the gems listed there, including any gems
11 | # you've limited to :test, :development, or :production.
12 | Bundler.require(:default, :test) if defined?(Bundler)
13 |
14 | module Rails31App
15 | class Application < Rails::Application
16 | # Settings in config/environments/* take precedence over those specified here.
17 | # Application configuration should go into files in config/initializers
18 | # -- all .rb files in that directory are automatically loaded.
19 |
20 | # Custom directories with classes and modules you want to be autoloadable.
21 | # config.autoload_paths += %W(#{config.root}/extras)
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 | # Activate observers that should always be running.
28 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
29 |
30 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
31 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
32 | # config.time_zone = 'Central Time (US & Canada)'
33 |
34 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
35 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
36 | # config.i18n.default_locale = :de
37 |
38 | # Configure the default encoding used in templates for Ruby 1.9.
39 | config.encoding = "utf-8"
40 |
41 | # Configure sensitive parameters which will be filtered from the log file.
42 | config.filter_parameters += [:password]
43 |
44 | # Enable the asset pipeline
45 | config.assets.enabled = true
46 | end
47 | end
48 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/boot.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 |
3 | # Set up gems listed in the Gemfile.
4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5 |
6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/database.yml:
--------------------------------------------------------------------------------
1 | test:
2 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
3 | database: db/test.sqlite3
4 | pool: 5
5 | timeout: 5000
6 |
7 | development:
8 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
9 | database: db/development.sqlite3
10 | pool: 5
11 | timeout: 5000
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the rails application
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the rails application
5 | Rails31App::Application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails31App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
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.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger
20 | config.active_support.deprecation = :log
21 |
22 | # Only use best-standards-support built into browsers
23 | config.action_dispatch.best_standards_support = :builtin
24 |
25 | # Do not compress assets
26 | config.assets.compress = false
27 | end
28 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails31App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # Code is not reloaded between requests
5 | config.cache_classes = true
6 |
7 | # Full error reports are disabled and caching is turned on
8 | config.consider_all_requests_local = false
9 | config.action_controller.perform_caching = true
10 |
11 | # Disable Rails's static asset server (Apache or nginx will already do this)
12 | config.serve_static_assets = false
13 |
14 | # Compress JavaScripts and CSS
15 | config.assets.compress = true
16 |
17 | # Specify the default JavaScript compressor
18 | config.assets.js_compressor = :uglifier
19 |
20 | # Specifies the header that your server uses for sending files
21 | # (comment out if your front-end server doesn't support this)
22 | config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
23 |
24 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
25 | # config.force_ssl = true
26 |
27 | # See everything in the log (default is :info)
28 | # config.log_level = :debug
29 |
30 | # Use a different logger for distributed setups
31 | # config.logger = SyslogLogger.new
32 |
33 | # Use a different cache store in production
34 | # config.cache_store = :mem_cache_store
35 |
36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server
37 | # config.action_controller.asset_host = "http://assets.example.com"
38 |
39 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
40 | # config.assets.precompile += %w( search.js )
41 |
42 | # Disable delivery errors, bad email addresses will be ignored
43 | # config.action_mailer.raise_delivery_errors = false
44 |
45 | # Enable threaded mode
46 | # config.threadsafe!
47 |
48 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
49 | # the I18n.default_locale when a translation can not be found)
50 | config.i18n.fallbacks = true
51 |
52 | # Send deprecation notices to registered listeners
53 | config.active_support.deprecation = :notify
54 | end
55 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails31App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Configure static asset server for tests with Cache-Control for performance
11 | config.serve_static_assets = true
12 | config.static_cache_control = "public, max-age=3600"
13 |
14 | # Log error messages when you accidentally call methods on nil
15 | config.whiny_nils = true
16 |
17 | # Show full error reports and disable caching
18 | config.consider_all_requests_local = true
19 | config.action_controller.perform_caching = false
20 |
21 | # Raise exceptions instead of rendering exception templates
22 | config.action_dispatch.show_exceptions = false
23 |
24 | # Disable request forgery protection in test environment
25 | config.action_controller.allow_forgery_protection = false
26 |
27 | # Tell Action Mailer not to deliver emails to the real world.
28 | # The :test delivery method accumulates sent emails in the
29 | # ActionMailer::Base.deliveries array.
30 | config.action_mailer.delivery_method = :test
31 |
32 | # Use SQL instead of Active Record's schema dumper when creating the test database.
33 | # This is necessary if your schema can't be completely dumped by the schema dumper,
34 | # like if you have constraints or database-specific column types
35 | # config.active_record.schema_format = :sql
36 |
37 | # Print deprecation notices to the stderr
38 | config.active_support.deprecation = :stderr
39 | end
40 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format
4 | # (all these examples are active by default):
5 | # ActiveSupport::Inflector.inflections do |inflect|
6 | # inflect.plural /^(ox)$/i, '\1en'
7 | # inflect.singular /^(ox)en/i, '\1'
8 | # inflect.irregular 'person', 'people'
9 | # inflect.uncountable %w( fish sheep )
10 | # end
11 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
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
6 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
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 | Rails31App::Application.config.secret_token = '8e4d927033255ebff9a7b712eed68e65fb80196861bc31a3ba5d814f6e5ad94d7be61ac535fc0f646a1fbe0f67a9ea6af0a8085fff0964936a066f144f9caf25'
8 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Rails31App::Application.config.session_store :cookie_store, :key => '_rails_3.1_app_session'
4 |
5 | # Use the database for sessions instead of the cookie-based default,
6 | # which shouldn't be used to store highly confidential information
7 | # (create the session table with "rails generate session_migration")
8 | MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails31_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
9 | Rails31App::Application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
10 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActionController::Base.wrap_parameters :format => [:json]
8 |
9 | # Disable root element in JSON by default.
10 | # if defined?(ActiveRecord)
11 | # ActiveRecord::Base.include_root_in_json = false
12 | # end
13 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at http://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | errors:
5 | messages:
6 | expired: "has expired, please request a new one"
7 | not_found: "not found"
8 | already_confirmed: "was already confirmed, please try signing in"
9 | not_locked: "was not locked"
10 | not_saved:
11 | one: "1 error prohibited this %{resource} from being saved:"
12 | other: "%{count} errors prohibited this %{resource} from being saved:"
13 |
14 | devise:
15 | failure:
16 | already_authenticated: 'You are already signed in.'
17 | unauthenticated: 'You need to sign in or sign up before continuing.'
18 | unconfirmed: 'You have to confirm your account before continuing.'
19 | locked: 'Your account is locked.'
20 | invalid: 'Invalid email or password.'
21 | invalid_token: 'Invalid authentication token.'
22 | timeout: 'Your session expired, please sign in again to continue.'
23 | inactive: 'Your account was not activated yet.'
24 | sessions:
25 | signed_in: 'Signed in successfully.'
26 | signed_out: 'Signed out successfully.'
27 | passwords:
28 | send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29 | updated: 'Your password was changed successfully. You are now signed in.'
30 | send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
31 | confirmations:
32 | send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
33 | send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
34 | confirmed: 'Your account was successfully confirmed. You are now signed in.'
35 | registrations:
36 | signed_up: 'Welcome! You have signed up successfully.'
37 | signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
38 | signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
39 | signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
40 | updated: 'You updated your account successfully.'
41 | destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
42 | unlocks:
43 | send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
44 | unlocked: 'Your account was successfully unlocked. You are now signed in.'
45 | send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
46 | omniauth_callbacks:
47 | success: 'Successfully authorized from %{kind} account.'
48 | failure: 'Could not authorize you from %{kind} because "%{reason}".'
49 | mailer:
50 | confirmation_instructions:
51 | subject: 'Confirmation instructions'
52 | reset_password_instructions:
53 | subject: 'Reset password instructions'
54 | unlock_instructions:
55 | subject: 'Unlock Instructions'
56 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Sample localization file for English. Add more files in this directory for other locales.
2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3 |
4 | en:
5 | hello: "Hello world"
6 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/mongo.yml:
--------------------------------------------------------------------------------
1 | defaults: &defaults
2 | host: 127.0.0.1
3 | port: 27017
4 |
5 | development:
6 | <<: *defaults
7 | database: rails31_app_development
8 |
9 | test:
10 | <<: *defaults
11 | database: rails31_app_test
12 |
13 | # set these environment variables on your prod server
14 | production:
15 | <<: *defaults
16 | database: rails31_app
17 | username: <%= ENV['MONGO_USERNAME'] %>
18 | password: <%= ENV['MONGO_PASSWORD'] %>
19 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/mongoid.yml:
--------------------------------------------------------------------------------
1 | development:
2 | sessions:
3 | default:
4 | database: rails31_app_development
5 | hosts:
6 | - localhost:27017
7 |
8 | test:
9 | sessions:
10 | default:
11 | database: rails31_app_test
12 | hosts:
13 | - localhost:27017
14 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails31App::Application.routes.draw do
2 | devise_for :users
3 | root :to => "home#index"
4 | end
5 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/db/migrate/20120222195914_create_users_table.rb:
--------------------------------------------------------------------------------
1 | class CreateUsersTable < ActiveRecord::Migration
2 | def self.up
3 | create_table :users do |t|
4 | t.string :email, :null => false, :default => ""
5 | t.string :encrypted_password, :null => false, :default => ""
6 | end
7 | end
8 |
9 | def self.down
10 | drop_table :users
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended to check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(:version => 20120222195914) do
14 |
15 | create_table "users", :force => true do |t|
16 | t.string "email", :default => "", :null => false
17 | t.string "encrypted_password", :limit => 128, :default => "", :null => false
18 | end
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/lib/tasks/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.1_app/lib/tasks/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.1_app/log/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.1_app/log/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.1_app/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
The page you were looking for doesn't exist.
23 |
You may have mistyped the address or the page may have moved.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
The change you wanted was rejected.
23 |
Maybe you tried to change something you didn't have access to.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
We're sorry, but something went wrong.
23 |
We've been notified about this issue and we'll take a look at it shortly.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.1_app/public/favicon.ico
--------------------------------------------------------------------------------
/spec/rails_3.1_app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-Agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/script/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3 |
4 | APP_PATH = File.expand_path('../../config/application', __FILE__)
5 | require File.expand_path('../../config/boot', __FILE__)
6 | require 'rails/commands'
7 |
--------------------------------------------------------------------------------
/spec/rails_3.1_app/vendor/assets/stylesheets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.1_app/vendor/assets/stylesheets/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.1_app/vendor/plugins/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.1_app/vendor/plugins/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.2_app/.gitignore:
--------------------------------------------------------------------------------
1 | .bundle
2 | db/*.sqlite3
3 | log/*.log
4 | tmp/
5 | .sass-cache/
6 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/Rakefile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env rake
2 | # Add your own tasks in files placed in lib/tasks ending in .rake,
3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4 |
5 | require File.expand_path('../config/application', __FILE__)
6 |
7 | Rails32App::Application.load_tasks
8 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into including all the files listed below.
2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3 | // be included in the compiled file accessible from http://example.com/assets/application.js
4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5 | // the compiled file.
6 | //
7 | //= require_tree .
8 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory
3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4 | * the top of the compiled file, but it's generally better to create a new file per style scope.
5 | *= require_self
6 | *= require_tree .
7 | */
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | protect_from_forgery
3 | end
4 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/controllers/home_controller.rb:
--------------------------------------------------------------------------------
1 | class HomeController < ApplicationController
2 | def index
3 | end
4 | end
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/mailers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.2_app/app/mailers/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/models/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.2_app/app/models/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ActiveRecord::Base
2 | # Include default devise modules. Others available are:
3 | # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable, :registerable, :validatable
5 | #:recoverable, :rememberable, :trackable, :validatable
6 | end
7 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend confirmation instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.submit "Resend confirmation instructions" %>
10 | <% end %>
11 |
12 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Welcome <%= @resource.email %>!
2 |
3 | You can confirm your account through the link below:
4 |
5 | <%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %>
6 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password, and you can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Your account has been locked due to an excessive amount of unsuccessful sign in attempts.
4 |
5 | Click the link below to unlock your account:
6 |
7 | <%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %>
8 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 | Change your password
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :reset_password_token %>
6 |
7 | <%= f.label :password, "New password" %>
8 | <%= f.password_field :password %>
9 |
10 | <%= f.label :password_confirmation, "Confirm new password" %>
11 | <%= f.password_field :password_confirmation %>
12 |
13 | <%= f.submit "Change my password" %>
14 | <% end %>
15 |
16 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 | Forgot your password?
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.submit "Send me reset password instructions" %>
10 | <% end %>
11 |
12 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit <%= resource_name.to_s.humanize %>
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.label :password %> (leave blank if you don't want to change it)
10 | <%= f.password_field :password %>
11 |
12 | <%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 |
15 | <%= f.label :current_password %> (we need your current password to confirm your changes)
16 | <%= f.password_field :current_password %>
17 |
18 | <%= f.submit "Update" %>
19 | <% end %>
20 |
21 | Cancel my account
22 |
23 | Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.
24 |
25 | <%= link_to "Back", :back %>
26 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign up
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.label :password %>
10 | <%= f.password_field :password %>
11 |
12 | <%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 |
15 | <%= f.submit "Sign up" %>
16 | <% end %>
17 |
18 | <%= render :partial => "devise/shared/links" %>
19 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign in
2 |
3 | <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4 | <%= f.label :email %>
5 | <%= f.email_field :email %>
6 |
7 | <%= f.label :password %>
8 | <%= f.password_field :password %>
9 |
10 | <% if devise_mapping.rememberable? -%>
11 | <%= f.check_box :remember_me %> <%= f.label :remember_me %>
12 | <% end -%>
13 |
14 | <%= f.submit "Sign in" %>
15 | <% end %>
16 |
17 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/shared/_links.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Sign in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend unlock instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email %>
8 |
9 | <%= f.submit "Resend unlock instructions" %>
10 | <% end %>
11 |
12 | <%= render :partial => "devise/shared/links" %>
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/home/index.html.erb:
--------------------------------------------------------------------------------
1 | You are logged
2 | <% if user_signed_in? %>
3 | in as <%= current_user.email %>.
4 |
8 | <% else %>
9 | out. <%= link_to "Sign in", new_user_session_path %>
10 | <% end %>
--------------------------------------------------------------------------------
/spec/rails_3.2_app/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Rails32App
5 | <%= csrf_meta_tags %>
6 |
7 |
8 |
9 | <%= flash[:notice] %>
10 | <%= flash[:alert] %>
11 |
12 | <%= yield %>
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails32App::Application
5 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | # Pick the frameworks you want:
4 | require "active_record/railtie"
5 | require "action_controller/railtie"
6 | require "action_mailer/railtie"
7 | require "active_resource/railtie"
8 | # require "rails/test_unit/railtie"
9 |
10 | # If you have a Gemfile, require the gems listed there, including any gems
11 | # you've limited to :test, :development, or :production.
12 | Bundler.require(:default, :test) if defined?(Bundler)
13 |
14 | module Rails32App
15 | class Application < Rails::Application
16 | # Settings in config/environments/* take precedence over those specified here.
17 | # Application configuration should go into files in config/initializers
18 | # -- all .rb files in that directory are automatically loaded.
19 |
20 | # Custom directories with classes and modules you want to be autoloadable.
21 | # config.autoload_paths += %W(#{config.root}/extras)
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 | # Activate observers that should always be running.
28 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
29 |
30 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
31 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
32 | # config.time_zone = 'Central Time (US & Canada)'
33 |
34 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
35 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
36 | # config.i18n.default_locale = :de
37 |
38 | # Configure the default encoding used in templates for Ruby 1.9.
39 | config.encoding = "utf-8"
40 |
41 | # Configure sensitive parameters which will be filtered from the log file.
42 | config.filter_parameters += [:password]
43 |
44 | # Enable the asset pipeline
45 | config.assets.enabled = true
46 | end
47 | end
48 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/boot.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 |
3 | # Set up gems listed in the Gemfile.
4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5 |
6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
7 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/database.yml:
--------------------------------------------------------------------------------
1 | test:
2 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
3 | database: db/test.sqlite3
4 | pool: 5
5 | timeout: 5000
6 |
7 | development:
8 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
9 | database: db/development.sqlite3
10 | pool: 5
11 | timeout: 5000
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the rails application
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the rails application
5 | Rails32App::Application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails32App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
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.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger
20 | config.active_support.deprecation = :log
21 |
22 | # Only use best-standards-support built into browsers
23 | config.action_dispatch.best_standards_support = :builtin
24 |
25 | # Do not compress assets
26 | config.assets.compress = false
27 | end
28 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails32App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # Code is not reloaded between requests
5 | config.cache_classes = true
6 |
7 | # Full error reports are disabled and caching is turned on
8 | config.consider_all_requests_local = false
9 | config.action_controller.perform_caching = true
10 |
11 | # Disable Rails's static asset server (Apache or nginx will already do this)
12 | config.serve_static_assets = false
13 |
14 | # Compress JavaScripts and CSS
15 | config.assets.compress = true
16 |
17 | # Specify the default JavaScript compressor
18 | config.assets.js_compressor = :uglifier
19 |
20 | # Specifies the header that your server uses for sending files
21 | # (comment out if your front-end server doesn't support this)
22 | config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx
23 |
24 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
25 | # config.force_ssl = true
26 |
27 | # See everything in the log (default is :info)
28 | # config.log_level = :debug
29 |
30 | # Use a different logger for distributed setups
31 | # config.logger = SyslogLogger.new
32 |
33 | # Use a different cache store in production
34 | # config.cache_store = :mem_cache_store
35 |
36 | # Enable serving of images, stylesheets, and JavaScripts from an asset server
37 | # config.action_controller.asset_host = "http://assets.example.com"
38 |
39 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
40 | # config.assets.precompile += %w( search.js )
41 |
42 | # Disable delivery errors, bad email addresses will be ignored
43 | # config.action_mailer.raise_delivery_errors = false
44 |
45 | # Enable threaded mode
46 | # config.threadsafe!
47 |
48 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
49 | # the I18n.default_locale when a translation can not be found)
50 | config.i18n.fallbacks = true
51 |
52 | # Send deprecation notices to registered listeners
53 | config.active_support.deprecation = :notify
54 | end
55 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails32App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Configure static asset server for tests with Cache-Control for performance
11 | config.serve_static_assets = true
12 | config.static_cache_control = "public, max-age=3600"
13 |
14 | # Log error messages when you accidentally call methods on nil
15 | config.whiny_nils = true
16 |
17 | # Show full error reports and disable caching
18 | config.consider_all_requests_local = true
19 | config.action_controller.perform_caching = false
20 |
21 | # Raise exceptions instead of rendering exception templates
22 | config.action_dispatch.show_exceptions = false
23 |
24 | # Disable request forgery protection in test environment
25 | config.action_controller.allow_forgery_protection = false
26 |
27 | # Tell Action Mailer not to deliver emails to the real world.
28 | # The :test delivery method accumulates sent emails in the
29 | # ActionMailer::Base.deliveries array.
30 | config.action_mailer.delivery_method = :test
31 |
32 | # Use SQL instead of Active Record's schema dumper when creating the test database.
33 | # This is necessary if your schema can't be completely dumped by the schema dumper,
34 | # like if you have constraints or database-specific column types
35 | # config.active_record.schema_format = :sql
36 |
37 | # Print deprecation notices to the stderr
38 | config.active_support.deprecation = :stderr
39 | end
40 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format
4 | # (all these examples are active by default):
5 | # ActiveSupport::Inflector.inflections do |inflect|
6 | # inflect.plural /^(ox)$/i, '\1en'
7 | # inflect.singular /^(ox)en/i, '\1'
8 | # inflect.irregular 'person', 'people'
9 | # inflect.uncountable %w( fish sheep )
10 | # end
11 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
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
6 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
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 | Rails32App::Application.config.secret_token = '8e4d927033255ebff9a7b712eed68e65fb80196861bc31a3ba5d814f6e5ad94d7be61ac535fc0f646a1fbe0f67a9ea6af0a8085fff0964936a066f144f9caf25'
8 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Rails32App::Application.config.session_store :cookie_store, :key => '_rails_3.2_app_session'
4 |
5 | # Use the database for sessions instead of the cookie-based default,
6 | # which shouldn't be used to store highly confidential information
7 | # (create the session table with "rails generate session_migration")
8 | MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails32_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
9 | Rails32App::Application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
10 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActionController::Base.wrap_parameters :format => [:json]
8 |
9 | # Disable root element in JSON by default.
10 | # if defined?(ActiveRecord)
11 | # ActiveRecord::Base.include_root_in_json = false
12 | # end
13 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at http://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | errors:
5 | messages:
6 | expired: "has expired, please request a new one"
7 | not_found: "not found"
8 | already_confirmed: "was already confirmed, please try signing in"
9 | not_locked: "was not locked"
10 | not_saved:
11 | one: "1 error prohibited this %{resource} from being saved:"
12 | other: "%{count} errors prohibited this %{resource} from being saved:"
13 |
14 | devise:
15 | failure:
16 | already_authenticated: 'You are already signed in.'
17 | unauthenticated: 'You need to sign in or sign up before continuing.'
18 | unconfirmed: 'You have to confirm your account before continuing.'
19 | locked: 'Your account is locked.'
20 | invalid: 'Invalid email or password.'
21 | invalid_token: 'Invalid authentication token.'
22 | timeout: 'Your session expired, please sign in again to continue.'
23 | inactive: 'Your account was not activated yet.'
24 | sessions:
25 | signed_in: 'Signed in successfully.'
26 | signed_out: 'Signed out successfully.'
27 | passwords:
28 | send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29 | updated: 'Your password was changed successfully. You are now signed in.'
30 | send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
31 | confirmations:
32 | send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
33 | send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
34 | confirmed: 'Your account was successfully confirmed. You are now signed in.'
35 | registrations:
36 | signed_up: 'Welcome! You have signed up successfully.'
37 | signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
38 | signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
39 | signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
40 | updated: 'You updated your account successfully.'
41 | destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
42 | unlocks:
43 | send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
44 | unlocked: 'Your account was successfully unlocked. You are now signed in.'
45 | send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
46 | omniauth_callbacks:
47 | success: 'Successfully authorized from %{kind} account.'
48 | failure: 'Could not authorize you from %{kind} because "%{reason}".'
49 | mailer:
50 | confirmation_instructions:
51 | subject: 'Confirmation instructions'
52 | reset_password_instructions:
53 | subject: 'Reset password instructions'
54 | unlock_instructions:
55 | subject: 'Unlock Instructions'
56 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Sample localization file for English. Add more files in this directory for other locales.
2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3 |
4 | en:
5 | hello: "Hello world"
6 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/mongo.yml:
--------------------------------------------------------------------------------
1 | defaults: &defaults
2 | host: 127.0.0.1
3 | port: 27017
4 |
5 | development:
6 | <<: *defaults
7 | database: rails32_app_development
8 |
9 | test:
10 | <<: *defaults
11 | database: rails32_app_test
12 |
13 | # set these environment variables on your prod server
14 | production:
15 | <<: *defaults
16 | database: rails32_app
17 | username: <%= ENV['MONGO_USERNAME'] %>
18 | password: <%= ENV['MONGO_PASSWORD'] %>
19 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/mongoid.yml:
--------------------------------------------------------------------------------
1 | development:
2 | sessions:
3 | default:
4 | database: rails32_app_development
5 | hosts:
6 | - localhost:27017
7 |
8 | test:
9 | sessions:
10 | default:
11 | database: rails32_app_test
12 | hosts:
13 | - localhost:27017
14 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails32App::Application.routes.draw do
2 | devise_for :users
3 | root :to => "home#index"
4 | end
5 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/db/migrate/20120222195914_create_users_table.rb:
--------------------------------------------------------------------------------
1 | class CreateUsersTable < ActiveRecord::Migration
2 | def self.up
3 | create_table :users do |t|
4 | t.string :email, :null => false, :default => ""
5 | t.string :encrypted_password, :null => false, :default => ""
6 | end
7 | end
8 |
9 | def self.down
10 | drop_table :users
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended to check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(:version => 20120222195914) do
14 |
15 | create_table "users", :force => true do |t|
16 | t.string "email", :default => "", :null => false
17 | t.string "encrypted_password", :limit => 128, :default => "", :null => false
18 | end
19 |
20 | end
21 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/lib/tasks/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.2_app/lib/tasks/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.2_app/log/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.2_app/log/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.2_app/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
The page you were looking for doesn't exist.
23 |
You may have mistyped the address or the page may have moved.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
The change you wanted was rejected.
23 |
Maybe you tried to change something you didn't have access to.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
17 |
18 |
19 |
20 |
21 |
22 |
We're sorry, but something went wrong.
23 |
We've been notified about this issue and we'll take a look at it shortly.
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.2_app/public/favicon.ico
--------------------------------------------------------------------------------
/spec/rails_3.2_app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-Agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/script/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3 |
4 | APP_PATH = File.expand_path('../../config/application', __FILE__)
5 | require File.expand_path('../../config/boot', __FILE__)
6 | require 'rails/commands'
7 |
--------------------------------------------------------------------------------
/spec/rails_3.2_app/vendor/assets/stylesheets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.2_app/vendor/assets/stylesheets/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_3.2_app/vendor/plugins/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_3.2_app/vendor/plugins/.gitkeep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails40App::Application.load_tasks
7 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/app/assets/images/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file.
9 | //
10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require_tree .
14 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the top of the
9 | * compiled file, but it's generally better to create a new file per style scope.
10 | *
11 | *= require_self
12 | *= require_tree .
13 | */
14 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/controllers/home_controller.rb:
--------------------------------------------------------------------------------
1 | class HomeController < ApplicationController
2 | def index
3 | end
4 | end
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/app/mailers/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/app/models/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/app/models/concerns/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ActiveRecord::Base
2 | # Include default devise modules. Others available are:
3 | # :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable, :registerable
5 | end
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend confirmation instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Resend confirmation instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Welcome <%= @email %>!
2 |
3 | You can confirm your account email through the link below:
4 |
5 | <%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %>
6 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password. You can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 |
5 | Click the link below to unlock your account:
6 |
7 | <%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %>
8 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 | Change your password
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :reset_password_token %>
6 |
7 | <%= f.label :password, "New password" %>
8 | <%= f.password_field :password, :autofocus => true %>
9 |
10 | <%= f.label :password_confirmation, "Confirm new password" %>
11 | <%= f.password_field :password_confirmation %>
12 |
13 | <%= f.submit "Change my password" %>
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 | Forgot your password?
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Send me reset password instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit <%= resource_name.to_s.humanize %>
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10 | Currently waiting confirmation for: <%= resource.unconfirmed_email %>
11 | <% end %>
12 |
13 | <%= f.label :password %> (leave blank if you don't want to change it)
14 | <%= f.password_field :password, :autocomplete => "off" %>
15 |
16 | <%= f.label :password_confirmation %>
17 | <%= f.password_field :password_confirmation %>
18 |
19 | <%= f.label :current_password %> (we need your current password to confirm your changes)
20 | <%= f.password_field :current_password %>
21 |
22 | <%= f.submit "Update" %>
23 | <% end %>
24 |
25 | Cancel my account
26 |
27 | Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>
28 |
29 | <%= link_to "Back", :back %>
30 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign up
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.label :password %>
10 | <%= f.password_field :password %>
11 |
12 | <%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 |
15 | <%= f.submit "Sign up" %>
16 | <% end %>
17 |
18 | <%= render "devise/shared/links" %>
19 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign in
2 |
3 | <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4 | <%= f.label :email %>
5 | <%= f.email_field :email, :autofocus => true %>
6 |
7 | <%= f.label :password %>
8 | <%= f.password_field :password %>
9 |
10 | <% if devise_mapping.rememberable? -%>
11 | <%= f.check_box :remember_me %> <%= f.label :remember_me %>
12 | <% end -%>
13 |
14 | <%= f.submit "Sign in" %>
15 | <% end %>
16 |
17 | <%= render "devise/shared/links" %>
18 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/shared/_links.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Sign in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
26 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend unlock instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Resend unlock instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/home/index.html.erb:
--------------------------------------------------------------------------------
1 | You are logged
2 | <% if user_signed_in? %>
3 | in as <%= current_user.email %>.
4 |
8 | <% else %>
9 | out. <%= link_to "Sign in", new_user_session_path %>
10 | <% end %>
--------------------------------------------------------------------------------
/spec/rails_4.0_app/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Rails40App
5 | <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
6 | <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7 | <%= csrf_meta_tags %>
8 |
9 |
10 |
11 | <%= notice %>
12 | <%= alert %>
13 |
14 | <%= yield %>
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | APP_PATH = File.expand_path('../../config/application', __FILE__)
3 | require_relative '../config/boot'
4 | require 'rails/commands'
5 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require_relative '../config/boot'
3 | require 'rake'
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require "active_record/railtie"
4 | require "action_controller/railtie"
5 | require "action_mailer/railtie"
6 | require 'rails/all'
7 |
8 | # Require the gems listed in Gemfile, including any gems
9 | # you've limited to :test, :development, or :production.
10 | Bundler.require(:default, Rails.env)
11 |
12 | module Rails40App
13 | class Application < Rails::Application
14 | # Settings in config/environments/* take precedence over those specified here.
15 | # Application configuration should go into files in config/initializers
16 | # -- all .rb files in that directory are automatically loaded.
17 |
18 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
19 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
20 | # config.time_zone = 'Central Time (US & Canada)'
21 |
22 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
23 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
24 | # config.i18n.default_locale = :de
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/database.yml:
--------------------------------------------------------------------------------
1 | test:
2 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
3 | database: db/test.sqlite3
4 | pool: 5
5 | timeout: 5000
6 |
7 | development:
8 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
9 | database: db/development.sqlite3
10 | pool: 5
11 | timeout: 5000
12 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails40App::Application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails40App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports and disable caching.
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send.
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger.
20 | config.active_support.deprecation = :log
21 |
22 | # Raise an error on page load if there are pending migrations
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 | end
30 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails40App::Application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static asset server for tests with Cache-Control for performance.
16 | config.serve_static_assets = true
17 | config.static_cache_control = "public, max-age=3600"
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Print deprecation notices to the stderr.
35 | config.active_support.deprecation = :stderr
36 | end
37 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
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
6 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/initializers/secret_token.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rake secret` to generate a secure secret key.
9 |
10 | # Make sure your secret_key_base is kept private
11 | # if you're sharing your code publicly.
12 | Rails40App::Application.config.secret_key_base = '8b41ef7c55a0a37494838312778829e44dd2e44700175a0b3897d4a72a05ffe0f27694345469da43c96b01ac67b96faa11ea4aa53a7d93e89606293c9e6fd3e4'
13 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Rails40App::Application.config.session_store :cookie_store, key: '_rails_4_0_app_session'
4 | MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails40_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
5 | Rails40App::Application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
6 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/mongo.yml:
--------------------------------------------------------------------------------
1 | defaults: &defaults
2 | host: 127.0.0.1
3 | port: 27017
4 |
5 | development:
6 | <<: *defaults
7 | database: rails40_app_development
8 |
9 | test:
10 | <<: *defaults
11 | database: rails40_app_test
12 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/mongoid.yml:
--------------------------------------------------------------------------------
1 | development:
2 | sessions:
3 | default:
4 | database: rails40_app_development
5 | hosts:
6 | - localhost:27017
7 |
8 | test:
9 | sessions:
10 | default:
11 | database: rails40_app_test
12 | hosts:
13 | - localhost:27017
14 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails40App::Application.routes.draw do
2 | devise_for :users
3 | root :to => "home#index"
4 | end
5 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/db/migrate/20140301171212_add_devise_users.rb:
--------------------------------------------------------------------------------
1 | class AddDeviseUsers < ActiveRecord::Migration
2 | def change
3 | create_table(:users) do |t|
4 | t.string :email, :null => false, :default => ""
5 | t.string :encrypted_password, :null => false, :default => ""
6 | t.timestamps
7 | end
8 |
9 | add_index :users, :email, :unique => true
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20140301171212) do
15 |
16 | create_table "users", force: true do |t|
17 | t.string "email", default: "", null: false
18 | t.string "encrypted_password", default: "", null: false
19 | t.datetime "created_at"
20 | t.datetime "updated_at"
21 | end
22 |
23 | add_index "users", ["email"], name: "index_users_on_email", unique: true
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/lib/assets/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/lib/tasks/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/log/.keep
--------------------------------------------------------------------------------
/spec/rails_4.0_app/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
The page you were looking for doesn't exist.
54 |
You may have mistyped the address or the page may have moved.
55 |
56 | If you are the application owner check the logs for more information.
57 |
58 |
59 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
The change you wanted was rejected.
54 |
Maybe you tried to change something you didn't have access to.
55 |
56 | If you are the application owner check the logs for more information.
57 |
58 |
59 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
48 |
49 |
50 |
51 |
52 |
53 |
We're sorry, but something went wrong.
54 |
55 | If you are the application owner check the logs for more information.
56 |
57 |
58 |
--------------------------------------------------------------------------------
/spec/rails_4.0_app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.0_app/public/favicon.ico
--------------------------------------------------------------------------------
/spec/rails_4.0_app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*.log
16 | /tmp
17 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/app/assets/images/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file.
9 | //
10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require_tree .
14 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any styles
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11 | * file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/controllers/home_controller.rb:
--------------------------------------------------------------------------------
1 | class HomeController < ApplicationController
2 | def index
3 | end
4 | end
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/app/mailers/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/app/models/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/app/models/concerns/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ActiveRecord::Base
2 | # Include default devise modules. Others available are:
3 | # :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable, :registerable
5 | end
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend confirmation instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Resend confirmation instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Welcome <%= @email %>!
2 |
3 | You can confirm your account email through the link below:
4 |
5 | <%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %>
6 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password. You can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 |
5 | Click the link below to unlock your account:
6 |
7 | <%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %>
8 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 | Change your password
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :reset_password_token %>
6 |
7 | <%= f.label :password, "New password" %>
8 | <%= f.password_field :password, :autofocus => true %>
9 |
10 | <%= f.label :password_confirmation, "Confirm new password" %>
11 | <%= f.password_field :password_confirmation %>
12 |
13 | <%= f.submit "Change my password" %>
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 | Forgot your password?
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Send me reset password instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit <%= resource_name.to_s.humanize %>
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10 | Currently waiting confirmation for: <%= resource.unconfirmed_email %>
11 | <% end %>
12 |
13 | <%= f.label :password %> (leave blank if you don't want to change it)
14 | <%= f.password_field :password, :autocomplete => "off" %>
15 |
16 | <%= f.label :password_confirmation %>
17 | <%= f.password_field :password_confirmation %>
18 |
19 | <%= f.label :current_password %> (we need your current password to confirm your changes)
20 | <%= f.password_field :current_password %>
21 |
22 | <%= f.submit "Update" %>
23 | <% end %>
24 |
25 | Cancel my account
26 |
27 | Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>
28 |
29 | <%= link_to "Back", :back %>
30 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign up
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.label :password %>
10 | <%= f.password_field :password %>
11 |
12 | <%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 |
15 | <%= f.submit "Sign up" %>
16 | <% end %>
17 |
18 | <%= render "devise/shared/links" %>
19 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign in
2 |
3 | <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4 | <%= f.label :email %>
5 | <%= f.email_field :email, :autofocus => true %>
6 |
7 | <%= f.label :password %>
8 | <%= f.password_field :password %>
9 |
10 | <% if devise_mapping.rememberable? -%>
11 | <%= f.check_box :remember_me %> <%= f.label :remember_me %>
12 | <% end -%>
13 |
14 | <%= f.submit "Sign in" %>
15 | <% end %>
16 |
17 | <%= render "devise/shared/links" %>
18 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/shared/_links.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Sign in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
26 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend unlock instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Resend unlock instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/home/index.html.erb:
--------------------------------------------------------------------------------
1 | You are logged
2 | <% if user_signed_in? %>
3 | in as <%= current_user.email %>.
4 |
8 | <% else %>
9 | out. <%= link_to "Sign in", new_user_session_path %>
10 | <% end %>
--------------------------------------------------------------------------------
/spec/rails_4.1_app/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Rails41App
5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7 | <%= csrf_meta_tags %>
8 |
9 |
10 |
11 | <%= notice %>
12 | <%= alert %>
13 |
14 | <%= yield %>
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads spring without using Bundler, in order to be fast
4 | # It gets overwritten when you run the `spring binstub` command
5 |
6 | unless defined?(Spring)
7 | require "rubygems"
8 | require "bundler"
9 |
10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
11 | ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12 | ENV["GEM_HOME"] = ""
13 | Gem.paths = ENV
14 |
15 | gem "spring", match[1]
16 | require "spring/binstub"
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module Rails41App
10 | class Application < Rails::Application
11 | # Settings in config/environments/* take precedence over those specified here.
12 | # Application configuration should go into files in config/initializers
13 | # -- all .rb files in that directory are automatically loaded.
14 |
15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17 | # config.time_zone = 'Central Time (US & Canada)'
18 |
19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21 | # config.i18n.default_locale = :de
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/boot.rb:
--------------------------------------------------------------------------------
1 | # Set up gems listed in the Gemfile.
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 |
4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/database.yml:
--------------------------------------------------------------------------------
1 | test:
2 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
3 | database: db/test.sqlite3
4 | pool: 5
5 | timeout: 5000
6 |
7 | development:
8 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
9 | database: db/development.sqlite3
10 | pool: 5
11 | timeout: 5000
12 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports and disable caching.
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send.
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger.
20 | config.active_support.deprecation = :log
21 |
22 | # Raise an error on page load if there are pending migrations.
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 |
30 | # Adds additional error checking when serving assets at runtime.
31 | # Checks for improperly declared sprockets dependencies.
32 | # Raises helpful error messages.
33 | config.assets.raise_runtime_errors = true
34 |
35 | # Raises error for missing translations
36 | # config.action_view.raise_on_missing_translations = true
37 | end
38 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static asset server for tests with Cache-Control for performance.
16 | config.serve_static_assets = true
17 | config.static_cache_control = 'public, max-age=3600'
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Print deprecation notices to the stderr.
35 | config.active_support.deprecation = :stderr
36 |
37 | # Raises error for missing translations
38 | # config.action_view.raise_on_missing_translations = true
39 | end
40 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
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
6 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Rails.application.config.session_store :cookie_store, key: '_rails_41_app_session'
4 | MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails41_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
5 | Rails.application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
6 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/mongo.yml:
--------------------------------------------------------------------------------
1 | defaults: &defaults
2 | host: 127.0.0.1
3 | port: 27017
4 |
5 | development:
6 | <<: *defaults
7 | database: rails41_app_development
8 |
9 | test:
10 | <<: *defaults
11 | database: rails41_app_test
12 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/mongoid.yml:
--------------------------------------------------------------------------------
1 | development:
2 | sessions:
3 | default:
4 | database: rails41_app_development
5 | hosts:
6 | - localhost:27017
7 |
8 | test:
9 | sessions:
10 | default:
11 | database: rails41_app_test
12 | hosts:
13 | - localhost:27017
14 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | devise_for :users
3 | root :to => "home#index"
4 | end
5 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/config/secrets.yml:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rake secret` to generate a secure secret key.
9 |
10 | # Make sure the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | development:
14 | secret_key_base: a8ef04e888ee54014dfb4f32ca538e987f1c160db5ee225b2e863b82664d356be5746975fd059da6b0c00215ce1c597bceeacb119093c94be461161181975a76
15 |
16 | test:
17 | secret_key_base: f777f8cc4e8ca43ff30bae1dcdb77088467cff65759fc4298c5e6644ad0d9cf22f8128b3eabde1ea8ef37724d8bdab38088e4d11f6a7389cf0d0f7db3cb1f719
18 |
19 | # Do not keep production secrets in the repository,
20 | # instead read values from the environment.
21 | production:
22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
23 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/db/migrate/20140301171212_add_devise_users.rb:
--------------------------------------------------------------------------------
1 | class AddDeviseUsers < ActiveRecord::Migration
2 | def change
3 | create_table(:users) do |t|
4 | t.string :email, :null => false, :default => ""
5 | t.string :encrypted_password, :null => false, :default => ""
6 | t.timestamps
7 | end
8 |
9 | add_index :users, :email, :unique => true
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20140301171212) do
15 |
16 | create_table "users", force: true do |t|
17 | t.string "email", default: "", null: false
18 | t.string "encrypted_password", default: "", null: false
19 | t.datetime "created_at"
20 | t.datetime "updated_at"
21 | end
22 |
23 | add_index "users", ["email"], name: "index_users_on_email", unique: true
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/lib/assets/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/lib/tasks/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/log/.keep
--------------------------------------------------------------------------------
/spec/rails_4.1_app/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/spec/rails_4.1_app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.1_app/public/favicon.ico
--------------------------------------------------------------------------------
/spec/rails_4.1_app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-journal
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*
16 | !/log/.keep
17 | /tmp
18 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require File.expand_path('../config/application', __FILE__)
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/assets/images/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/app/assets/images/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/assets/javascripts/application.js:
--------------------------------------------------------------------------------
1 | // This is a manifest file that'll be compiled into application.js, which will include all the files
2 | // listed below.
3 | //
4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6 | //
7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8 | // compiled file.
9 | //
10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11 | // about supported directives.
12 | //
13 | //= require_tree .
14 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any styles
10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11 | * file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | # Prevent CSRF attacks by raising an exception.
3 | # For APIs, you may want to use :null_session instead.
4 | protect_from_forgery with: :exception
5 | end
6 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/app/controllers/concerns/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/controllers/home_controller.rb:
--------------------------------------------------------------------------------
1 | class HomeController < ApplicationController
2 | def index
3 | end
4 | end
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/mailers/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/app/mailers/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/models/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/app/models/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/models/concerns/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/app/models/concerns/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/models/user.rb:
--------------------------------------------------------------------------------
1 | class User < ActiveRecord::Base
2 | # Include default devise modules. Others available are:
3 | # :confirmable, :lockable, :timeoutable and :omniauthable
4 | devise :database_authenticatable, :registerable
5 | end
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/confirmations/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend confirmation instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Resend confirmation instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Welcome <%= @email %>!
2 |
3 | You can confirm your account email through the link below:
4 |
5 | <%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %>
6 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Someone has requested a link to change your password. You can do this through the link below.
4 |
5 | <%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @token) %>
6 |
7 | If you didn't request this, please ignore this email.
8 | Your password won't change until you access the link above and create a new one.
9 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/mailer/unlock_instructions.html.erb:
--------------------------------------------------------------------------------
1 | Hello <%= @resource.email %>!
2 |
3 | Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 |
5 | Click the link below to unlock your account:
6 |
7 | <%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @token) %>
8 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/passwords/edit.html.erb:
--------------------------------------------------------------------------------
1 | Change your password
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 | <%= f.hidden_field :reset_password_token %>
6 |
7 | <%= f.label :password, "New password" %>
8 | <%= f.password_field :password, :autofocus => true %>
9 |
10 | <%= f.label :password_confirmation, "Confirm new password" %>
11 | <%= f.password_field :password_confirmation %>
12 |
13 | <%= f.submit "Change my password" %>
14 | <% end %>
15 |
16 | <%= render "devise/shared/links" %>
17 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/passwords/new.html.erb:
--------------------------------------------------------------------------------
1 | Forgot your password?
2 |
3 | <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Send me reset password instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/registrations/edit.html.erb:
--------------------------------------------------------------------------------
1 | Edit <%= resource_name.to_s.humanize %>
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10 | Currently waiting confirmation for: <%= resource.unconfirmed_email %>
11 | <% end %>
12 |
13 | <%= f.label :password %> (leave blank if you don't want to change it)
14 | <%= f.password_field :password, :autocomplete => "off" %>
15 |
16 | <%= f.label :password_confirmation %>
17 | <%= f.password_field :password_confirmation %>
18 |
19 | <%= f.label :current_password %> (we need your current password to confirm your changes)
20 | <%= f.password_field :current_password %>
21 |
22 | <%= f.submit "Update" %>
23 | <% end %>
24 |
25 | Cancel my account
26 |
27 | Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>
28 |
29 | <%= link_to "Back", :back %>
30 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/registrations/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign up
2 |
3 | <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.label :password %>
10 | <%= f.password_field :password %>
11 |
12 | <%= f.label :password_confirmation %>
13 | <%= f.password_field :password_confirmation %>
14 |
15 | <%= f.submit "Sign up" %>
16 | <% end %>
17 |
18 | <%= render "devise/shared/links" %>
19 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/sessions/new.html.erb:
--------------------------------------------------------------------------------
1 | Sign in
2 |
3 | <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4 | <%= f.label :email %>
5 | <%= f.email_field :email, :autofocus => true %>
6 |
7 | <%= f.label :password %>
8 | <%= f.password_field :password %>
9 |
10 | <% if devise_mapping.rememberable? -%>
11 | <%= f.check_box :remember_me %> <%= f.label :remember_me %>
12 | <% end -%>
13 |
14 | <%= f.submit "Sign in" %>
15 | <% end %>
16 |
17 | <%= render "devise/shared/links" %>
18 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/shared/_links.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 | <%= link_to "Sign in", new_session_path(resource_name) %>
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 | <%= link_to "Sign up", new_registration_path(resource_name) %>
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 | <%= link_to "Forgot your password?", new_password_path(resource_name) %>
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 | <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 | <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 | <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %>
24 | <% end -%>
25 | <% end -%>
26 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/devise/unlocks/new.html.erb:
--------------------------------------------------------------------------------
1 | Resend unlock instructions
2 |
3 | <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4 | <%= devise_error_messages! %>
5 |
6 | <%= f.label :email %>
7 | <%= f.email_field :email, :autofocus => true %>
8 |
9 | <%= f.submit "Resend unlock instructions" %>
10 | <% end %>
11 |
12 | <%= render "devise/shared/links" %>
13 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/home/index.html.erb:
--------------------------------------------------------------------------------
1 | You are logged
2 | <% if user_signed_in? %>
3 | in as <%= current_user.email %>.
4 |
8 | <% else %>
9 | out. <%= link_to "Sign in", new_user_session_path %>
10 | <% end %>
--------------------------------------------------------------------------------
/spec/rails_4.2_app/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Rails41App
5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7 | <%= csrf_meta_tags %>
8 |
9 |
10 |
11 | <%= notice %>
12 | <%= alert %>
13 |
14 | <%= yield %>
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 | load Gem.bin_path('bundler', 'bundle')
4 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | APP_PATH = File.expand_path('../../config/application', __FILE__)
7 | require_relative '../config/boot'
8 | require 'rails/commands'
9 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path("../spring", __FILE__)
4 | rescue LoadError
5 | end
6 | require_relative '../config/boot'
7 | require 'rake'
8 | Rake.application.run
9 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 |
4 | # path to your application root.
5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6 |
7 | Dir.chdir APP_ROOT do
8 | # This script is a starting point to setup your application.
9 | # Add necessary setup steps to this file:
10 |
11 | puts "== Installing dependencies =="
12 | system "gem install bundler --conservative"
13 | system "bundle check || bundle install"
14 |
15 | # puts "\n== Copying sample files =="
16 | # unless File.exist?("config/database.yml")
17 | # system "cp config/database.yml.sample config/database.yml"
18 | # end
19 |
20 | puts "\n== Preparing database =="
21 | system "bin/rake db:setup"
22 |
23 | puts "\n== Removing old logs and tempfiles =="
24 | system "rm -f log/*"
25 | system "rm -rf tmp/cache"
26 |
27 | puts "\n== Restarting application server =="
28 | system "touch tmp/restart.txt"
29 | end
30 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/bin/spring:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # This file loads spring without using Bundler, in order to be fast.
4 | # It gets overwritten when you run the `spring binstub` command.
5 |
6 | unless defined?(Spring)
7 | require "rubygems"
8 | require "bundler"
9 |
10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
11 | Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
12 | gem "spring", match[1]
13 | require "spring/binstub"
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require ::File.expand_path('../config/environment', __FILE__)
4 | run Rails.application
5 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/application.rb:
--------------------------------------------------------------------------------
1 | require File.expand_path('../boot', __FILE__)
2 |
3 | require 'rails/all'
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module Rails42App
10 | class Application < Rails::Application
11 | # Settings in config/environments/* take precedence over those specified here.
12 | # Application configuration should go into files in config/initializers
13 | # -- all .rb files in that directory are automatically loaded.
14 |
15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17 | # config.time_zone = 'Central Time (US & Canada)'
18 |
19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21 | # config.i18n.default_locale = :de
22 |
23 | # Do not swallow errors in after_commit/after_rollback callbacks.
24 | config.active_record.raise_in_transactional_callbacks = true
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2 |
3 | require 'bundler/setup' # Set up gems listed in the Gemfile.
4 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/database.yml:
--------------------------------------------------------------------------------
1 | test:
2 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
3 | database: db/test.sqlite3
4 | pool: 5
5 | timeout: 5000
6 |
7 | development:
8 | adapter: <%= RUBY_PLATFORM == 'java' ? 'jdbcsqlite3' : 'sqlite3' %>
9 | database: db/development.sqlite3
10 | pool: 5
11 | timeout: 5000
12 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require File.expand_path('../application', __FILE__)
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # In the development environment your application's code is reloaded on
5 | # every request. This slows down response time but is perfect for development
6 | # since you don't have to restart the web server when you make code changes.
7 | config.cache_classes = false
8 |
9 | # Do not eager load code on boot.
10 | config.eager_load = false
11 |
12 | # Show full error reports and disable caching.
13 | config.consider_all_requests_local = true
14 | config.action_controller.perform_caching = false
15 |
16 | # Don't care if the mailer can't send.
17 | config.action_mailer.raise_delivery_errors = false
18 |
19 | # Print deprecation notices to the Rails logger.
20 | config.active_support.deprecation = :log
21 |
22 | # Raise an error on page load if there are pending migrations.
23 | config.active_record.migration_error = :page_load
24 |
25 | # Debug mode disables concatenation and preprocessing of assets.
26 | # This option may cause significant delays in view rendering with a large
27 | # number of complex assets.
28 | config.assets.debug = true
29 |
30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31 | # yet still be able to expire them through the digest params.
32 | config.assets.digest = true
33 |
34 | # Adds additional error checking when serving assets at runtime.
35 | # Checks for improperly declared sprockets dependencies.
36 | # Raises helpful error messages.
37 | config.assets.raise_runtime_errors = true
38 |
39 | # Raises error for missing translations
40 | # config.action_view.raise_on_missing_translations = true
41 | end
42 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure static file server for tests with Cache-Control for performance.
16 | config.serve_static_files = true
17 | config.static_cache_control = 'public, max-age=3600'
18 |
19 | # Show full error reports and disable caching.
20 | config.consider_all_requests_local = true
21 | config.action_controller.perform_caching = false
22 |
23 | # Raise exceptions instead of rendering exception templates.
24 | config.action_dispatch.show_exceptions = false
25 |
26 | # Disable request forgery protection in test environment.
27 | config.action_controller.allow_forgery_protection = false
28 |
29 | # Tell Action Mailer not to deliver emails to the real world.
30 | # The :test delivery method accumulates sent emails in the
31 | # ActionMailer::Base.deliveries array.
32 | config.action_mailer.delivery_method = :test
33 |
34 | # Randomize the order test cases are executed.
35 | config.active_support.test_order = :random
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = '1.0'
5 |
6 | # Add additional assets to the asset load path
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 |
9 | # Precompile additional assets.
10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11 | # Rails.application.config.assets.precompile += %w( search.js )
12 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.action_dispatch.cookies_serializer = :json
4 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Rails.application.config.session_store :cookie_store, key: '_rails_42_app_session'
4 | MongoStore::Session.database = Mongo::Client.new(['127.0.0.1:27017'], database: "rails42_app_#{Rails.env}") if ENV['MONGO_SESSION_STORE_ORM'] == "mongo"
5 | Rails.application.config.session_store :"#{ENV['MONGO_SESSION_STORE_ORM']}_store"
6 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/initializers/wrap_parameters.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # This file contains settings for ActionController::ParamsWrapper which
4 | # is enabled by default.
5 |
6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 | ActiveSupport.on_load(:action_controller) do
8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9 | end
10 |
11 | # To enable root element in JSON for ActiveRecord objects.
12 | # ActiveSupport.on_load(:active_record) do
13 | # self.include_root_in_json = true
14 | # end
15 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/mongo.yml:
--------------------------------------------------------------------------------
1 | defaults: &defaults
2 | host: 127.0.0.1
3 | port: 27017
4 |
5 | development:
6 | <<: *defaults
7 | database: rails41_app_development
8 |
9 | test:
10 | <<: *defaults
11 | database: rails41_app_test
12 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/mongoid.yml:
--------------------------------------------------------------------------------
1 | development:
2 | sessions:
3 | default:
4 | database: rails41_app_development
5 | hosts:
6 | - localhost:27017
7 |
8 | test:
9 | sessions:
10 | default:
11 | database: rails41_app_test
12 | hosts:
13 | - localhost:27017
14 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | devise_for :users
3 | root :to => "home#index"
4 | end
5 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/config/secrets.yml:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rake secret` to generate a secure secret key.
9 |
10 | # Make sure the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | development:
14 | secret_key_base: f572c56330979d77b1f486dfc2cc38990a79eade97da6680e956c0b57967abc3b87759491959283d95f8377a56d30401f8ddac4575c5e1148150a16f09be7c1d
15 |
16 | test:
17 | secret_key_base: cc274453aa400d96444af8c114d32dada6359a8703c7e390e84149f007e1d16aee99b9a6de1a294db718a57317baa54bd57a0bca424bc30d8d15b521c2ccec5d
18 |
19 | # Do not keep production secrets in the repository,
20 | # instead read values from the environment.
21 | production:
22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
23 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/db/migrate/20140301171212_add_devise_users.rb:
--------------------------------------------------------------------------------
1 | class AddDeviseUsers < ActiveRecord::Migration
2 | def change
3 | create_table(:users) do |t|
4 | t.string :email, :null => false, :default => ""
5 | t.string :encrypted_password, :null => false, :default => ""
6 | t.timestamps
7 | end
8 |
9 | add_index :users, :email, :unique => true
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/db/schema.rb:
--------------------------------------------------------------------------------
1 | # encoding: UTF-8
2 | # This file is auto-generated from the current state of the database. Instead
3 | # of editing this file, please use the migrations feature of Active Record to
4 | # incrementally modify your database, and then regenerate this schema definition.
5 | #
6 | # Note that this schema.rb definition is the authoritative source for your
7 | # database schema. If you need to create the application database on another
8 | # system, you should be using db:schema:load, not running all the migrations
9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 | # you'll amass, the slower it'll run and the greater likelihood for issues).
11 | #
12 | # It's strongly recommended that you check this file into your version control system.
13 |
14 | ActiveRecord::Schema.define(version: 20140301171212) do
15 |
16 | create_table "users", force: true do |t|
17 | t.string "email", default: "", null: false
18 | t.string "encrypted_password", default: "", null: false
19 | t.datetime "created_at"
20 | t.datetime "updated_at"
21 | end
22 |
23 | add_index "users", ["email"], name: "index_users_on_email", unique: true
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7 | # Mayor.create(name: 'Emanuel', city: cities.first)
8 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/lib/assets/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/lib/assets/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/lib/tasks/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/lib/tasks/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/log/.keep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/log/.keep
--------------------------------------------------------------------------------
/spec/rails_4.2_app/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/spec/rails_4.2_app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brianhempel/mongo_session_store/4847cb66f0dc27ad0b4861dccca7ffa4217e7fc2/spec/rails_4.2_app/public/favicon.ico
--------------------------------------------------------------------------------
/spec/rails_4.2_app/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'rails'
3 |
4 | rails_version = Rails.version[/^\d\.\d/]
5 | require "rails_#{rails_version}_app/config/environment"
6 |
7 | require 'rspec/rails'
8 |
9 | def db
10 | if defined?(Mongoid)
11 | MongoidStore::Session.mongo_session
12 | elsif defined?(MongoMapper)
13 | MongoMapper.database
14 | elsif defined?(Mongo)
15 | Mongo::Client.new(['127.0.0.1:27017'], database: database_name).database
16 | end
17 | end
18 |
19 | def database_name
20 | Rails.application.class.to_s.underscore.sub(/\/.*/, '') + "_" + Rails.env
21 | end
22 |
23 | def drop_collections_in(database)
24 | database.collections.select { |c| c.name !~ /^system/ }.each(&:drop)
25 | end
26 |
27 | RSpec.configure do |config|
28 | config.before :all do
29 | unless User.table_exists?
30 | load Rails.root.join('db', 'schema.rb')
31 | end
32 | end
33 |
34 | config.before :each do
35 | drop_collections_in(db)
36 | User.delete_all
37 | end
38 | end
39 |
40 | puts "Testing #{ENV["MONGO_SESSION_STORE_ORM"]}_store on Rails #{Rails.version}..."
41 |
42 | case ENV["MONGO_SESSION_STORE_ORM"]
43 | when "mongo_mapper"
44 | puts "MongoMapper version: #{MongoMapper::Version}"
45 | when "mongoid"
46 | puts "Mongoid version: #{Mongoid::VERSION}"
47 | end
48 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | ENV["MONGO_SESSION_STORE_ORM"] ||= "mongo_mapper"
2 | ENV["RAILS_ENV"] = "test"
3 |
4 | require 'bundler/setup'
5 | $:.unshift File.dirname(__FILE__)
6 |
--------------------------------------------------------------------------------