email_spec 0.6.6 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +21 -26
- data/README.rdoc +5 -3
- data/Rakefile +16 -27
- data/examples/rails3_root/Gemfile +17 -0
- data/examples/rails3_root/Gemfile.lock +138 -0
- data/examples/rails3_root/README +5 -0
- data/examples/rails3_root/Rakefile +11 -0
- data/examples/rails3_root/app/controllers/application_controller.rb +3 -0
- data/examples/rails3_root/app/controllers/welcome_controller.rb +16 -0
- data/examples/rails3_root/app/helpers/application_helper.rb +2 -0
- data/examples/rails3_root/app/mailers/user_mailer.rb +39 -0
- data/examples/{rails_root → rails3_root}/app/models/user.rb +0 -0
- data/examples/{rails_root/app/views/user_mailer/attachments.erb → rails3_root/app/views/user_mailer/attachments.html.erb} +0 -0
- data/examples/{rails_root/app/views/user_mailer/newsletter.erb → rails3_root/app/views/user_mailer/newsletter.html.erb} +0 -0
- data/examples/{rails_root/app/views/user_mailer/signup.erb → rails3_root/app/views/user_mailer/signup.html.erb} +1 -0
- data/examples/rails3_root/app/views/user_mailer/signup.text.erb +4 -0
- data/examples/{rails_root → rails3_root}/app/views/welcome/attachments.html.erb +0 -0
- data/examples/{rails_root → rails3_root}/app/views/welcome/confirm.html.erb +0 -0
- data/examples/{rails_root → rails3_root}/app/views/welcome/index.html.erb +1 -1
- data/examples/{rails_root → rails3_root}/app/views/welcome/newsletter.html.erb +0 -0
- data/examples/{rails_root → rails3_root}/app/views/welcome/signup.html.erb +0 -0
- data/examples/{rails_root → rails3_root}/attachments/document.pdf +0 -0
- data/examples/{rails_root → rails3_root}/attachments/image.png +0 -0
- data/examples/rails3_root/config.ru +4 -0
- data/examples/rails3_root/config/application.rb +43 -0
- data/examples/rails3_root/config/boot.rb +14 -0
- data/examples/rails3_root/config/cucumber.yml +8 -0
- data/examples/{rails_root → rails3_root}/config/database.yml +0 -0
- data/examples/rails3_root/config/environment.rb +6 -0
- data/examples/rails3_root/config/environments/development.rb +20 -0
- data/examples/rails3_root/config/environments/production.rb +42 -0
- data/examples/rails3_root/config/environments/test.rb +30 -0
- data/examples/rails3_root/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rails3_root/config/initializers/cookie_verification_secret.rb +7 -0
- data/examples/rails3_root/config/initializers/delayed_job.rb +1 -0
- data/examples/{rails_root → rails3_root}/config/initializers/inflections.rb +0 -0
- data/examples/{rails_root → rails3_root}/config/initializers/mime_types.rb +0 -0
- data/examples/rails3_root/config/initializers/notifier_job.rb +1 -0
- data/examples/rails3_root/config/initializers/rspec_generator.rb +6 -0
- data/examples/rails3_root/config/initializers/session_store.rb +10 -0
- data/examples/rails3_root/config/locales/en.yml +5 -0
- data/examples/rails3_root/config/routes.rb +7 -0
- data/examples/{rails_root → rails3_root}/db/migrate/20090125013728_create_users.rb +0 -0
- data/examples/{rails_root → rails3_root}/db/migrate/20090908054656_create_delayed_jobs.rb +0 -0
- data/examples/{rails_root → rails3_root}/db/schema.rb +7 -6
- data/examples/rails3_root/db/seeds.rb +7 -0
- data/examples/rails3_root/doc/README_FOR_APP +2 -0
- data/examples/{rails_root → rails3_root}/features/attachments.feature +0 -0
- data/examples/{rails_root → rails3_root}/features/delayed_job.feature +0 -0
- data/examples/{rails_root → rails3_root}/features/errors.feature +0 -0
- data/examples/{sinatra → rails3_root}/features/example.feature +9 -0
- data/examples/{rails_root → rails3_root}/features/step_definitions/user_steps.rb +2 -2
- data/examples/rails3_root/features/step_definitions/web_steps.rb +219 -0
- data/examples/{rails_root → rails3_root}/features/support/env.rb +10 -10
- data/examples/rails3_root/features/support/env_ext.rb +2 -0
- data/examples/{rails_root → rails3_root}/features/support/paths.rb +2 -2
- data/examples/rails3_root/lib/notifier_job.rb +5 -0
- data/examples/{rails_root → rails3_root}/lib/tasks/cucumber.rake +6 -0
- data/examples/rails3_root/lib/tasks/rspec.rake +69 -0
- data/examples/rails3_root/public/404.html +26 -0
- data/examples/rails3_root/public/422.html +26 -0
- data/examples/rails3_root/public/500.html +26 -0
- data/examples/{rails_root → rails3_root}/public/favicon.ico +0 -0
- data/examples/{rails_root → rails3_root}/public/images/rails.png +0 -0
- data/examples/{rails_root → rails3_root}/public/javascripts/application.js +0 -0
- data/examples/{rails_root → rails3_root}/public/javascripts/controls.js +5 -3
- data/examples/{rails_root → rails3_root}/public/javascripts/dragdrop.js +7 -6
- data/examples/{rails_root → rails3_root}/public/javascripts/effects.js +8 -13
- data/examples/{rails_root → rails3_root}/public/javascripts/prototype.js +1573 -1019
- data/examples/rails3_root/public/javascripts/rails.js +109 -0
- data/examples/{rails_root → rails3_root}/public/robots.txt +0 -0
- data/examples/{rails_root → rails3_root}/script/cucumber +0 -0
- data/examples/rails3_root/script/rails +9 -0
- data/examples/rails3_root/spec/controllers/welcome_controller_spec.rb +20 -0
- data/examples/{rails_root → rails3_root}/spec/models/user_mailer_spec.rb +7 -18
- data/examples/rails3_root/spec/spec_helper.rb +19 -0
- data/examples/sinatra_root/config.ru +4 -0
- data/examples/{sinatra → sinatra_root}/features/errors.feature +0 -0
- data/examples/{rails_root → sinatra_root}/features/example.feature +0 -0
- data/examples/{sinatra → sinatra_root}/features/step_definitions/user_steps.rb +2 -2
- data/examples/sinatra_root/features/step_definitions/web_steps.rb +219 -0
- data/examples/sinatra_root/features/support/env.rb +21 -0
- data/examples/{sinatra → sinatra_root}/features/support/paths.rb +9 -4
- data/examples/sinatra_root/lib/example_sinatra_app.rb +35 -0
- data/lib/email_spec.rb +2 -2
- data/lib/email_spec/deliveries.rb +7 -11
- data/lib/email_spec/email_viewer.rb +1 -1
- data/lib/email_spec/helpers.rb +7 -7
- data/lib/email_spec/mail_ext.rb +11 -0
- data/lib/email_spec/matchers.rb +31 -26
- data/lib/generators/email_spec/steps/USAGE +5 -0
- data/lib/generators/email_spec/steps/steps_generator.rb +14 -0
- data/{examples/rails3_root/features/step_definitions → lib/generators/email_spec/steps/templates}/email_steps.rb +0 -0
- data/spec/email_spec/helpers_spec.rb +4 -6
- data/spec/email_spec/mail_ext_spec.rb +34 -0
- data/spec/email_spec/matchers_spec.rb +227 -37
- data/spec/spec_helper.rb +14 -2
- metadata +174 -207
- data/examples/rails_root/Rakefile +0 -13
- data/examples/rails_root/app/controllers/application_controller.rb +0 -15
- data/examples/rails_root/app/controllers/welcome_controller.rb +0 -16
- data/examples/rails_root/app/helpers/application_helper.rb +0 -3
- data/examples/rails_root/app/helpers/welcome_helper.rb +0 -2
- data/examples/rails_root/app/models/user_mailer.rb +0 -39
- data/examples/rails_root/config/boot.rb +0 -110
- data/examples/rails_root/config/cucumber.yml +0 -7
- data/examples/rails_root/config/environment.rb +0 -28
- data/examples/rails_root/config/environments/cucumber.rb +0 -29
- data/examples/rails_root/config/environments/development.rb +0 -17
- data/examples/rails_root/config/environments/production.rb +0 -28
- data/examples/rails_root/config/environments/test.rb +0 -28
- data/examples/rails_root/config/initializers/new_rails_defaults.rb +0 -17
- data/examples/rails_root/config/routes.rb +0 -45
- data/examples/rails_root/doc/README_FOR_APP +0 -5
- data/examples/rails_root/features/step_definitions/web_steps.rb +0 -273
- data/examples/rails_root/features/support/env_ext.rb +0 -6
- data/examples/rails_root/public/404.html +0 -30
- data/examples/rails_root/public/422.html +0 -30
- data/examples/rails_root/public/500.html +0 -33
- data/examples/rails_root/public/dispatch.rb +0 -10
- data/examples/rails_root/script/about +0 -4
- data/examples/rails_root/script/autospec +0 -5
- data/examples/rails_root/script/console +0 -3
- data/examples/rails_root/script/dbconsole +0 -3
- data/examples/rails_root/script/delayed_job +0 -5
- data/examples/rails_root/script/destroy +0 -3
- data/examples/rails_root/script/generate +0 -3
- data/examples/rails_root/script/performance/benchmarker +0 -3
- data/examples/rails_root/script/performance/profiler +0 -3
- data/examples/rails_root/script/performance/request +0 -3
- data/examples/rails_root/script/plugin +0 -3
- data/examples/rails_root/script/process/inspector +0 -3
- data/examples/rails_root/script/process/reaper +0 -3
- data/examples/rails_root/script/process/spawner +0 -3
- data/examples/rails_root/script/runner +0 -3
- data/examples/rails_root/script/server +0 -3
- data/examples/rails_root/script/spec +0 -5
- data/examples/rails_root/script/spec_server +0 -125
- data/examples/rails_root/spec/controllers/welcome_controller_spec.rb +0 -15
- data/examples/rails_root/spec/model_factory.rb +0 -6
- data/examples/rails_root/spec/models/user_spec.rb +0 -5
- data/examples/rails_root/spec/rcov.opts +0 -2
- data/examples/rails_root/spec/spec.opts +0 -4
- data/examples/rails_root/spec/spec_helper.rb +0 -51
- data/examples/sinatra/app.rb +0 -33
- data/examples/sinatra/features/step_definitions/email_steps.rb +0 -182
- data/examples/sinatra/features/step_definitions/web_steps.rb +0 -273
- data/examples/sinatra/features/support/env.rb +0 -39
- data/examples/sinatra_root/features/step_definitions/email_steps.rb +0 -194
- data/lib/email_spec/#helpers.rb# +0 -168
- data/spec/spec.opts +0 -4
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
-
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
-
|
|
6
|
-
<head>
|
|
7
|
-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
8
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
|
9
|
-
<style type="text/css">
|
|
10
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
11
|
-
div.dialog {
|
|
12
|
-
width: 25em;
|
|
13
|
-
padding: 0 4em;
|
|
14
|
-
margin: 4em auto 0 auto;
|
|
15
|
-
border: 1px solid #ccc;
|
|
16
|
-
border-right-color: #999;
|
|
17
|
-
border-bottom-color: #999;
|
|
18
|
-
}
|
|
19
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
20
|
-
</style>
|
|
21
|
-
</head>
|
|
22
|
-
|
|
23
|
-
<body>
|
|
24
|
-
<!-- This file lives in public/404.html -->
|
|
25
|
-
<div class="dialog">
|
|
26
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
|
27
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
|
28
|
-
</div>
|
|
29
|
-
</body>
|
|
30
|
-
</html>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
-
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
-
|
|
6
|
-
<head>
|
|
7
|
-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
8
|
-
<title>The change you wanted was rejected (422)</title>
|
|
9
|
-
<style type="text/css">
|
|
10
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
11
|
-
div.dialog {
|
|
12
|
-
width: 25em;
|
|
13
|
-
padding: 0 4em;
|
|
14
|
-
margin: 4em auto 0 auto;
|
|
15
|
-
border: 1px solid #ccc;
|
|
16
|
-
border-right-color: #999;
|
|
17
|
-
border-bottom-color: #999;
|
|
18
|
-
}
|
|
19
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
20
|
-
</style>
|
|
21
|
-
</head>
|
|
22
|
-
|
|
23
|
-
<body>
|
|
24
|
-
<!-- This file lives in public/422.html -->
|
|
25
|
-
<div class="dialog">
|
|
26
|
-
<h1>The change you wanted was rejected.</h1>
|
|
27
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
28
|
-
</div>
|
|
29
|
-
</body>
|
|
30
|
-
</html>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
-
|
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
5
|
-
|
|
6
|
-
<head>
|
|
7
|
-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
8
|
-
<title>We're sorry, but something went wrong (500)</title>
|
|
9
|
-
<style type="text/css">
|
|
10
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
|
11
|
-
div.dialog {
|
|
12
|
-
width: 25em;
|
|
13
|
-
padding: 0 4em;
|
|
14
|
-
margin: 4em auto 0 auto;
|
|
15
|
-
border: 1px solid #ccc;
|
|
16
|
-
border-right-color: #999;
|
|
17
|
-
border-bottom-color: #999;
|
|
18
|
-
}
|
|
19
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
|
20
|
-
</style>
|
|
21
|
-
</head>
|
|
22
|
-
|
|
23
|
-
<body>
|
|
24
|
-
<!-- This file lives in public/500.html -->
|
|
25
|
-
<div class="dialog">
|
|
26
|
-
<h1>We're sorry, but something went wrong.</h1>
|
|
27
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
|
28
|
-
<p><small>(If you're the administrator of this website, then please read
|
|
29
|
-
the log file "<%=h RAILS_ENV %>.log"
|
|
30
|
-
to find out what went wrong.)</small></p>
|
|
31
|
-
</div>
|
|
32
|
-
</body>
|
|
33
|
-
</html>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
|
|
2
|
-
|
|
3
|
-
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
|
4
|
-
|
|
5
|
-
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
|
|
6
|
-
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
|
7
|
-
require "dispatcher"
|
|
8
|
-
|
|
9
|
-
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
|
10
|
-
Dispatcher.dispatch
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
ENV['RSPEC'] = 'true' # allows autotest to discover rspec
|
|
3
|
-
ENV['AUTOTEST'] = 'true' # allows autotest to run w/ color on linux
|
|
4
|
-
system((RUBY_PLATFORM =~ /mswin|mingw/ ? 'autotest.bat' : 'autotest'), *ARGV) ||
|
|
5
|
-
$stderr.puts("Unable to find autotest. Please install ZenTest or fix your PATH")
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../vendor/plugins/rspec/lib' # For rspec installed as plugin
|
|
3
|
-
require 'rubygems'
|
|
4
|
-
require 'drb/drb'
|
|
5
|
-
require 'rbconfig'
|
|
6
|
-
require 'spec'
|
|
7
|
-
require 'optparse'
|
|
8
|
-
|
|
9
|
-
# This is based on Florian Weber's TDDMate
|
|
10
|
-
module Spec
|
|
11
|
-
module Runner
|
|
12
|
-
class RailsSpecServer
|
|
13
|
-
def run(argv, stderr, stdout)
|
|
14
|
-
$stdout = stdout
|
|
15
|
-
$stderr = stderr
|
|
16
|
-
|
|
17
|
-
unless ActiveRecord::Base.respond_to?(:clear_reloadable_connections!)
|
|
18
|
-
base = ActiveRecord::Base
|
|
19
|
-
def base.clear_reloadable_connections!
|
|
20
|
-
active_connections.each do |name, conn|
|
|
21
|
-
if conn.requires_reloading?
|
|
22
|
-
conn.disconnect!
|
|
23
|
-
active_connections.delete(name)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
ActiveRecord::Base.clear_reloadable_connections!
|
|
30
|
-
|
|
31
|
-
if ActionController.const_defined?(:Dispatcher)
|
|
32
|
-
dispatcher = ::ActionController::Dispatcher.new($stdout)
|
|
33
|
-
dispatcher.cleanup_application
|
|
34
|
-
elsif ::Dispatcher.respond_to?(:reset_application!)
|
|
35
|
-
::Dispatcher.reset_application!
|
|
36
|
-
else
|
|
37
|
-
raise "Application reloading failed"
|
|
38
|
-
end
|
|
39
|
-
if Object.const_defined?(:Fixtures) && Fixtures.respond_to?(:reset_cache)
|
|
40
|
-
Fixtures.reset_cache
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
if ::ActiveSupport.const_defined?(:Dependencies)
|
|
44
|
-
::ActiveSupport::Dependencies.mechanism = :load
|
|
45
|
-
else
|
|
46
|
-
::Dependencies.mechanism = :load
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
require_dependency('application.rb') unless Object.const_defined?(:ApplicationController)
|
|
50
|
-
load File.dirname(__FILE__) + '/../spec/spec_helper.rb'
|
|
51
|
-
|
|
52
|
-
if in_memory_database?
|
|
53
|
-
load "#{RAILS_ROOT}/db/schema.rb" # use db agnostic schema by default
|
|
54
|
-
ActiveRecord::Migrator.up('db/migrate') # use migrations
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
::Spec::Runner::CommandLine.run(
|
|
58
|
-
::Spec::Runner::OptionParser.parse(
|
|
59
|
-
argv,
|
|
60
|
-
$stderr,
|
|
61
|
-
$stdout
|
|
62
|
-
)
|
|
63
|
-
)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def in_memory_database?
|
|
67
|
-
ENV["RAILS_ENV"] == "test" and
|
|
68
|
-
::ActiveRecord::Base.connection.class.to_s == "ActiveRecord::ConnectionAdapters::SQLite3Adapter" and
|
|
69
|
-
::Rails::Configuration.new.database_configuration['test']['database'] == ':memory:'
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
puts "Loading Rails environment"
|
|
75
|
-
|
|
76
|
-
ENV["RAILS_ENV"] = "test"
|
|
77
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
|
78
|
-
require 'dispatcher'
|
|
79
|
-
|
|
80
|
-
def restart_test_server
|
|
81
|
-
puts "restarting"
|
|
82
|
-
config = ::Config::CONFIG
|
|
83
|
-
ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
|
|
84
|
-
command_line = [ruby, $0, ARGV].flatten.join(' ')
|
|
85
|
-
exec(command_line)
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def daemonize(pid_file = nil)
|
|
89
|
-
return yield if $DEBUG
|
|
90
|
-
pid = Process.fork{
|
|
91
|
-
Process.setsid
|
|
92
|
-
Dir.chdir(RAILS_ROOT)
|
|
93
|
-
trap("SIGINT"){ exit! 0 }
|
|
94
|
-
trap("SIGTERM"){ exit! 0 }
|
|
95
|
-
trap("SIGHUP"){ restart_test_server }
|
|
96
|
-
File.open("/dev/null"){|f|
|
|
97
|
-
STDERR.reopen f
|
|
98
|
-
STDIN.reopen f
|
|
99
|
-
STDOUT.reopen f
|
|
100
|
-
}
|
|
101
|
-
yield
|
|
102
|
-
}
|
|
103
|
-
puts "spec_server launched. (PID: %d)" % pid
|
|
104
|
-
File.open(pid_file,"w"){|f| f.puts pid } if pid_file
|
|
105
|
-
exit! 0
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
options = Hash.new
|
|
109
|
-
opts = OptionParser.new
|
|
110
|
-
opts.on("-d", "--daemon"){|v| options[:daemon] = true }
|
|
111
|
-
opts.on("-p", "--pid PIDFILE"){|v| options[:pid] = v }
|
|
112
|
-
opts.parse!(ARGV)
|
|
113
|
-
|
|
114
|
-
puts "Ready"
|
|
115
|
-
exec_server = lambda {
|
|
116
|
-
trap("USR2") { restart_test_server } if Signal.list.has_key?("USR2")
|
|
117
|
-
DRb.start_service("druby://127.0.0.1:8989", Spec::Runner::RailsSpecServer.new)
|
|
118
|
-
DRb.thread.join
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if options[:daemon]
|
|
122
|
-
daemonize(options[:pid], &exec_server)
|
|
123
|
-
else
|
|
124
|
-
exec_server.call
|
|
125
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
|
-
|
|
3
|
-
describe WelcomeController do
|
|
4
|
-
|
|
5
|
-
describe "POST /signup (#signup)" do
|
|
6
|
-
it "should deliver the signup email" do
|
|
7
|
-
# expect
|
|
8
|
-
UserMailer.should_receive(:deliver_signup).with("email@example.com", "Jimmy Bean")
|
|
9
|
-
# when
|
|
10
|
-
post :signup, "Email" => "email@example.com", "Name" => "Jimmy Bean"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
|
2
|
-
# from the project root directory.
|
|
3
|
-
ENV["RAILS_ENV"] = "test"
|
|
4
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
|
5
|
-
require 'spec'
|
|
6
|
-
require 'spec/rails'
|
|
7
|
-
|
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + "/model_factory.rb")
|
|
9
|
-
require (RAILS_ROOT + '/../../lib/email_spec.rb')
|
|
10
|
-
|
|
11
|
-
Spec::Runner.configure do |config|
|
|
12
|
-
config.include(Fixjour)
|
|
13
|
-
# If you're not using ActiveRecord you should remove these
|
|
14
|
-
# lines, delete config/database.yml and disable :active_record
|
|
15
|
-
# in your config/boot.rb
|
|
16
|
-
#config.use_transactional_fixtures = true
|
|
17
|
-
#config.use_instantiated_fixtures = false
|
|
18
|
-
#config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
|
|
19
|
-
|
|
20
|
-
# == Fixtures
|
|
21
|
-
#
|
|
22
|
-
# You can declare fixtures for each example_group like this:
|
|
23
|
-
# describe "...." do
|
|
24
|
-
# fixtures :table_a, :table_b
|
|
25
|
-
#
|
|
26
|
-
# Alternatively, if you prefer to declare them only once, you can
|
|
27
|
-
# do so right here. Just uncomment the next line and replace the fixture
|
|
28
|
-
# names with your fixtures.
|
|
29
|
-
#
|
|
30
|
-
# config.global_fixtures = :table_a, :table_b
|
|
31
|
-
#
|
|
32
|
-
# If you declare global fixtures, be aware that they will be declared
|
|
33
|
-
# for all of your examples, even those that don't use them.
|
|
34
|
-
#
|
|
35
|
-
# You can also declare which fixtures to use (for example fixtures for test/fixtures):
|
|
36
|
-
#
|
|
37
|
-
# config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
|
|
38
|
-
#
|
|
39
|
-
# == Mock Framework
|
|
40
|
-
#
|
|
41
|
-
# RSpec uses it's own mocking framework by default. If you prefer to
|
|
42
|
-
# use mocha, flexmock or RR, uncomment the appropriate line:
|
|
43
|
-
#
|
|
44
|
-
# config.mock_with :mocha
|
|
45
|
-
# config.mock_with :flexmock
|
|
46
|
-
# config.mock_with :rr
|
|
47
|
-
#
|
|
48
|
-
# == Notes
|
|
49
|
-
#
|
|
50
|
-
# For more information take a look at Spec::Runner::Configuration and Spec::Runner
|
|
51
|
-
end
|
data/examples/sinatra/app.rb
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
require 'sinatra'
|
|
2
|
-
require 'pony'
|
|
3
|
-
|
|
4
|
-
get '/' do
|
|
5
|
-
<<-EOHTML
|
|
6
|
-
<form method="post" action="/signup">
|
|
7
|
-
<label for="Name">Name</label>
|
|
8
|
-
<input type="text" id="Name" name="user[name]">
|
|
9
|
-
<label for="Email">Email</label>
|
|
10
|
-
<input type="text" id="Email" name="user[email]">
|
|
11
|
-
<input type="submit" value="Sign up">
|
|
12
|
-
</form>
|
|
13
|
-
EOHTML
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
post '/signup' do
|
|
17
|
-
user = params[:user]
|
|
18
|
-
body = <<-EOHTML
|
|
19
|
-
Hello #{user['name']}!
|
|
20
|
-
|
|
21
|
-
<a href="http://www.example.com/confirm">Click here to confirm your account!</a>
|
|
22
|
-
EOHTML
|
|
23
|
-
Pony.mail(:from => 'admin@example.com',
|
|
24
|
-
:to => user['email'],
|
|
25
|
-
:subject => 'Account confirmation',
|
|
26
|
-
:body => body
|
|
27
|
-
)
|
|
28
|
-
'Thanks! Go check your email!'
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
get '/confirm' do
|
|
32
|
-
'Confirm your new account!'
|
|
33
|
-
end
|