transactionata 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. data/.gitignore +10 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +62 -0
  5. data/Rakefile +33 -0
  6. data/lib/transactionata/version.rb +3 -0
  7. data/lib/transactionata.rb +38 -0
  8. data/test/helper.rb +9 -0
  9. data/test/rails2/Gemfile +14 -0
  10. data/test/rails2/Rakefile +10 -0
  11. data/test/rails2/app/controllers/application_controller.rb +3 -0
  12. data/test/rails2/app/controllers/posts_controller.rb +83 -0
  13. data/test/rails2/app/controllers/users_controller.rb +83 -0
  14. data/test/rails2/app/helpers/application_helper.rb +3 -0
  15. data/test/rails2/app/helpers/posts_helper.rb +2 -0
  16. data/test/rails2/app/helpers/users_helper.rb +2 -0
  17. data/test/rails2/app/models/post.rb +6 -0
  18. data/test/rails2/app/models/user.rb +9 -0
  19. data/test/rails2/app/views/layouts/application.html.erb +14 -0
  20. data/test/rails2/app/views/layouts/posts.html.erb +17 -0
  21. data/test/rails2/app/views/layouts/users.html.erb +17 -0
  22. data/test/rails2/app/views/posts/edit.html.erb +24 -0
  23. data/test/rails2/app/views/posts/index.html.erb +24 -0
  24. data/test/rails2/app/views/posts/new.html.erb +23 -0
  25. data/test/rails2/app/views/posts/show.html.erb +18 -0
  26. data/test/rails2/app/views/users/edit.html.erb +28 -0
  27. data/test/rails2/app/views/users/index.html.erb +26 -0
  28. data/test/rails2/app/views/users/new.html.erb +27 -0
  29. data/test/rails2/app/views/users/show.html.erb +23 -0
  30. data/test/rails2/config/boot.rb +128 -0
  31. data/test/rails2/config/database.yml +22 -0
  32. data/test/rails2/config/environment.rb +38 -0
  33. data/test/rails2/config/environments/development.rb +17 -0
  34. data/test/rails2/config/environments/production.rb +28 -0
  35. data/test/rails2/config/environments/test.rb +28 -0
  36. data/test/rails2/config/initializers/cookie_verification_secret.rb +7 -0
  37. data/test/rails2/config/initializers/new_rails_defaults.rb +21 -0
  38. data/test/rails2/config/initializers/session_store.rb +15 -0
  39. data/test/rails2/config/locales/en.yml +5 -0
  40. data/test/rails2/config/preinitializer.rb +20 -0
  41. data/test/rails2/config/routes.rb +49 -0
  42. data/test/rails2/db/migrate/20110214150055_create_posts.rb +15 -0
  43. data/test/rails2/db/migrate/20110214150128_create_users.rb +16 -0
  44. data/test/rails2/script/about +4 -0
  45. data/test/rails2/script/console +3 -0
  46. data/test/rails2/script/dbconsole +3 -0
  47. data/test/rails2/script/destroy +3 -0
  48. data/test/rails2/script/generate +3 -0
  49. data/test/rails2/script/performance/benchmarker +3 -0
  50. data/test/rails2/script/performance/profiler +3 -0
  51. data/test/rails2/script/plugin +3 -0
  52. data/test/rails2/script/runner +3 -0
  53. data/test/rails2/script/server +3 -0
  54. data/test/rails2/test/factories/posts_factory.rb +4 -0
  55. data/test/rails2/test/factories/users_factory.rb +7 -0
  56. data/test/rails2/test/fixtures/posts.yml +9 -0
  57. data/test/rails2/test/fixtures/users.yml +1 -0
  58. data/test/rails2/test/functional/posts_controller_test.rb +57 -0
  59. data/test/rails2/test/functional/users_controller_test.rb +57 -0
  60. data/test/rails2/test/integration/ui_test.rb +26 -0
  61. data/test/rails2/test/test_helper.rb +38 -0
  62. data/test/rails2/test/unit/helpers/posts_helper_test.rb +4 -0
  63. data/test/rails2/test/unit/helpers/users_helper_test.rb +4 -0
  64. data/test/rails2/test/unit/post_test.rb +42 -0
  65. data/test/rails2/test/unit/user_test.rb +32 -0
  66. data/test/rails3/Gemfile +37 -0
  67. data/test/rails3/Rakefile +7 -0
  68. data/test/rails3/app/controllers/application_controller.rb +3 -0
  69. data/test/rails3/app/controllers/posts_controller.rb +83 -0
  70. data/test/rails3/app/controllers/users_controller.rb +83 -0
  71. data/test/rails3/app/helpers/application_helper.rb +2 -0
  72. data/test/rails3/app/helpers/posts_helper.rb +2 -0
  73. data/test/rails3/app/helpers/users_helper.rb +2 -0
  74. data/test/rails3/app/models/post.rb +6 -0
  75. data/test/rails3/app/models/user.rb +9 -0
  76. data/test/rails3/app/views/layouts/application.html.erb +14 -0
  77. data/test/rails3/app/views/posts/_form.html.erb +25 -0
  78. data/test/rails3/app/views/posts/edit.html.erb +6 -0
  79. data/test/rails3/app/views/posts/index.html.erb +25 -0
  80. data/test/rails3/app/views/posts/new.html.erb +5 -0
  81. data/test/rails3/app/views/posts/show.html.erb +15 -0
  82. data/test/rails3/app/views/users/_form.html.erb +33 -0
  83. data/test/rails3/app/views/users/edit.html.erb +6 -0
  84. data/test/rails3/app/views/users/index.html.erb +29 -0
  85. data/test/rails3/app/views/users/new.html.erb +5 -0
  86. data/test/rails3/app/views/users/show.html.erb +25 -0
  87. data/test/rails3/config/application.rb +42 -0
  88. data/test/rails3/config/boot.rb +6 -0
  89. data/test/rails3/config/database.yml +22 -0
  90. data/test/rails3/config/environment.rb +5 -0
  91. data/test/rails3/config/environments/development.rb +26 -0
  92. data/test/rails3/config/environments/test.rb +35 -0
  93. data/test/rails3/config/initializers/secret_token.rb +7 -0
  94. data/test/rails3/config/initializers/session_store.rb +8 -0
  95. data/test/rails3/config/locales/en.yml +5 -0
  96. data/test/rails3/config/routes.rb +62 -0
  97. data/test/rails3/config.ru +4 -0
  98. data/test/rails3/db/.gitkeep +0 -0
  99. data/test/rails3/db/migrate/20110212112626_create_posts.rb +14 -0
  100. data/test/rails3/db/migrate/20110212120554_create_users.rb +16 -0
  101. data/test/rails3/db/migrate/20110213220543_add_user_reference_to_post.rb +9 -0
  102. data/test/rails3/script/rails +6 -0
  103. data/test/rails3/test/factories/posts_factory.rb +4 -0
  104. data/test/rails3/test/factories/users_factory.rb +7 -0
  105. data/test/rails3/test/fixtures/posts.yml +9 -0
  106. data/test/rails3/test/fixtures/users.yml +1 -0
  107. data/test/rails3/test/functional/posts_controller_test.rb +57 -0
  108. data/test/rails3/test/functional/users_controller_test.rb +57 -0
  109. data/test/rails3/test/integration/ui_test.rb +26 -0
  110. data/test/rails3/test/performance/browsing_test.rb +9 -0
  111. data/test/rails3/test/test_helper.rb +13 -0
  112. data/test/rails3/test/unit/helpers/posts_helper_test.rb +4 -0
  113. data/test/rails3/test/unit/helpers/users_helper_test.rb +4 -0
  114. data/test/rails3/test/unit/post_test.rb +42 -0
  115. data/test/rails3/test/unit/user_test.rb +32 -0
  116. data/test/test_rails2_integration.rb +26 -0
  117. data/test/test_rails3_integration.rb +26 -0
  118. data/transactionata.gemspec +24 -0
  119. metadata +316 -0
@@ -0,0 +1,5 @@
1
+ <h1>New post</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,15 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Title:</b>
5
+ <%= @post.title %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Body:</b>
10
+ <%= @post.body %>
11
+ </p>
12
+
13
+
14
+ <%= link_to 'Edit', edit_post_path(@post) %> |
15
+ <%= link_to 'Back', posts_path %>
@@ -0,0 +1,33 @@
1
+ <%= form_for(@user) do |f| %>
2
+ <% if @user.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @user.errors.full_messages.each do |msg| %>
8
+ <li><%= msg %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :email %><br />
20
+ <%= f.text_field :email %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :login %><br />
24
+ <%= f.text_field :login %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :password %><br />
28
+ <%= f.text_field :password %>
29
+ </div>
30
+ <div class="actions">
31
+ <%= f.submit %>
32
+ </div>
33
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @user %> |
6
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,29 @@
1
+ <h1>Listing users</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Email</th>
7
+ <th>Login</th>
8
+ <th>Password</th>
9
+ <th></th>
10
+ <th></th>
11
+ <th></th>
12
+ </tr>
13
+
14
+ <% @users.each do |user| %>
15
+ <tr>
16
+ <td><%= user.name %></td>
17
+ <td><%= user.email %></td>
18
+ <td><%= user.login %></td>
19
+ <td><%= user.password %></td>
20
+ <td><%= link_to 'Show', user %></td>
21
+ <td><%= link_to 'Edit', edit_user_path(user) %></td>
22
+ <td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+
27
+ <br />
28
+
29
+ <%= link_to 'New User', new_user_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New user</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,25 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <b>Name:</b>
5
+ <%= @user.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <b>Email:</b>
10
+ <%= @user.email %>
11
+ </p>
12
+
13
+ <p>
14
+ <b>Login:</b>
15
+ <%= @user.login %>
16
+ </p>
17
+
18
+ <p>
19
+ <b>Password:</b>
20
+ <%= @user.password %>
21
+ </p>
22
+
23
+
24
+ <%= link_to 'Edit', edit_user_path(@user) %> |
25
+ <%= link_to 'Back', users_path %>
@@ -0,0 +1,42 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module Rails3
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Custom directories with classes and modules you want to be autoloadable.
16
+ # config.autoload_paths += %W(#{config.root}/extras)
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named.
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running.
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # JavaScript files you want as :defaults (application.js is always included).
34
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
35
+
36
+ # Configure the default encoding used in templates for Ruby 1.9.
37
+ config.encoding = "utf-8"
38
+
39
+ # Configure sensitive parameters which will be filtered from the log file.
40
+ config.filter_parameters += [:password]
41
+ end
42
+ end
@@ -0,0 +1,6 @@
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'])
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
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,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Rails3::Application.initialize!
@@ -0,0 +1,26 @@
1
+ Rails3::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
+
@@ -0,0 +1,35 @@
1
+ Rails3::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
@@ -0,0 +1,7 @@
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
+ Rails3::Application.config.secret_token = 'd5e83193433ffedd0060e01bc9bacfc249cb26263f7f224e0df372ce96f03c079cd148b87ea0ea4ed31e4b6f1e268a11e924bf539e32dd08f282529fea4c3f5e'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails3::Application.config.session_store :cookie_store, :key => '_rails3_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
+ # Rails3::Application.config.session_store :active_record_store
@@ -0,0 +1,5 @@
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"
@@ -0,0 +1,62 @@
1
+ Rails3::Application.routes.draw do
2
+ resources :users
3
+
4
+ resources :posts
5
+
6
+ # The priority is based upon order of creation:
7
+ # first created -> highest priority.
8
+
9
+ # Sample of regular route:
10
+ # match 'products/:id' => 'catalog#view'
11
+ # Keep in mind you can assign values other than :controller and :action
12
+
13
+ # Sample of named route:
14
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
15
+ # This route can be invoked with purchase_url(:id => product.id)
16
+
17
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
18
+ # resources :products
19
+
20
+ # Sample resource route with options:
21
+ # resources :products do
22
+ # member do
23
+ # get 'short'
24
+ # post 'toggle'
25
+ # end
26
+ #
27
+ # collection do
28
+ # get 'sold'
29
+ # end
30
+ # end
31
+
32
+ # Sample resource route with sub-resources:
33
+ # resources :products do
34
+ # resources :comments, :sales
35
+ # resource :seller
36
+ # end
37
+
38
+ # Sample resource route with more complex sub-resources
39
+ # resources :products do
40
+ # resources :comments
41
+ # resources :sales do
42
+ # get 'recent', :on => :collection
43
+ # end
44
+ # end
45
+
46
+ # Sample resource route within a namespace:
47
+ # namespace :admin do
48
+ # # Directs /admin/products/* to Admin::ProductsController
49
+ # # (app/controllers/admin/products_controller.rb)
50
+ # resources :products
51
+ # end
52
+
53
+ # You can have the root of your site routed with "root"
54
+ # just remember to delete public/index.html.
55
+ # root :to => "welcome#index"
56
+
57
+ # See how all your routes lay out with "rake routes"
58
+
59
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
60
+ # Note: This route will make all actions in every controller accessible via GET requests.
61
+ # match ':controller(/:action(/:id(.:format)))'
62
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails3::Application
File without changes
@@ -0,0 +1,14 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :posts do |t|
4
+ t.string :title
5
+ t.text :body
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+
11
+ def self.down
12
+ drop_table :posts
13
+ end
14
+ end
@@ -0,0 +1,16 @@
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.string :login
7
+ t.string :password
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+
13
+ def self.down
14
+ drop_table :users
15
+ end
16
+ end
@@ -0,0 +1,9 @@
1
+ class AddUserReferenceToPost < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :posts, :user_id, :integer, :default => nil
4
+ end
5
+
6
+ def self.down
7
+ remove_column :posts, :user_id
8
+ end
9
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ Factory.define :post do |p|
2
+ p.title "Another great post"
3
+ p.body "Some text for another great post"
4
+ end
@@ -0,0 +1,7 @@
1
+ Factory.define :user do |u|
2
+ u.name "Some User"
3
+ u.login { "user_1" }
4
+ u.email {|f| "#{f.login}@example.com" }
5
+ u.password "someweirdpassword"
6
+ u.password_confirmation "someweirdpassword"
7
+ end