├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README ├── README.textile ├── Rakefile ├── app ├── controllers │ ├── application_controller.rb │ ├── home_controller.rb │ ├── sessions_controller.rb │ └── users_controller.rb ├── helpers │ ├── application_helper.rb │ ├── home_helper.rb │ └── users_helper.rb ├── models │ └── user.rb └── views │ ├── home │ └── index.html.erb │ ├── layouts │ └── application.html.erb │ ├── shared │ └── _navigation.html.erb │ └── users │ ├── edit.html.erb │ └── show.html.erb ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cucumber.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── backtrace_silencers.rb │ ├── generators.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── omniauth.rb │ ├── secret_token.rb │ └── session_store.rb ├── locales │ └── en.yml ├── mongoid.yml └── routes.rb ├── db └── seeds.rb ├── features ├── step_definitions │ └── web_steps.rb └── support │ ├── env.rb │ ├── paths.rb │ └── selectors.rb ├── lib └── tasks │ ├── .gitkeep │ └── cucumber.rake ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico ├── javascripts │ ├── .gitkeep │ ├── application.js │ ├── jquery.js │ └── rails.js ├── robots.txt └── stylesheets │ ├── .gitkeep │ └── application.css ├── script ├── cucumber └── rails ├── spec ├── controllers │ ├── home_controller_spec.rb │ └── users_controller_spec.rb ├── models │ └── user_spec.rb ├── spec_helper.rb └── support │ └── mongoid.rb └── vendor └── plugins └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Ignore these files when commiting to a git repository 3 | # 4 | # The original version of this file is found here: 5 | # https://github.com/fortuity/rails3-gitignore/raw/master/gitignore.txt 6 | # 7 | # Corrections? Improvements? Create a GitHub issue: 8 | # https://github.com/fortuity/rails3-gitignore/issues 9 | #---------------------------------------------------------------------------- 10 | 11 | # bundler state 12 | /.bundle 13 | /vendor/bundle/ 14 | 15 | # minimal Rails specific artifacts 16 | db/*.sqlite3 17 | /log/* 18 | tmp/* 19 | 20 | # various artifacts 21 | **.war 22 | *.rbc 23 | *.sassc 24 | .rspec 25 | .sass-cache 26 | /config/config.yml 27 | /config/database.yml 28 | /coverage.data 29 | /coverage/ 30 | /db/*.javadb/ 31 | /db/*.sqlite3-journal 32 | /doc/api/ 33 | /doc/app/ 34 | /doc/features.html 35 | /doc/specs.html 36 | /public/cache 37 | /public/stylesheets/compiled 38 | /public/system 39 | /spec/tmp/* 40 | /cache 41 | /capybara* 42 | /capybara-*.html 43 | /gems 44 | /rerun.txt 45 | /spec/requests 46 | /spec/routing 47 | /spec/views 48 | /specifications 49 | 50 | # scm revert files 51 | **.orig 52 | 53 | # Mac finder artifacts 54 | .DS_Store 55 | 56 | # Netbeans project directory 57 | /nbproject/ 58 | 59 | # Textmate project files 60 | /*.tmpproj 61 | 62 | # vim artifacts 63 | **.swp 64 | 65 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | gem 'rails', '3.0.7' 3 | gem "rspec-rails", ">= 2.5.0", :group => [:development, :test] 4 | gem "database_cleaner", ">= 0.6.7", :group => :test 5 | gem "mongoid-rspec", ">= 1.4.2", :group => :test 6 | gem "factory_girl_rails", ">= 1.1.beta1", :group => :test 7 | gem "cucumber-rails", ">= 0.4.1", :group => :test 8 | gem "capybara", ">= 0.4.1.2", :group => :test 9 | gem "launchy", ">= 0.4.0", :group => :test 10 | gem "bson_ext", ">= 1.3.0" 11 | gem "mongoid", ">= 2.0.1" 12 | gem "omniauth", ">= 0.2.4" 13 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | abstract (1.0.0) 5 | actionmailer (3.0.7) 6 | actionpack (= 3.0.7) 7 | mail (~> 2.2.15) 8 | actionpack (3.0.7) 9 | activemodel (= 3.0.7) 10 | activesupport (= 3.0.7) 11 | builder (~> 2.1.2) 12 | erubis (~> 2.6.6) 13 | i18n (~> 0.5.0) 14 | rack (~> 1.2.1) 15 | rack-mount (~> 0.6.14) 16 | rack-test (~> 0.5.7) 17 | tzinfo (~> 0.3.23) 18 | activemodel (3.0.7) 19 | activesupport (= 3.0.7) 20 | builder (~> 2.1.2) 21 | i18n (~> 0.5.0) 22 | activerecord (3.0.7) 23 | activemodel (= 3.0.7) 24 | activesupport (= 3.0.7) 25 | arel (~> 2.0.2) 26 | tzinfo (~> 0.3.23) 27 | activeresource (3.0.7) 28 | activemodel (= 3.0.7) 29 | activesupport (= 3.0.7) 30 | activesupport (3.0.7) 31 | addressable (2.2.4) 32 | arel (2.0.9) 33 | bson (1.3.0) 34 | bson_ext (1.3.0) 35 | builder (2.1.2) 36 | capybara (0.4.1.2) 37 | celerity (>= 0.7.9) 38 | culerity (>= 0.2.4) 39 | mime-types (>= 1.16) 40 | nokogiri (>= 1.3.3) 41 | rack (>= 1.0.0) 42 | rack-test (>= 0.5.4) 43 | selenium-webdriver (>= 0.0.27) 44 | xpath (~> 0.1.3) 45 | celerity (0.8.9) 46 | childprocess (0.1.8) 47 | ffi (~> 1.0.6) 48 | configuration (1.2.0) 49 | cucumber (0.10.2) 50 | builder (>= 2.1.2) 51 | diff-lcs (>= 1.1.2) 52 | gherkin (>= 2.3.5) 53 | json (>= 1.4.6) 54 | term-ansicolor (>= 1.0.5) 55 | cucumber-rails (0.4.1) 56 | cucumber (>= 0.10.1) 57 | nokogiri (>= 1.4.4) 58 | rack-test (>= 0.5.7) 59 | culerity (0.2.15) 60 | database_cleaner (0.6.7) 61 | diff-lcs (1.1.2) 62 | erubis (2.6.6) 63 | abstract (>= 1.0.0) 64 | factory_girl (2.0.0.beta2) 65 | factory_girl_rails (1.1.beta1) 66 | factory_girl (~> 2.0.0.beta) 67 | rails (>= 3.0.0) 68 | faraday (0.6.1) 69 | addressable (~> 2.2.4) 70 | multipart-post (~> 1.1.0) 71 | rack (< 2, >= 1.1.0) 72 | ffi (1.0.7) 73 | rake (>= 0.8.7) 74 | gherkin (2.3.7) 75 | json (>= 1.4.6) 76 | i18n (0.5.0) 77 | json (1.5.1) 78 | json_pure (1.5.1) 79 | launchy (0.4.0) 80 | configuration (>= 0.0.5) 81 | rake (>= 0.8.1) 82 | mail (2.2.19) 83 | activesupport (>= 2.3.6) 84 | i18n (>= 0.4.0) 85 | mime-types (~> 1.16) 86 | treetop (~> 1.4.8) 87 | mime-types (1.16) 88 | mongo (1.3.0) 89 | bson (>= 1.3.0) 90 | mongoid (2.0.1) 91 | activemodel (~> 3.0) 92 | mongo (~> 1.3) 93 | tzinfo (~> 0.3.22) 94 | will_paginate (~> 3.0.pre) 95 | mongoid-rspec (1.4.2) 96 | mongoid (~> 2.0) 97 | rspec (~> 2) 98 | multi_json (1.0.1) 99 | multi_xml (0.2.2) 100 | multipart-post (1.1.0) 101 | net-ldap (0.2.2) 102 | nokogiri (1.4.4) 103 | oa-basic (0.2.5) 104 | oa-core (= 0.2.5) 105 | rest-client (~> 1.6.0) 106 | oa-core (0.2.5) 107 | oa-enterprise (0.2.5) 108 | addressable (= 2.2.4) 109 | net-ldap (~> 0.2.2) 110 | nokogiri (~> 1.4.2) 111 | oa-core (= 0.2.5) 112 | pyu-ruby-sasl (~> 0.0.3.1) 113 | rubyntlm (~> 0.1.1) 114 | oa-more (0.2.5) 115 | multi_json (~> 1.0.0) 116 | oa-core (= 0.2.5) 117 | rest-client (~> 1.6.0) 118 | oa-oauth (0.2.5) 119 | faraday (~> 0.6.1) 120 | multi_json (~> 1.0.0) 121 | multi_xml (~> 0.2.2) 122 | oa-core (= 0.2.5) 123 | oauth (~> 0.4.0) 124 | oauth2 (~> 0.4.1) 125 | oa-openid (0.2.5) 126 | oa-core (= 0.2.5) 127 | rack-openid (~> 1.3.1) 128 | ruby-openid-apps-discovery (~> 1.2.0) 129 | oauth (0.4.4) 130 | oauth2 (0.4.1) 131 | faraday (~> 0.6.1) 132 | multi_json (>= 0.0.5) 133 | omniauth (0.2.5) 134 | oa-basic (= 0.2.5) 135 | oa-core (= 0.2.5) 136 | oa-enterprise (= 0.2.5) 137 | oa-more (= 0.2.5) 138 | oa-oauth (= 0.2.5) 139 | oa-openid (= 0.2.5) 140 | polyglot (0.3.1) 141 | pyu-ruby-sasl (0.0.3.2) 142 | rack (1.2.2) 143 | rack-mount (0.6.14) 144 | rack (>= 1.0.0) 145 | rack-openid (1.3.1) 146 | rack (>= 1.1.0) 147 | ruby-openid (>= 2.1.8) 148 | rack-test (0.5.7) 149 | rack (>= 1.0) 150 | rails (3.0.7) 151 | actionmailer (= 3.0.7) 152 | actionpack (= 3.0.7) 153 | activerecord (= 3.0.7) 154 | activeresource (= 3.0.7) 155 | activesupport (= 3.0.7) 156 | bundler (~> 1.0) 157 | railties (= 3.0.7) 158 | railties (3.0.7) 159 | actionpack (= 3.0.7) 160 | activesupport (= 3.0.7) 161 | rake (>= 0.8.7) 162 | thor (~> 0.14.4) 163 | rake (0.8.7) 164 | rest-client (1.6.1) 165 | mime-types (>= 1.16) 166 | rspec (2.5.0) 167 | rspec-core (~> 2.5.0) 168 | rspec-expectations (~> 2.5.0) 169 | rspec-mocks (~> 2.5.0) 170 | rspec-core (2.5.2) 171 | rspec-expectations (2.5.0) 172 | diff-lcs (~> 1.1.2) 173 | rspec-mocks (2.5.0) 174 | rspec-rails (2.5.0) 175 | actionpack (~> 3.0) 176 | activesupport (~> 3.0) 177 | railties (~> 3.0) 178 | rspec (~> 2.5.0) 179 | ruby-openid (2.1.8) 180 | ruby-openid-apps-discovery (1.2.0) 181 | ruby-openid (>= 2.1.7) 182 | rubyntlm (0.1.1) 183 | rubyzip (0.9.4) 184 | selenium-webdriver (0.2.0) 185 | childprocess (>= 0.1.7) 186 | ffi (>= 1.0.7) 187 | json_pure 188 | rubyzip 189 | term-ansicolor (1.0.5) 190 | thor (0.14.6) 191 | treetop (1.4.9) 192 | polyglot (>= 0.3.1) 193 | tzinfo (0.3.27) 194 | will_paginate (3.0.pre2) 195 | xpath (0.1.4) 196 | nokogiri (~> 1.3) 197 | 198 | PLATFORMS 199 | ruby 200 | 201 | DEPENDENCIES 202 | bson_ext (>= 1.3.0) 203 | capybara (>= 0.4.1.2) 204 | cucumber-rails (>= 0.4.1) 205 | database_cleaner (>= 0.6.7) 206 | factory_girl_rails (>= 1.1.beta1) 207 | launchy (>= 0.4.0) 208 | mongoid (>= 2.0.1) 209 | mongoid-rspec (>= 1.4.2) 210 | omniauth (>= 0.2.4) 211 | rails (= 3.0.7) 212 | rspec-rails (>= 2.5.0) 213 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Rails3 Mongoid Omniauth 2 | ======================== 3 | 4 | 5 | ________________________ 6 | 7 | License 8 | 9 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. Rails 3 + Mongoid + Omniauth 2 | 3 | This is an example *Rails 3 application* that combines *OmniAuth* with *Mongoid*. It uses the "OmniAuth":https://github.com/intridea/omniauth gem to manage authentication using a service provider such as Twitter or Facebook. MongoDB is used as a datastore with the "Mongoid":http://mongoid.org/ gem for quick development without schemas or migrations. 4 | 5 | h2. The Project Has Moved! 6 | 7 | Please visit the project at its "new home":https://github.com/railsapps/rails3-mongoid-omniauth: 8 | 9 | h4. "Rails 3 + Mongoid + OmniAuth":https://github.com/railsapps/rails3-mongoid-omniauth 10 | 11 | h2. !http://twitter-badges.s3.amazonaws.com/t_logo-a.png(Follow on Twitter)!:http://www.twitter.com/rails_apps Follow on Twitter 12 | 13 | To keep up to date, follow the project on Twitter: 14 | "http://twitter.com/rails_apps":http://twitter.com/rails_apps 15 | 16 | Please tweet some praise if you like what you've found. 17 | 18 | h2. Credits 19 | 20 | Daniel Kehoe ("http://danielkehoe.com/":http://danielkehoe.com/) implemented the application and wrote the tutorial. 21 | -------------------------------------------------------------------------------- /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 | require 'rake' 6 | 7 | Rails3MongoidOmniauth::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | helper_method :current_user 4 | helper_method :user_signed_in? 5 | helper_method :correct_user? 6 | 7 | private 8 | def current_user 9 | begin 10 | @current_user ||= User.find(session[:user_id]) if session[:user_id] 11 | rescue Mongoid::Errors::DocumentNotFound 12 | nil 13 | end 14 | end 15 | 16 | def user_signed_in? 17 | return true if current_user 18 | end 19 | 20 | def correct_user? 21 | @user = User.find(params[:id]) 22 | unless current_user == @user 23 | redirect_to root_url, :alert => "Access denied." 24 | end 25 | end 26 | 27 | def authenticate_user! 28 | if !current_user 29 | redirect_to root_url, :alert => 'You need to sign in for access to this page.' 30 | end 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | @users = User.all 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | class SessionsController < ApplicationController 2 | 3 | def new 4 | redirect_to '/auth/twitter' 5 | end 6 | 7 | 8 | def create 9 | auth = request.env["omniauth.auth"] 10 | user = User.where(:provider => auth['provider'], 11 | :uid => auth['uid']).first || User.create_with_omniauth(auth) 12 | session[:user_id] = user.id 13 | if !user.email 14 | redirect_to edit_user_path(user), :alert => "Please enter your email address." 15 | else 16 | redirect_to root_url, :notice => 'Signed in!' 17 | end 18 | 19 | end 20 | 21 | def destroy 22 | session[:user_id] = nil 23 | redirect_to root_url, :notice => 'Signed out!' 24 | end 25 | 26 | def failure 27 | redirect_to root_url, :alert => "Authentication error: #{params[:message].humanize}" 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | before_filter :authenticate_user! 3 | before_filter :correct_user? 4 | 5 | def edit 6 | @user = User.find(params[:id]) 7 | end 8 | 9 | def update 10 | @user = User.find(params[:id]) 11 | if @user.update_attributes(params[:user]) 12 | redirect_to @user 13 | else 14 | render :edit 15 | end 16 | end 17 | 18 | 19 | def show 20 | @user = User.find(params[:id]) 21 | 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User 2 | include Mongoid::Document 3 | field :provider, :type => String 4 | field :uid, :type => String 5 | field :name, :type => String 6 | field :email, :type => String 7 | attr_accessible :provider, :uid, :name, :email 8 | 9 | def self.create_with_omniauth(auth) 10 | begin 11 | create! do |user| 12 | user.provider = auth['provider'] 13 | user.uid = auth['uid'] 14 | if auth['user_info'] 15 | user.name = auth['user_info']['name'] if auth['user_info']['name'] # Twitter, Google, Yahoo, GitHub 16 | user.email = auth['user_info']['email'] if auth['user_info']['email'] # Google, Yahoo, GitHub 17 | end 18 | if auth['extra']['user_hash'] 19 | user.name = auth['extra']['user_hash']['name'] if auth['extra']['user_hash']['name'] # Facebook 20 | user.email = auth['extra']['user_hash']['email'] if auth['extra']['user_hash']['email'] # Facebook 21 | end 22 | end 23 | rescue Exception 24 | raise Exception, "cannot create user record" 25 | end 26 | end 27 | 28 | end 29 | 30 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |
User: <%=link_to user.name, user %>
4 | <% end %> 5 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Find me in app/views/users/show.html.erb
3 |User: <%= @user.name %>
4 |Email: <%= @user.email if @user.email %>
5 | -------------------------------------------------------------------------------- /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 Rails3MongoidOmniauth::Application 5 | -------------------------------------------------------------------------------- /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, Rails.env) if defined?(Bundler) 13 | 14 | module Rails3MongoidOmniauth 15 | class Application < Rails::Application 16 | 17 | config.generators do |g| 18 | g.view_specs false 19 | g.helper_specs false 20 | end 21 | 22 | # Settings in config/environments/* take precedence over those specified here. 23 | # Application configuration should go into files in config/initializers 24 | # -- all .rb files in that directory are automatically loaded. 25 | 26 | # Custom directories with classes and modules you want to be autoloadable. 27 | # config.autoload_paths += %W(#{config.root}/extras) 28 | 29 | # Only load the plugins named here, in the order given (default is alphabetical). 30 | # :all can be used as a placeholder for all plugins not explicitly named. 31 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 32 | 33 | # Activate observers that should always be running. 34 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 35 | 36 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 37 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 38 | # config.time_zone = 'Central Time (US & Canada)' 39 | 40 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 41 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 42 | # config.i18n.default_locale = :de 43 | 44 | # JavaScript files you want as :defaults (application.js is always included). 45 | config.action_view.javascript_expansions[:defaults] = %w(jquery rails) 46 | 47 | # Configure the default encoding used in templates for Ruby 1.9. 48 | config.encoding = "utf-8" 49 | 50 | # Configure sensitive parameters which will be filtered from the log file. 51 | config.filter_parameters += [:password] 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/cucumber.yml: -------------------------------------------------------------------------------- 1 | <% 2 | rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" 3 | rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" 4 | std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" 5 | %> 6 | default: <%= std_opts %> features 7 | wip: --tags @wip:3 --wip features 8 | rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip 9 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Rails3MongoidOmniauth::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::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 webserver 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_view.debug_rjs = true 15 | config.action_controller.perform_caching = false 16 | 17 | # Don't care if the mailer can't send 18 | config.action_mailer.raise_delivery_errors = false 19 | 20 | # Print deprecation notices to the Rails logger 21 | config.active_support.deprecation = :log 22 | 23 | # Only use best-standards-support built into browsers 24 | config.action_dispatch.best_standards_support = :builtin 25 | end 26 | 27 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The production environment is meant for finished, "live" apps. 5 | # Code is not reloaded between requests 6 | config.cache_classes = true 7 | 8 | # Full error reports are disabled and caching is turned on 9 | config.consider_all_requests_local = false 10 | config.action_controller.perform_caching = true 11 | 12 | # Specifies the header that your server uses for sending files 13 | config.action_dispatch.x_sendfile_header = "X-Sendfile" 14 | 15 | # For nginx: 16 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' 17 | 18 | # If you have no front-end server that supports something like X-Sendfile, 19 | # just comment this out and Rails will serve the files 20 | 21 | # See everything in the log (default is :info) 22 | # config.log_level = :debug 23 | 24 | # Use a different logger for distributed setups 25 | # config.logger = SyslogLogger.new 26 | 27 | # Use a different cache store in production 28 | # config.cache_store = :mem_cache_store 29 | 30 | # Disable Rails's static asset server 31 | # In production, Apache or nginx will already do this 32 | config.serve_static_assets = false 33 | 34 | # Enable serving of images, stylesheets, and javascripts from an asset server 35 | # config.action_controller.asset_host = "http://assets.example.com" 36 | 37 | # Disable delivery errors, bad email addresses will be ignored 38 | # config.action_mailer.raise_delivery_errors = false 39 | 40 | # Enable threaded mode 41 | # config.threadsafe! 42 | 43 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 44 | # the I18n.default_locale when a translation can not be found) 45 | config.i18n.fallbacks = true 46 | 47 | # Send deprecation notices to registered listeners 48 | config.active_support.deprecation = :notify 49 | end 50 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::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 | # Log error messages when you accidentally call methods on nil. 11 | config.whiny_nils = true 12 | 13 | # Show full error reports and disable caching 14 | config.consider_all_requests_local = true 15 | config.action_controller.perform_caching = false 16 | 17 | # Raise exceptions instead of rendering exception templates 18 | config.action_dispatch.show_exceptions = false 19 | 20 | # Disable request forgery protection in test environment 21 | config.action_controller.allow_forgery_protection = false 22 | 23 | # Tell Action Mailer not to deliver emails to the real world. 24 | # The :test delivery method accumulates sent emails in the 25 | # ActionMailer::Base.deliveries array. 26 | config.action_mailer.delivery_method = :test 27 | 28 | # Use SQL instead of Active Record's schema dumper when creating the test database. 29 | # This is necessary if your schema can't be completely dumped by the schema dumper, 30 | # like if you have constraints or database-specific column types 31 | # config.active_record.schema_format = :sql 32 | 33 | # Print deprecation notices to the stderr 34 | config.active_support.deprecation = :stderr 35 | end 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/initializers/generators.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.generators do |g| 2 | end 3 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/initializers/omniauth.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.middleware.use OmniAuth::Builder do 2 | provider :twitter, 'KEY', 'SECRET' 3 | end 4 | -------------------------------------------------------------------------------- /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 | Rails3MongoidOmniauth::Application.config.secret_token = 'ce0c9e90903f6dea6f661a8ee8edbd5f4bee4428a4c9ba10e255efd63846b23908537c1a07903cb11ac8cd1fadaa639141450ae7880b22b9bffbbfeffb514d80' 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails3MongoidOmniauth::Application.config.session_store :cookie_store, :key => '_rails3-mongoid-omniauth_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 | # Rails3MongoidOmniauth::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /config/mongoid.yml: -------------------------------------------------------------------------------- 1 | defaults: &defaults 2 | host: localhost 3 | # slaves: 4 | # - host: slave1.local 5 | # port: 27018 6 | # - host: slave2.local 7 | # port: 27019 8 | 9 | development: 10 | <<: *defaults 11 | database: rails3_mongoid_omniauth_development 12 | 13 | test: 14 | <<: *defaults 15 | database: rails3_mongoid_omniauth_test 16 | 17 | # set these environment variables on your prod server 18 | production: 19 | host: <%= ENV['MONGOID_HOST'] %> 20 | port: <%= ENV['MONGOID_PORT'] %> 21 | username: <%= ENV['MONGOID_USERNAME'] %> 22 | password: <%= ENV['MONGOID_PASSWORD'] %> 23 | database: <%= ENV['MONGOID_DATABASE'] %> -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::Application.routes.draw do 2 | #get \"users\/show\" 3 | 4 | root :to => "home#index" 5 | 6 | resources :users, :only => [ :show, :edit, :update ] 7 | 8 | match '/auth/:provider/callback' => 'sessions#create' 9 | 10 | match '/signin' => 'sessions#new', :as => :signin 11 | 12 | match '/signout' => 'sessions#destroy', :as => :signout 13 | 14 | match '/auth/failure' => 'sessions#failure' 15 | 16 | # The priority is based upon order of creation: 17 | # first created -> highest priority. 18 | 19 | # Sample of regular route: 20 | # match 'products/:id' => 'catalog#view' 21 | # Keep in mind you can assign values other than :controller and :action 22 | 23 | # Sample of named route: 24 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 25 | # This route can be invoked with purchase_url(:id => product.id) 26 | 27 | # Sample resource route (maps HTTP verbs to controller actions automatically): 28 | # resources :products 29 | 30 | # Sample resource route with options: 31 | # resources :products do 32 | # member do 33 | # get 'short' 34 | # post 'toggle' 35 | # end 36 | # 37 | # collection do 38 | # get 'sold' 39 | # end 40 | # end 41 | 42 | # Sample resource route with sub-resources: 43 | # resources :products do 44 | # resources :comments, :sales 45 | # resource :seller 46 | # end 47 | 48 | # Sample resource route with more complex sub-resources 49 | # resources :products do 50 | # resources :comments 51 | # resources :sales do 52 | # get 'recent', :on => :collection 53 | # end 54 | # end 55 | 56 | # Sample resource route within a namespace: 57 | # namespace :admin do 58 | # # Directs /admin/products/* to Admin::ProductsController 59 | # # (app/controllers/admin/products_controller.rb) 60 | # resources :products 61 | # end 62 | 63 | # You can have the root of your site routed with "root" 64 | # just remember to delete public/index.html. 65 | # root :to => "welcome#index" 66 | 67 | # See how all your routes lay out with "rake routes" 68 | 69 | # This is a legacy wild controller route that's not recommended for RESTful applications. 70 | # Note: This route will make all actions in every controller accessible via GET requests. 71 | # match ':controller(/:action(/:id(.:format)))' 72 | end 73 | -------------------------------------------------------------------------------- /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 => 'Daley', :city => cities.first) 8 | puts 'EMPTY THE MONGODB DATABASE' 9 | Mongoid.master.collections.reject { |c| c.name =~ /^system/}.each(&:drop) 10 | -------------------------------------------------------------------------------- /features/step_definitions/web_steps.rb: -------------------------------------------------------------------------------- 1 | # TL;DR: YOU SHOULD DELETE THIS FILE 2 | # 3 | # This file was generated by Cucumber-Rails and is only here to get you a head start 4 | # These step definitions are thin wrappers around the Capybara/Webrat API that lets you 5 | # visit pages, interact with widgets and make assertions about page content. 6 | # 7 | # If you use these step definitions as basis for your features you will quickly end up 8 | # with features that are: 9 | # 10 | # * Hard to maintain 11 | # * Verbose to read 12 | # 13 | # A much better approach is to write your own higher level step definitions, following 14 | # the advice in the following blog posts: 15 | # 16 | # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html 17 | # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/ 18 | # * http://elabs.se/blog/15-you-re-cuking-it-wrong 19 | # 20 | 21 | 22 | require 'uri' 23 | require 'cgi' 24 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) 25 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors")) 26 | 27 | module WithinHelpers 28 | def with_scope(locator) 29 | locator ? within(*selector_for(locator)) { yield } : yield 30 | end 31 | end 32 | World(WithinHelpers) 33 | 34 | # Single-line step scoper 35 | When /^(.*) within ([^:]+)$/ do |step, parent| 36 | with_scope(parent) { When step } 37 | end 38 | 39 | # Multi-line step scoper 40 | When /^(.*) within ([^:]+):$/ do |step, parent, table_or_string| 41 | with_scope(parent) { When "#{step}:", table_or_string } 42 | end 43 | 44 | Given /^(?:|I )am on (.+)$/ do |page_name| 45 | visit path_to(page_name) 46 | end 47 | 48 | When /^(?:|I )go to (.+)$/ do |page_name| 49 | visit path_to(page_name) 50 | end 51 | 52 | When /^(?:|I )press "([^"]*)"$/ do |button| 53 | click_button(button) 54 | end 55 | 56 | When /^(?:|I )follow "([^"]*)"$/ do |link| 57 | click_link(link) 58 | end 59 | 60 | When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value| 61 | fill_in(field, :with => value) 62 | end 63 | 64 | When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field| 65 | fill_in(field, :with => value) 66 | end 67 | 68 | # Use this to fill in an entire form with data from a table. Example: 69 | # 70 | # When I fill in the following: 71 | # | Account Number | 5002 | 72 | # | Expiry date | 2009-11-01 | 73 | # | Note | Nice guy | 74 | # | Wants Email? | | 75 | # 76 | # TODO: Add support for checkbox, select og option 77 | # based on naming conventions. 78 | # 79 | When /^(?:|I )fill in the following:$/ do |fields| 80 | fields.rows_hash.each do |name, value| 81 | When %{I fill in "#{name}" with "#{value}"} 82 | end 83 | end 84 | 85 | When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field| 86 | select(value, :from => field) 87 | end 88 | 89 | When /^(?:|I )check "([^"]*)"$/ do |field| 90 | check(field) 91 | end 92 | 93 | When /^(?:|I )uncheck "([^"]*)"$/ do |field| 94 | uncheck(field) 95 | end 96 | 97 | When /^(?:|I )choose "([^"]*)"$/ do |field| 98 | choose(field) 99 | end 100 | 101 | When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field| 102 | attach_file(field, File.expand_path(path)) 103 | end 104 | 105 | Then /^(?:|I )should see "([^"]*)"$/ do |text| 106 | if page.respond_to? :should 107 | page.should have_content(text) 108 | else 109 | assert page.has_content?(text) 110 | end 111 | end 112 | 113 | Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp| 114 | regexp = Regexp.new(regexp) 115 | 116 | if page.respond_to? :should 117 | page.should have_xpath('//*', :text => regexp) 118 | else 119 | assert page.has_xpath?('//*', :text => regexp) 120 | end 121 | end 122 | 123 | Then /^(?:|I )should not see "([^"]*)"$/ do |text| 124 | if page.respond_to? :should 125 | page.should have_no_content(text) 126 | else 127 | assert page.has_no_content?(text) 128 | end 129 | end 130 | 131 | Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp| 132 | regexp = Regexp.new(regexp) 133 | 134 | if page.respond_to? :should 135 | page.should have_no_xpath('//*', :text => regexp) 136 | else 137 | assert page.has_no_xpath?('//*', :text => regexp) 138 | end 139 | end 140 | 141 | Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value| 142 | with_scope(parent) do 143 | field = find_field(field) 144 | field_value = (field.tag_name == 'textarea') ? field.text : field.value 145 | if field_value.respond_to? :should 146 | field_value.should =~ /#{value}/ 147 | else 148 | assert_match(/#{value}/, field_value) 149 | end 150 | end 151 | end 152 | 153 | Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value| 154 | with_scope(parent) do 155 | field = find_field(field) 156 | field_value = (field.tag_name == 'textarea') ? field.text : field.value 157 | if field_value.respond_to? :should_not 158 | field_value.should_not =~ /#{value}/ 159 | else 160 | assert_no_match(/#{value}/, field_value) 161 | end 162 | end 163 | end 164 | 165 | Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent| 166 | with_scope(parent) do 167 | field_checked = find_field(label)['checked'] 168 | if field_checked.respond_to? :should 169 | field_checked.should be_true 170 | else 171 | assert field_checked 172 | end 173 | end 174 | end 175 | 176 | Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent| 177 | with_scope(parent) do 178 | field_checked = find_field(label)['checked'] 179 | if field_checked.respond_to? :should 180 | field_checked.should be_false 181 | else 182 | assert !field_checked 183 | end 184 | end 185 | end 186 | 187 | Then /^(?:|I )should be on (.+)$/ do |page_name| 188 | current_path = URI.parse(current_url).path 189 | if current_path.respond_to? :should 190 | current_path.should == path_to(page_name) 191 | else 192 | assert_equal path_to(page_name), current_path 193 | end 194 | end 195 | 196 | Then /^(?:|I )should have the following query string:$/ do |expected_pairs| 197 | query = URI.parse(current_url).query 198 | actual_params = query ? CGI.parse(query) : {} 199 | expected_params = {} 200 | expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} 201 | 202 | if actual_params.respond_to? :should 203 | actual_params.should == expected_params 204 | else 205 | assert_equal expected_params, actual_params 206 | end 207 | end 208 | 209 | Then /^show me the page$/ do 210 | save_and_open_page 211 | end 212 | -------------------------------------------------------------------------------- /features/support/env.rb: -------------------------------------------------------------------------------- 1 | # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. 2 | # It is recommended to regenerate this file in the future when you upgrade to a 3 | # newer version of cucumber-rails. Consider adding your own code to a new file 4 | # instead of editing this one. Cucumber will automatically load all features/**/*.rb 5 | # files. 6 | 7 | require 'cucumber/rails' 8 | 9 | # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In 10 | # order to ease the transition to Capybara we set the default here. If you'd 11 | # prefer to use XPath just remove this line and adjust any selectors in your 12 | # steps to use the XPath syntax. 13 | Capybara.default_selector = :css 14 | 15 | # By default, any exception happening in your Rails application will bubble up 16 | # to Cucumber so that your scenario will fail. This is a different from how 17 | # your application behaves in the production environment, where an error page will 18 | # be rendered instead. 19 | # 20 | # Sometimes we want to override this default behaviour and allow Rails to rescue 21 | # exceptions and display an error page (just like when the app is running in production). 22 | # Typical scenarios where you want to do this is when you test your error pages. 23 | # There are two ways to allow Rails to rescue exceptions: 24 | # 25 | # 1) Tag your scenario (or feature) with @allow-rescue 26 | # 27 | # 2) Set the value below to true. Beware that doing this globally is not 28 | # recommended as it will mask a lot of errors for you! 29 | # 30 | ActionController::Base.allow_rescue = false 31 | 32 | # Remove/comment out the lines below if your app doesn't have a database. 33 | # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. 34 | begin 35 | DatabaseCleaner.orm = 'mongoid' 36 | DatabaseCleaner.strategy = :truncation 37 | rescue NameError 38 | raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." 39 | end 40 | 41 | -------------------------------------------------------------------------------- /features/support/paths.rb: -------------------------------------------------------------------------------- 1 | module NavigationHelpers 2 | # Maps a name to a path. Used by the 3 | # 4 | # When /^I go to (.+)$/ do |page_name| 5 | # 6 | # step definition in web_steps.rb 7 | # 8 | def path_to(page_name) 9 | case page_name 10 | 11 | when /the home\s?page/ 12 | '/' 13 | 14 | # Add more mappings here. 15 | # Here is an example that pulls values out of the Regexp: 16 | # 17 | # when /^(.*)'s profile page$/i 18 | # user_profile_path(User.find_by_login($1)) 19 | 20 | else 21 | begin 22 | page_name =~ /the (.*) page/ 23 | path_components = $1.split(/\s+/) 24 | self.send(path_components.push('path').join('_').to_sym) 25 | rescue Object => e 26 | raise "Can't find mapping from \"#{page_name}\" to a path.\n" + 27 | "Now, go and add a mapping in #{__FILE__}" 28 | end 29 | end 30 | end 31 | end 32 | 33 | World(NavigationHelpers) 34 | -------------------------------------------------------------------------------- /features/support/selectors.rb: -------------------------------------------------------------------------------- 1 | module HtmlSelectorsHelpers 2 | # Maps a name to a selector. Used primarily by the 3 | # 4 | # When /^(.+) within (.+)$/ do |step, scope| 5 | # 6 | # step definitions in web_steps.rb 7 | # 8 | def selector_for(locator) 9 | case locator 10 | 11 | when /the page/ 12 | "html > body" 13 | 14 | # Add more mappings here. 15 | # Here is an example that pulls values out of the Regexp: 16 | # 17 | # when /the (notice|error|info) flash/ 18 | # ".flash.#{$1}" 19 | 20 | # You can also return an array to use a different selector 21 | # type, like: 22 | # 23 | # when /the header/ 24 | # [:xpath, "//header"] 25 | 26 | # This allows you to provide a quoted selector as the scope 27 | # for "within" steps as was previously the default for the 28 | # web steps: 29 | when /"(.+)"/ 30 | $1 31 | 32 | else 33 | raise "Can't find mapping from \"#{locator}\" to a selector.\n" + 34 | "Now, go and add a mapping in #{__FILE__}" 35 | end 36 | end 37 | end 38 | 39 | World(HtmlSelectorsHelpers) 40 | -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fortuity/rails3-mongoid-omniauth/21abd743cf5b0546987c5c2da2670b0b5c0f0c03/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/cucumber.rake: -------------------------------------------------------------------------------- 1 | # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. 2 | # It is recommended to regenerate this file in the future when you upgrade to a 3 | # newer version of cucumber-rails. Consider adding your own code to a new file 4 | # instead of editing this one. Cucumber will automatically load all features/**/*.rb 5 | # files. 6 | 7 | 8 | unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks 9 | 10 | vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first 11 | $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? 12 | 13 | begin 14 | require 'cucumber/rake/task' 15 | 16 | namespace :cucumber do 17 | Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| 18 | t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. 19 | t.fork = true # You may get faster startup if you set this to false 20 | t.profile = 'default' 21 | end 22 | 23 | Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| 24 | t.binary = vendored_cucumber_bin 25 | t.fork = true # You may get faster startup if you set this to false 26 | t.profile = 'wip' 27 | end 28 | 29 | Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| 30 | t.binary = vendored_cucumber_bin 31 | t.fork = true # You may get faster startup if you set this to false 32 | t.profile = 'rerun' 33 | end 34 | 35 | desc 'Run all features' 36 | task :all => [:ok, :wip] 37 | end 38 | desc 'Alias for cucumber:ok' 39 | task :cucumber => 'cucumber:ok' 40 | 41 | task :default => :cucumber 42 | 43 | task :features => :cucumber do 44 | STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" 45 | end 46 | 47 | # In case we don't have ActiveRecord, append a no-op task that we can depend upon. 48 | task 'db:test:prepare' do 49 | end 50 | rescue LoadError 51 | desc 'cucumber rake task not available (cucumber not installed)' 52 | task :cucumber do 53 | abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' 54 | end 55 | end 56 | 57 | end 58 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |You may have mistyped the address or the page may have moved.
24 |Maybe you tried to change something you didn't have access to.
24 |We've been notified about this issue and we'll take a look at it shortly.
24 |t |