funktional 1.0.0

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.
Files changed (62) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/Manifest +60 -0
  3. data/README.rdoc +292 -0
  4. data/Rakefile +36 -0
  5. data/funktional.gemspec +31 -0
  6. data/lib/funktional/assertion.rb +9 -0
  7. data/lib/funktional/assigned_assertion.rb +43 -0
  8. data/lib/funktional/attribute_test_helper.rb +27 -0
  9. data/lib/funktional/context/assigned_should_block.rb +32 -0
  10. data/lib/funktional/context/collector.rb +21 -0
  11. data/lib/funktional/context/count_should_block.rb +21 -0
  12. data/lib/funktional/context/delegating_should_block.rb +30 -0
  13. data/lib/funktional/context/element_should_block.rb +29 -0
  14. data/lib/funktional/context/flashed_should_block.rb +17 -0
  15. data/lib/funktional/context/should_block.rb +60 -0
  16. data/lib/funktional/context/should_create_block.rb +17 -0
  17. data/lib/funktional/context/should_delete_block.rb +17 -0
  18. data/lib/funktional/context/should_not_block.rb +20 -0
  19. data/lib/funktional/context/should_not_create_block.rb +17 -0
  20. data/lib/funktional/context/should_not_delete_block.rb +17 -0
  21. data/lib/funktional/context/should_not_send_email_block.rb +18 -0
  22. data/lib/funktional/context/stack_recorder.rb +35 -0
  23. data/lib/funktional/context.rb +126 -0
  24. data/lib/funktional/email_assertion.rb +50 -0
  25. data/lib/funktional/flashed_assertion.rb +12 -0
  26. data/lib/funktional/model_assertions.rb +108 -0
  27. data/lib/funktional/random_characters.rb +11 -0
  28. data/lib/funktional/recursive_assertion.rb +23 -0
  29. data/lib/funktional/route_checker.rb +49 -0
  30. data/lib/funktional/setup.rb +11 -0
  31. data/lib/funktional/test_class_methods.rb +28 -0
  32. data/lib/funktional/test_instance_methods.rb +131 -0
  33. data/lib/funktional.rb +42 -0
  34. data/tasks/should_b_tasks.rake +4 -0
  35. data/test/fixtures/posts.yml +4 -0
  36. data/test/fixtures/users.yml +9 -0
  37. data/test/functional/users_controller_test.rb +59 -0
  38. data/test/test-app/app/controllers/application_controller.rb +10 -0
  39. data/test/test-app/app/controllers/users_controller.rb +33 -0
  40. data/test/test-app/app/helpers/application_helper.rb +3 -0
  41. data/test/test-app/app/models/post.rb +3 -0
  42. data/test/test-app/app/models/user.rb +7 -0
  43. data/test/test-app/app/views/users/edit.html.erb +0 -0
  44. data/test/test-app/app/views/users/index.html.erb +0 -0
  45. data/test/test-app/app/views/users/new.html.erb +0 -0
  46. data/test/test-app/config/boot.rb +110 -0
  47. data/test/test-app/config/database.yml +4 -0
  48. data/test/test-app/config/environment.rb +12 -0
  49. data/test/test-app/config/environments/test.rb +0 -0
  50. data/test/test-app/config/initializers/funktional.rb +8 -0
  51. data/test/test-app/config/initializers/new_rails_defaults.rb +21 -0
  52. data/test/test-app/config/routes.rb +5 -0
  53. data/test/test-app/db/migrate/001_create_users.rb +18 -0
  54. data/test/test-app/db/migrate/002_create_posts.rb +13 -0
  55. data/test/test-app/public/404.html +30 -0
  56. data/test/test-app/public/422.html +30 -0
  57. data/test/test-app/public/500.html +30 -0
  58. data/test/test-app/script/console +3 -0
  59. data/test/test-app/script/generate +3 -0
  60. data/test/test_helper.rb +26 -0
  61. data/test/unit/user_test.rb +12 -0
  62. metadata +159 -0
@@ -0,0 +1,131 @@
1
+ module Funktional
2
+
3
+ module TestInstanceMethods
4
+ def should(params, &block)
5
+ method = "should_#{params.keys.first}".to_sym
6
+ args = (params.length > 1) ? params : params.values.first
7
+
8
+ self.send method, args, &block
9
+ end
10
+
11
+ def should_not(params, &block)
12
+ if params.is_a? Hash
13
+ method = "should_not_#{params.keys.first}".to_sym
14
+ args = params.values.first
15
+ else
16
+ method = "should_not_#{params}".to_sym
17
+ args = nil
18
+ end
19
+ self.send method, args, &block
20
+ end
21
+
22
+ def flashed(symbol)
23
+ FlashedAssertion.new(symbol)
24
+ end
25
+
26
+ def assigned(klass)
27
+ AssignedAssertion.new(klass)
28
+ end
29
+
30
+ private
31
+
32
+ def should_route(params, &blk)
33
+ _wrap_assertion do
34
+ checker = RouteChecker.build(params, &blk)
35
+ assert_routing(checker.__path_and_method, checker.__controller_action_etc)
36
+ end
37
+ end
38
+
39
+ alias :should_method :should_route
40
+
41
+ def should_send_email(details)
42
+ EmailAssertion.new(details)
43
+ end
44
+
45
+ def should_not_send_email(going_to_be_nil = nil)
46
+ before_count = ActionMailer::Base.deliveries.size
47
+ yield
48
+ after_count = ActionMailer::Base.deliveries.size
49
+ assert_equal before_count, after_count, "Email was sent"
50
+ end
51
+
52
+ def should_render(template)
53
+ _wrap_assertion do
54
+ assert_response :success
55
+ assert_template template
56
+ end
57
+ end
58
+
59
+ def should_render_404(expected_template = 'public/404')
60
+ _wrap_assertion do
61
+ actual_template = @response.rendered[:template].to_s
62
+
63
+ if actual_template.blank?
64
+ msg = "redirected to [#{@response.redirected_to}]"
65
+ else
66
+ msg = "rendered template [#{actual_template}]"
67
+ end
68
+ assert_response :not_found, msg
69
+ assert_template expected_template
70
+ end
71
+ end
72
+
73
+ def should_assign_new(klass_or_symbol)
74
+ if klass_or_symbol.is_a? Symbol
75
+ symbol = klass_or_symbol
76
+
77
+ assert_not_nil assigns(symbol), "No [:#{symbol}] assigned"
78
+ assert assigns(symbol).new_record?, "[:#{symbol}] is not a new record"
79
+ else
80
+ klass = klass_or_symbol
81
+ symbol = klass.to_s.tableize.singularize.to_sym
82
+
83
+ assert_not_nil assigns(symbol), "No [#{symbol}] assigned"
84
+ assert assigns(symbol).new_record?, "[#{klass}] is not a new record"
85
+ assert assigns(symbol).is_a?(klass), "assigned [#{symbol}] is not a [#{klass}]"
86
+ end
87
+ end
88
+
89
+ def should_redirect_to(uri)
90
+ _wrap_assertion do
91
+ assert_response :redirect
92
+ assert_redirected_to uri
93
+ end
94
+ end
95
+
96
+ def should_respond(expected_response)
97
+ assert_response :not_found
98
+ assert_template 'public/404'
99
+ end
100
+
101
+ # Delete
102
+
103
+ def should_delete(klass)
104
+ before_count = klass.count
105
+ expected_count = before_count - 1
106
+ yield
107
+ assert_equal expected_count, klass.count, "A [#{klass}] was not deleted"
108
+ end
109
+
110
+ def should_not_delete(klass)
111
+ expected_count = klass.count
112
+ yield
113
+ assert_equal expected_count, klass.count, "A [#{klass}] was deleted"
114
+ end
115
+
116
+ # Create
117
+
118
+ def should_create(klass)
119
+ before_count = klass.count
120
+ expected_count = before_count + 1
121
+ yield
122
+ assert_equal expected_count, klass.count, "New [#{klass}] was not created"
123
+ end
124
+
125
+ def should_not_create(klass)
126
+ expected_count = klass.count
127
+ yield
128
+ assert_equal expected_count, klass.count, "New [#{klass}] was created"
129
+ end
130
+ end
131
+ end
data/lib/funktional.rb ADDED
@@ -0,0 +1,42 @@
1
+ Rails.backtrace_cleaner.add_silencer { |line| line =~ /funktional/ }
2
+
3
+ require 'test_help'
4
+
5
+ require 'funktional/test_instance_methods'
6
+ require 'funktional/test_class_methods'
7
+
8
+ require 'funktional/assertion'
9
+ require 'funktional/recursive_assertion'
10
+ require 'funktional/assigned_assertion'
11
+ require 'funktional/email_assertion'
12
+ require 'funktional/flashed_assertion'
13
+ require 'funktional/model_assertions'
14
+ require 'funktional/route_checker'
15
+ require 'funktional/attribute_test_helper'
16
+
17
+ require 'funktional/context'
18
+ require 'funktional/context/stack_recorder'
19
+ require 'funktional/context/should_block'
20
+ require 'funktional/context/should_not_block'
21
+ require 'funktional/context/delegating_should_block'
22
+ require 'funktional/context/should_create_block'
23
+ require 'funktional/context/should_not_create_block'
24
+ require 'funktional/context/should_not_delete_block'
25
+ require 'funktional/context/should_not_send_email_block'
26
+ require 'funktional/context/should_delete_block'
27
+ require 'funktional/context/element_should_block'
28
+ require 'funktional/context/count_should_block'
29
+ require 'funktional/context/flashed_should_block'
30
+ require 'funktional/context/assigned_should_block'
31
+ require 'funktional/context/collector'
32
+
33
+ require 'funktional/setup'
34
+
35
+ ActiveRecord::Base.send(:include, Funktional::ModelAssertions)
36
+
37
+ ActiveSupport::TestCase.send(:include, Funktional::TestInstanceMethods)
38
+ ActiveSupport::TestCase.send :extend, Funktional::TestClassMethods
39
+ ActiveSupport::TestCase.send(:include, Funktional::AttributeTestHelper)
40
+
41
+ ActiveSupport::TestCase.send(:include, Funktional::Setup)
42
+
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :should_b do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,4 @@
1
+ article:
2
+ user: fred
3
+ title: Article
4
+ body: Some body text
@@ -0,0 +1,9 @@
1
+ fred:
2
+ name: fred
3
+ email: fred@funktional.com
4
+ phone: "01234567890"
5
+ age: 35
6
+
7
+ bob:
8
+ name: bob
9
+ email: bob@funktional.com
@@ -0,0 +1,59 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class UsersControllerTest < ActionController::TestCase
4
+ fixtures :all
5
+
6
+ context "viewing user index" do
7
+ before do
8
+ @fred = users(:fred)
9
+ @bob = users(:bob)
10
+ get :index
11
+ end
12
+
13
+ assigned(:users).should_be { [@bob, @fred] }
14
+ end
15
+
16
+ context "Viewing a new user" do
17
+ before { get :new }
18
+
19
+ should :render => :new
20
+ should :assign_new => User
21
+ end
22
+
23
+ context "Creating a user" do
24
+ before { post :create, :user => attrib }
25
+
26
+ should :create => User
27
+ should :redirect_to => "/users"
28
+ end
29
+
30
+ context "With a user" do
31
+ before { @user = users(:fred) }
32
+
33
+ context "editing the user" do
34
+ before { get :edit, :id => @user.to_param }
35
+
36
+ should :render => :edit
37
+ assigned(User).should_be { @user }
38
+
39
+ should "still be able to assign variable in instance version" do
40
+ assigned(User).should_be @user
41
+ end
42
+ end
43
+
44
+ context "updating the user" do
45
+ before { put :update, :id => @user.to_param, :user => replace_attrib(:name => "demo") }
46
+
47
+ should_not :create => User
48
+ assigned(User).name.should_be "demo"
49
+ end
50
+ end
51
+
52
+ private
53
+ def attrib
54
+ {
55
+ :name => "test"
56
+ }
57
+ end
58
+
59
+ end
@@ -0,0 +1,10 @@
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
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
+
8
+ # Scrub sensitive parameters from your log
9
+ # filter_parameter_logging :password
10
+ end
@@ -0,0 +1,33 @@
1
+ class UsersController < ApplicationController
2
+
3
+ def index
4
+ @users = User.all
5
+ end
6
+
7
+ def new
8
+ @user = User.new
9
+ end
10
+
11
+ def create
12
+ @user = User.new(params[:user])
13
+
14
+ if @user.save
15
+ redirect_to users_url
16
+ else
17
+ flash[:error] = "Something went wrong"
18
+ render :new
19
+ end
20
+ end
21
+
22
+ def edit
23
+ @user = User.find(params[:id])
24
+ end
25
+
26
+ def update
27
+ @user = User.find(params[:id])
28
+
29
+ @user.update_attributes(params[:user])
30
+
31
+ redirect_to users_url
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,3 @@
1
+ class Post < ActiveRecord::Base
2
+ belongs_to :user
3
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ has_many :posts
4
+
5
+ validates_presence_of :name
6
+
7
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,4 @@
1
+ test:
2
+ :adapter: sqlite3
3
+ # :dbfile: db/sqlite3.db
4
+ :dbfile: ":memory:"
@@ -0,0 +1,12 @@
1
+ RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
2
+ require File.join(File.dirname(__FILE__), 'boot')
3
+
4
+ Rails::Initializer.run do |config|
5
+ config.log_level = :debug
6
+ config.cache_classes = false
7
+ config.whiny_nils = true
8
+ config.action_controller.session = {
9
+ :key => 'funktional_session',
10
+ :secret => 'sdasda2138120dsad1201023da'
11
+ }
12
+ end
File without changes
@@ -0,0 +1,8 @@
1
+ # This simulates loading the funktional plugin, but without relying on
2
+ # vendor/plugins
3
+
4
+ funktional_path = File.join(File.dirname(__FILE__), *%w(.. .. .. ..))
5
+ funktional_lib_path = File.join(funktional_path, "lib")
6
+
7
+ $LOAD_PATH.unshift(funktional_lib_path)
8
+ load File.join(funktional_path, "init.rb")
@@ -0,0 +1,21 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ ActionController::Routing.generate_best_match = false
15
+
16
+ # Use ISO 8601 format for JSON serialized times and dates.
17
+ ActiveSupport.use_standard_json_time_format = true
18
+
19
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
20
+ # if you're including raw json in an HTML page.
21
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,5 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+
3
+ map.resources :users
4
+
5
+ end
@@ -0,0 +1,18 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.string :email
6
+ t.integer :age
7
+ t.string :phone
8
+ end
9
+ add_index :users, :email, :unique => true
10
+ add_index :users, :name
11
+ add_index :users, :age
12
+ add_index :users, [:email, :name], :unique => true
13
+ end
14
+
15
+ def self.down
16
+ drop_table :users
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :posts do |t|
4
+ t.column :user_id, :integer
5
+ t.column :title, :string
6
+ t.column :body, :text
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ drop_table :posts
12
+ end
13
+ end
@@ -0,0 +1,30 @@
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>
@@ -0,0 +1,30 @@
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>
@@ -0,0 +1,30 @@
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
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.expand_path('../../config/boot', __FILE__)
3
+ require 'commands/generate'
@@ -0,0 +1,26 @@
1
+ require 'fileutils'
2
+
3
+ # Load the environment
4
+ ENV['RAILS_ENV'] = 'test'
5
+
6
+ test_app = File.dirname(__FILE__) + '/test-app'
7
+
8
+ require "#{test_app}/config/environment.rb"
9
+
10
+ # Load the testing framework
11
+ require 'test_help'
12
+ silence_warnings { RAILS_ENV = ENV['RAILS_ENV'] }
13
+
14
+ # Run the migrations
15
+ ActiveRecord::Migration.verbose = false
16
+ ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
17
+
18
+ # Setup the fixtures path
19
+ ActiveSupport::TestCase.fixture_path = File.join(File.dirname(__FILE__), "fixtures")
20
+
21
+ class ActiveSupport::TestCase #:nodoc:
22
+ setup :funktional
23
+
24
+ self.use_transactional_fixtures = false
25
+ self.use_instantiated_fixtures = false
26
+ end
@@ -0,0 +1,12 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ fixtures :all
5
+
6
+ context "a user" do
7
+ before { @user = users(:fred) }
8
+
9
+ should("require a name") { @user.should_require_a :name, "can't be blank" }
10
+ end
11
+
12
+ end