mischa-email_spec 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -10
- data/Rakefile +1 -1
- data/generators/email_spec/templates/email_steps.rb +36 -12
- data/lib/email_spec/email_spec_helpers.rb +54 -35
- data/lib/email_spec.rb +1 -1
- data/spec/email_spec_helpers_spec.rb +28 -0
- data/spec/rails_root/Rakefile +10 -0
- data/spec/rails_root/app/controllers/application.rb +15 -0
- data/spec/rails_root/app/controllers/welcome_controller.rb +9 -0
- data/spec/rails_root/app/helpers/application_helper.rb +3 -0
- data/spec/rails_root/app/helpers/welcome_helper.rb +2 -0
- data/spec/rails_root/app/models/user_mailer.rb +12 -0
- data/spec/rails_root/app/views/user_mailer/signup.erb +3 -0
- data/spec/rails_root/app/views/welcome/confirm.html.erb +1 -0
- data/spec/rails_root/app/views/welcome/index.html.erb +8 -0
- data/spec/rails_root/app/views/welcome/signup.html.erb +1 -0
- data/spec/rails_root/config/boot.rb +109 -0
- data/spec/rails_root/config/database.yml +22 -0
- data/spec/rails_root/config/environment.rb +22 -0
- data/spec/rails_root/config/environments/development.rb +17 -0
- data/spec/rails_root/config/environments/production.rb +24 -0
- data/spec/rails_root/config/environments/test.rb +29 -0
- data/spec/rails_root/config/initializers/inflections.rb +10 -0
- data/spec/rails_root/config/initializers/mime_types.rb +5 -0
- data/spec/rails_root/config/initializers/new_rails_defaults.rb +17 -0
- data/spec/rails_root/config/routes.rb +43 -0
- data/spec/rails_root/db/schema.rb +14 -0
- data/spec/rails_root/doc/README_FOR_APP +5 -0
- data/spec/rails_root/features/errors.feature +42 -0
- data/spec/rails_root/features/example.feature +34 -0
- data/spec/rails_root/features/step_definitions/email_steps.rb +68 -0
- data/spec/rails_root/features/step_definitions/webrat_steps.rb +100 -0
- data/spec/rails_root/features/support/env.rb +14 -0
- data/spec/rails_root/lib/tasks/cucumber.rake +7 -0
- data/spec/rails_root/lib/tasks/rspec.rake +153 -0
- data/spec/rails_root/public/404.html +30 -0
- data/spec/rails_root/public/422.html +30 -0
- data/spec/rails_root/public/500.html +33 -0
- data/spec/rails_root/public/dispatch.rb +10 -0
- data/spec/rails_root/public/favicon.ico +0 -0
- data/spec/rails_root/public/images/rails.png +0 -0
- data/spec/rails_root/public/javascripts/application.js +2 -0
- data/spec/rails_root/public/javascripts/controls.js +963 -0
- data/spec/rails_root/public/javascripts/dragdrop.js +973 -0
- data/spec/rails_root/public/javascripts/effects.js +1128 -0
- data/spec/rails_root/public/javascripts/prototype.js +4320 -0
- data/spec/rails_root/public/robots.txt +5 -0
- data/spec/rails_root/script/about +4 -0
- data/spec/rails_root/script/autospec +5 -0
- data/spec/rails_root/script/console +3 -0
- data/spec/rails_root/script/cucumber +7 -0
- data/spec/rails_root/script/dbconsole +3 -0
- data/spec/rails_root/script/destroy +3 -0
- data/spec/rails_root/script/generate +3 -0
- data/spec/rails_root/script/performance/benchmarker +3 -0
- data/spec/rails_root/script/performance/profiler +3 -0
- data/spec/rails_root/script/performance/request +3 -0
- data/spec/rails_root/script/plugin +3 -0
- data/spec/rails_root/script/process/inspector +3 -0
- data/spec/rails_root/script/process/reaper +3 -0
- data/spec/rails_root/script/process/spawner +3 -0
- data/spec/rails_root/script/runner +3 -0
- data/spec/rails_root/script/server +3 -0
- data/spec/rails_root/script/spec +5 -0
- data/spec/rails_root/script/spec_server +116 -0
- data/spec/rails_root/spec/rcov.opts +2 -0
- data/spec/rails_root/spec/spec.opts +4 -0
- data/spec/rails_root/spec/spec_helper.rb +47 -0
- data/spec/rails_root/vendor/plugins/email_spec/generators/email_spec/email_spec_generator.rb +16 -0
- data/spec/rails_root/vendor/plugins/email_spec/generators/email_spec/templates/email_steps.rb +68 -0
- metadata +108 -2
- data/lib/email_spec/email_spec_steps.rb +0 -46
data/README.rdoc
CHANGED
@@ -9,10 +9,10 @@ A collection of RSpec matchers and Cucumber steps to make testing emails go smoo
|
|
9
9
|
|
10
10
|
=== Gem Setup (may or may not work atm)
|
11
11
|
|
12
|
-
gem install
|
12
|
+
gem install bmabey-email_spec
|
13
13
|
|
14
14
|
# config/environments/test.rb
|
15
|
-
config.gem 'email_spec'
|
15
|
+
config.gem 'bmabey-email_spec', :lib => 'email_spec'
|
16
16
|
|
17
17
|
=== Cucumber
|
18
18
|
|
@@ -21,6 +21,12 @@ To use the steps in features put the following in your env.rb:
|
|
21
21
|
# Make sure this require is after you require cucumber/rails/world.
|
22
22
|
require 'email_spec/cucumber'
|
23
23
|
|
24
|
+
Then:
|
25
|
+
|
26
|
+
script/generate email_spec
|
27
|
+
|
28
|
+
This will give you a bunch of steps to get started with in step_definitions/email_steps.rb
|
29
|
+
|
24
30
|
=== RSpec
|
25
31
|
|
26
32
|
The matchers and helpers should be available for your specs by default, but you need to include them into the example groups you want to use them in. To include them in all of your specs you can do this in your spec_helper.rb:
|
@@ -36,21 +42,16 @@ The matchers and helpers should be available for your specs by default, but you
|
|
36
42
|
|
37
43
|
Scenario: A new person signs up
|
38
44
|
Given I am at "/"
|
39
|
-
And
|
45
|
+
And no emails have been sent
|
40
46
|
When I fill in "Email" with "quentin@example.com"
|
41
|
-
And I fill in "Password" with "monkey"
|
42
|
-
And I fill in "Password confirmation" with "monkey"
|
43
47
|
And I press "Sign up"
|
44
|
-
|
45
|
-
And "quentin@example.com" should have 1 email
|
46
|
-
And "foo@bar.com" should not receive an email
|
48
|
+
And I should receive an email
|
47
49
|
When I open the email
|
48
50
|
Then I should see "confirm" in the email
|
49
|
-
And I should see "Account confirmation" in the subject
|
50
51
|
When I follow "confirm" in the email
|
51
52
|
Then I should see "Confirm your new account"
|
52
53
|
|
53
|
-
|
54
|
+
For more examples, check out spec/rails_root in the source for a small example app that implements these steps.
|
54
55
|
|
55
56
|
== TODO:
|
56
57
|
|
data/Rakefile
CHANGED
@@ -12,7 +12,7 @@ spec = Gem::Specification.new do |s|
|
|
12
12
|
s.bindir = "bin"
|
13
13
|
s.description = s.summary
|
14
14
|
s.require_path = "lib"
|
15
|
-
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["generators/**/*"]
|
15
|
+
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["generators/**/*"] + Dir["spec/**/*"]
|
16
16
|
# rdoc
|
17
17
|
s.has_rdoc = true
|
18
18
|
s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
|
@@ -1,5 +1,22 @@
|
|
1
1
|
#Commonly used email steps
|
2
|
+
#
|
3
|
+
# To add your own steps make a custom_email_steps.rb
|
4
|
+
# The provided methods are:
|
5
|
+
#
|
6
|
+
# reset_mailer
|
7
|
+
# open_last_email
|
8
|
+
# visit_in_email
|
9
|
+
# unread_emails_for
|
10
|
+
# mailbox_for
|
11
|
+
# current_email
|
12
|
+
# open_email
|
13
|
+
# read_emails_for
|
14
|
+
# find_email
|
2
15
|
|
16
|
+
|
17
|
+
def current_email_address
|
18
|
+
"quentin@example.com" # Replace with your a way to find your current_email. e.g current_user.email
|
19
|
+
end
|
3
20
|
# Use this step to reset the e-mail queue within a scenario.
|
4
21
|
# This is done automatically before each scenario.
|
5
22
|
Given /^(?:a clear email queue|no emails have been sent)$/ do
|
@@ -8,37 +25,44 @@ end
|
|
8
25
|
|
9
26
|
# Use this step to open the most recently sent e-mail.
|
10
27
|
When /^I open the email$/ do
|
11
|
-
|
28
|
+
open_email(current_email_address)
|
12
29
|
end
|
13
30
|
|
14
31
|
When /^I follow "(.*)" in the email$/ do |link|
|
15
32
|
visit_in_email(link)
|
16
33
|
end
|
17
34
|
|
18
|
-
Then /^
|
19
|
-
|
35
|
+
Then /^I should receive (.*) emails?$/ do |amount|
|
36
|
+
amount = 1 if amount == "an"
|
37
|
+
unread_emails_for(current_email_address).size.should == amount
|
20
38
|
end
|
21
39
|
|
22
|
-
Then /^
|
23
|
-
unread_emails_for(
|
40
|
+
Then /^"([^']*?)" should receive (\d+) emails?$/ do |address, n|
|
41
|
+
unread_emails_for(address).size.should == n.to_i
|
24
42
|
end
|
25
43
|
|
26
|
-
Then /^"([^']*?)" should have (\d+) emails?$/ do |
|
27
|
-
mailbox_for(
|
44
|
+
Then /^"([^']*?)" should have (\d+) emails?$/ do |address, n|
|
45
|
+
mailbox_for(address).size.should == n.to_i
|
28
46
|
end
|
29
47
|
|
30
|
-
Then /^"([^']*?)" should not receive an email$/ do |
|
31
|
-
|
48
|
+
Then /^"([^']*?)" should not receive an email$/ do |address|
|
49
|
+
find_email(address).should be_nil
|
32
50
|
end
|
33
51
|
|
34
52
|
Then /^I should see "(.*)" in the subject$/ do |text|
|
35
|
-
# raise ArgumentError, "To check the subject, you must first open an e-mail" if current_email.nil?
|
36
|
-
# current_email.should_not be_nil
|
37
53
|
current_email.subject.should =~ Regexp.new(text)
|
38
54
|
end
|
39
55
|
|
40
56
|
Then /^I should see "(.*)" in the email$/ do |text|
|
41
|
-
# current_email.should_not be_nil
|
42
57
|
current_email.body.should =~ Regexp.new(text)
|
43
58
|
end
|
44
59
|
|
60
|
+
When %r{^"([^']*?)" opens? the email with subject "([^']*?)"$} do |address, subject|
|
61
|
+
open_email(address, :with_subject => subject)
|
62
|
+
end
|
63
|
+
|
64
|
+
When %r{^"([^']*?)" opens? the email with text "([^']*?)"$} do |address, text|
|
65
|
+
open_email(address, :with_text => text)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
@@ -22,55 +22,74 @@ module EmailSpec
|
|
22
22
|
visit(parse_email_for_link(current_email, link_text))
|
23
23
|
end
|
24
24
|
|
25
|
-
def open_email(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
email = mailbox_for(email_address).find { |m| m.body =~ Regexp.new(opts[:with_text]) }
|
30
|
-
else
|
31
|
-
email = mailbox_for(email_address).first
|
32
|
-
end
|
33
|
-
|
34
|
-
read_emails_for(email_address) << email if email
|
35
|
-
@email_spec_hash[:current_emails][email_address] = email
|
36
|
-
@email_spec_hash[:current_email] = email
|
25
|
+
def open_email(address, opts={})
|
26
|
+
email = find_email!(address, opts)
|
27
|
+
email.should_not be_nil
|
28
|
+
set_current_email(email)
|
37
29
|
end
|
38
30
|
|
39
31
|
def open_last_email
|
40
32
|
email = ActionMailer::Base.deliveries.last
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
33
|
+
email.should_not be_nil
|
34
|
+
set_current_email(email)
|
35
|
+
end
|
36
|
+
|
37
|
+
def current_email(address=nil)
|
38
|
+
email = address ? @email_spec_hash[:current_emails][address] : @email_spec_hash[:current_email]
|
39
|
+
raise Spec::Expectations::ExpectationNotMetError, "Expected an open email but none was found. Did you forget to call open_email?" unless email
|
40
|
+
email
|
45
41
|
end
|
46
42
|
|
47
|
-
def
|
48
|
-
|
43
|
+
def unread_emails_for(address)
|
44
|
+
mailbox_for(address) - read_emails_for(address)
|
49
45
|
end
|
50
46
|
|
51
|
-
def
|
52
|
-
|
47
|
+
def read_emails_for(address)
|
48
|
+
@email_spec_hash[:read_emails][address] ||= []
|
53
49
|
end
|
54
50
|
|
55
|
-
def
|
56
|
-
|
51
|
+
def mailbox_for(address)
|
52
|
+
ActionMailer::Base.deliveries.select { |m| m.to.include?(address) }
|
57
53
|
end
|
58
54
|
|
59
|
-
def
|
60
|
-
|
55
|
+
def find_email(address, opts={})
|
56
|
+
if opts[:with_subject]
|
57
|
+
email = mailbox_for(address).find { |m| m.subject =~ Regexp.new(opts[:with_subject]) }
|
58
|
+
elsif opts[:with_text]
|
59
|
+
email = mailbox_for(address).find { |m| m.body =~ Regexp.new(opts[:with_text]) }
|
60
|
+
else
|
61
|
+
email = mailbox_for(address).first
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def find_email!(address, opts={})
|
68
|
+
email = find_email(address, opts)
|
69
|
+
if email.nil?
|
70
|
+
error = "#{opts.keys.first.to_s.humanize unless opts.empty?} #{('"' + opts.values.first.to_s.humanize + '"') unless opts.empty?}"
|
71
|
+
raise Spec::Expectations::ExpectationNotMetError, "Could not find email #{error}. \n Found the following emails:\n\n #{ActionMailer::Base.deliveries.to_s}"
|
72
|
+
end
|
73
|
+
email
|
74
|
+
end
|
75
|
+
|
76
|
+
def set_current_email(email)
|
77
|
+
return unless email
|
78
|
+
read_emails_for(email.to) << email
|
79
|
+
@email_spec_hash[:current_emails][email.to] = email
|
80
|
+
@email_spec_hash[:current_email] = email
|
61
81
|
end
|
62
82
|
|
63
|
-
def parse_email_for_link(
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
83
|
+
def parse_email_for_link(email, link_text)
|
84
|
+
email.body.should include_text(link_text)
|
85
|
+
if link_text =~ %r{^/.*$}
|
86
|
+
# if it's an explicit link
|
87
|
+
link_text
|
88
|
+
elsif email.body =~ %r{<a[^>]*href=['"]?([^'"]*)['"]?[^>]*?>[^<]*?#{link_text}[^<]*?</a>}
|
89
|
+
# if it's an anchor tag
|
90
|
+
URI.split($~[1])[5..-1].compact!.join("?").gsub("&", "&")
|
91
|
+
# sub correct ampersand after rails switches it (http://dev.rubyonrails.org/ticket/4002)
|
92
|
+
# TODO: outsource this kind of parsing to webrat or someone else
|
74
93
|
end
|
75
94
|
end
|
76
95
|
end
|
data/lib/email_spec.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
#
|
3
|
+
# module ActionMailer
|
4
|
+
# class Base
|
5
|
+
# end
|
6
|
+
# end
|
7
|
+
#
|
8
|
+
#
|
9
|
+
# module EmailSpec
|
10
|
+
# describe Helpers do
|
11
|
+
# before(:all) do
|
12
|
+
# @helper = Object.new
|
13
|
+
# @helper.extend EmailSpec::Helpers
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# describe "#reset_mailer" do
|
17
|
+
# it "should empty the all email deliveries" do
|
18
|
+
# #given
|
19
|
+
# ActionMailer::Base.stub!(:deliveries).and_return([mock("some email", mock("another email"))])
|
20
|
+
# #when
|
21
|
+
# @helper.reset_mailer
|
22
|
+
# #then
|
23
|
+
# ActionMailer::Base.deliveries.should be_empty
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
@@ -0,0 +1,10 @@
|
|
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.join(File.dirname(__FILE__), 'config', 'boot'))
|
5
|
+
|
6
|
+
require 'rake'
|
7
|
+
require 'rake/testtask'
|
8
|
+
require 'rake/rdoctask'
|
9
|
+
|
10
|
+
require 'tasks/rails'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Filters added to this controller apply to all controllers in the application.
|
2
|
+
# Likewise, all the methods added will be available for all controllers.
|
3
|
+
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
helper :all # include all helpers, all the time
|
6
|
+
|
7
|
+
# See ActionController::RequestForgeryProtection for details
|
8
|
+
# Uncomment the :secret if you're not using the cookie session store
|
9
|
+
protect_from_forgery # :secret => 'a74714b35b202f269f7a297709d555ce'
|
10
|
+
|
11
|
+
# See ActionController::Base for details
|
12
|
+
# Uncomment this to filter the contents of submitted sensitive data parameters
|
13
|
+
# from your application log (in this case, all fields with names like "password").
|
14
|
+
# filter_parameter_logging :password
|
15
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Confirm your new account!
|
@@ -0,0 +1 @@
|
|
1
|
+
Thanks! Go check your email!
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class GemBoot < Boot
|
51
|
+
def load_initializer
|
52
|
+
self.class.load_rubygems
|
53
|
+
load_rails_gem
|
54
|
+
require 'initializer'
|
55
|
+
end
|
56
|
+
|
57
|
+
def load_rails_gem
|
58
|
+
if version = self.class.gem_version
|
59
|
+
gem 'rails', version
|
60
|
+
else
|
61
|
+
gem 'rails'
|
62
|
+
end
|
63
|
+
rescue Gem::LoadError => load_error
|
64
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
65
|
+
exit 1
|
66
|
+
end
|
67
|
+
|
68
|
+
class << self
|
69
|
+
def rubygems_version
|
70
|
+
Gem::RubyGemsVersion rescue nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def gem_version
|
74
|
+
if defined? RAILS_GEM_VERSION
|
75
|
+
RAILS_GEM_VERSION
|
76
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
77
|
+
ENV['RAILS_GEM_VERSION']
|
78
|
+
else
|
79
|
+
parse_gem_version(read_environment_rb)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_rubygems
|
84
|
+
require 'rubygems'
|
85
|
+
min_version = '1.3.1'
|
86
|
+
unless rubygems_version >= min_version
|
87
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
88
|
+
exit 1
|
89
|
+
end
|
90
|
+
|
91
|
+
rescue LoadError
|
92
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
93
|
+
exit 1
|
94
|
+
end
|
95
|
+
|
96
|
+
def parse_gem_version(text)
|
97
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
def read_environment_rb
|
102
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# All that for this:
|
109
|
+
Rails.boot!
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Uncomment below to force Rails into production mode when
|
4
|
+
# you don't control web/app server and can't set it the proper way
|
5
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
+
|
7
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
+
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
|
9
|
+
|
10
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
12
|
+
|
13
|
+
Rails::Initializer.run do |config|
|
14
|
+
|
15
|
+
config.time_zone = 'UTC'
|
16
|
+
|
17
|
+
config.action_controller.session = {
|
18
|
+
:session_key => '_es_session',
|
19
|
+
:secret => 'b9327c7967925fb36f8901e43f47e0a3e8fc7856ae1b4533ddeda776381548f9ac051721446fdbc4ccc88c7353124708e73d8b0950a30487571d8f8eb5b24732'
|
20
|
+
}
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
13
|
+
config.action_view.debug_rjs = 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
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Enable threaded mode
|
8
|
+
# config.threadsafe!
|
9
|
+
|
10
|
+
# Use a different logger for distributed setups
|
11
|
+
# config.logger = SyslogLogger.new
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on
|
14
|
+
config.action_controller.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Use a different cache store in production
|
18
|
+
# config.cache_store = :mem_cache_store
|
19
|
+
|
20
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
21
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
22
|
+
|
23
|
+
# Disable delivery errors, bad email addresses will be ignored
|
24
|
+
# config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Disable request forgery protection in test environment
|
17
|
+
config.action_controller.allow_forgery_protection = false
|
18
|
+
|
19
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
20
|
+
# The :test delivery method accumulates sent emails in the
|
21
|
+
# ActionMailer::Base.deliveries array.
|
22
|
+
config.action_mailer.delivery_method = :test
|
23
|
+
|
24
|
+
|
25
|
+
config.gem 'webrat' , :source => "http://gems.github.com"
|
26
|
+
config.gem 'rspec', :lib => 'spec'
|
27
|
+
config.gem 'rspec-rails', :lib => 'spec/rails'
|
28
|
+
config.gem 'cucumber' , :source => "http://gems.github.com"
|
29
|
+
|
@@ -0,0 +1,10 @@
|
|
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
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
2
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
3
|
+
|
4
|
+
if defined?(ActiveRecord)
|
5
|
+
# Include Active Record class name as root for JSON serialized output.
|
6
|
+
ActiveRecord::Base.include_root_in_json = true
|
7
|
+
|
8
|
+
# Store the full class name (including module namespace) in STI type column.
|
9
|
+
ActiveRecord::Base.store_full_sti_class = true
|
10
|
+
end
|
11
|
+
|
12
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
13
|
+
ActiveSupport.use_standard_json_time_format = true
|
14
|
+
|
15
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
16
|
+
# if you're including raw json in an HTML page.
|
17
|
+
ActiveSupport.escape_html_entities_in_json = false
|