transactionata 0.1.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.
- data/.gitignore +10 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.rdoc +62 -0
- data/Rakefile +33 -0
- data/lib/transactionata/version.rb +3 -0
- data/lib/transactionata.rb +38 -0
- data/test/helper.rb +9 -0
- data/test/rails2/Gemfile +14 -0
- data/test/rails2/Rakefile +10 -0
- data/test/rails2/app/controllers/application_controller.rb +3 -0
- data/test/rails2/app/controllers/posts_controller.rb +83 -0
- data/test/rails2/app/controllers/users_controller.rb +83 -0
- data/test/rails2/app/helpers/application_helper.rb +3 -0
- data/test/rails2/app/helpers/posts_helper.rb +2 -0
- data/test/rails2/app/helpers/users_helper.rb +2 -0
- data/test/rails2/app/models/post.rb +6 -0
- data/test/rails2/app/models/user.rb +9 -0
- data/test/rails2/app/views/layouts/application.html.erb +14 -0
- data/test/rails2/app/views/layouts/posts.html.erb +17 -0
- data/test/rails2/app/views/layouts/users.html.erb +17 -0
- data/test/rails2/app/views/posts/edit.html.erb +24 -0
- data/test/rails2/app/views/posts/index.html.erb +24 -0
- data/test/rails2/app/views/posts/new.html.erb +23 -0
- data/test/rails2/app/views/posts/show.html.erb +18 -0
- data/test/rails2/app/views/users/edit.html.erb +28 -0
- data/test/rails2/app/views/users/index.html.erb +26 -0
- data/test/rails2/app/views/users/new.html.erb +27 -0
- data/test/rails2/app/views/users/show.html.erb +23 -0
- data/test/rails2/config/boot.rb +128 -0
- data/test/rails2/config/database.yml +22 -0
- data/test/rails2/config/environment.rb +38 -0
- data/test/rails2/config/environments/development.rb +17 -0
- data/test/rails2/config/environments/production.rb +28 -0
- data/test/rails2/config/environments/test.rb +28 -0
- data/test/rails2/config/initializers/cookie_verification_secret.rb +7 -0
- data/test/rails2/config/initializers/new_rails_defaults.rb +21 -0
- data/test/rails2/config/initializers/session_store.rb +15 -0
- data/test/rails2/config/locales/en.yml +5 -0
- data/test/rails2/config/preinitializer.rb +20 -0
- data/test/rails2/config/routes.rb +49 -0
- data/test/rails2/db/migrate/20110214150055_create_posts.rb +15 -0
- data/test/rails2/db/migrate/20110214150128_create_users.rb +16 -0
- data/test/rails2/script/about +4 -0
- data/test/rails2/script/console +3 -0
- data/test/rails2/script/dbconsole +3 -0
- data/test/rails2/script/destroy +3 -0
- data/test/rails2/script/generate +3 -0
- data/test/rails2/script/performance/benchmarker +3 -0
- data/test/rails2/script/performance/profiler +3 -0
- data/test/rails2/script/plugin +3 -0
- data/test/rails2/script/runner +3 -0
- data/test/rails2/script/server +3 -0
- data/test/rails2/test/factories/posts_factory.rb +4 -0
- data/test/rails2/test/factories/users_factory.rb +7 -0
- data/test/rails2/test/fixtures/posts.yml +9 -0
- data/test/rails2/test/fixtures/users.yml +1 -0
- data/test/rails2/test/functional/posts_controller_test.rb +57 -0
- data/test/rails2/test/functional/users_controller_test.rb +57 -0
- data/test/rails2/test/integration/ui_test.rb +26 -0
- data/test/rails2/test/test_helper.rb +38 -0
- data/test/rails2/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/rails2/test/unit/helpers/users_helper_test.rb +4 -0
- data/test/rails2/test/unit/post_test.rb +42 -0
- data/test/rails2/test/unit/user_test.rb +32 -0
- data/test/rails3/Gemfile +37 -0
- data/test/rails3/Rakefile +7 -0
- data/test/rails3/app/controllers/application_controller.rb +3 -0
- data/test/rails3/app/controllers/posts_controller.rb +83 -0
- data/test/rails3/app/controllers/users_controller.rb +83 -0
- data/test/rails3/app/helpers/application_helper.rb +2 -0
- data/test/rails3/app/helpers/posts_helper.rb +2 -0
- data/test/rails3/app/helpers/users_helper.rb +2 -0
- data/test/rails3/app/models/post.rb +6 -0
- data/test/rails3/app/models/user.rb +9 -0
- data/test/rails3/app/views/layouts/application.html.erb +14 -0
- data/test/rails3/app/views/posts/_form.html.erb +25 -0
- data/test/rails3/app/views/posts/edit.html.erb +6 -0
- data/test/rails3/app/views/posts/index.html.erb +25 -0
- data/test/rails3/app/views/posts/new.html.erb +5 -0
- data/test/rails3/app/views/posts/show.html.erb +15 -0
- data/test/rails3/app/views/users/_form.html.erb +33 -0
- data/test/rails3/app/views/users/edit.html.erb +6 -0
- data/test/rails3/app/views/users/index.html.erb +29 -0
- data/test/rails3/app/views/users/new.html.erb +5 -0
- data/test/rails3/app/views/users/show.html.erb +25 -0
- data/test/rails3/config/application.rb +42 -0
- data/test/rails3/config/boot.rb +6 -0
- data/test/rails3/config/database.yml +22 -0
- data/test/rails3/config/environment.rb +5 -0
- data/test/rails3/config/environments/development.rb +26 -0
- data/test/rails3/config/environments/test.rb +35 -0
- data/test/rails3/config/initializers/secret_token.rb +7 -0
- data/test/rails3/config/initializers/session_store.rb +8 -0
- data/test/rails3/config/locales/en.yml +5 -0
- data/test/rails3/config/routes.rb +62 -0
- data/test/rails3/config.ru +4 -0
- data/test/rails3/db/.gitkeep +0 -0
- data/test/rails3/db/migrate/20110212112626_create_posts.rb +14 -0
- data/test/rails3/db/migrate/20110212120554_create_users.rb +16 -0
- data/test/rails3/db/migrate/20110213220543_add_user_reference_to_post.rb +9 -0
- data/test/rails3/script/rails +6 -0
- data/test/rails3/test/factories/posts_factory.rb +4 -0
- data/test/rails3/test/factories/users_factory.rb +7 -0
- data/test/rails3/test/fixtures/posts.yml +9 -0
- data/test/rails3/test/fixtures/users.yml +1 -0
- data/test/rails3/test/functional/posts_controller_test.rb +57 -0
- data/test/rails3/test/functional/users_controller_test.rb +57 -0
- data/test/rails3/test/integration/ui_test.rb +26 -0
- data/test/rails3/test/performance/browsing_test.rb +9 -0
- data/test/rails3/test/test_helper.rb +13 -0
- data/test/rails3/test/unit/helpers/posts_helper_test.rb +4 -0
- data/test/rails3/test/unit/helpers/users_helper_test.rb +4 -0
- data/test/rails3/test/unit/post_test.rb +42 -0
- data/test/rails3/test/unit/user_test.rb +32 -0
- data/test/test_rails2_integration.rb +26 -0
- data/test/test_rails3_integration.rb +26 -0
- data/transactionata.gemspec +24 -0
- metadata +316 -0
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
# Full error reports are disabled and caching is turned on
|
|
8
|
+
config.action_controller.consider_all_requests_local = false
|
|
9
|
+
config.action_controller.perform_caching = true
|
|
10
|
+
config.action_view.cache_template_loading = true
|
|
11
|
+
|
|
12
|
+
# See everything in the log (default is :info)
|
|
13
|
+
# config.log_level = :debug
|
|
14
|
+
|
|
15
|
+
# Use a different logger for distributed setups
|
|
16
|
+
# config.logger = SyslogLogger.new
|
|
17
|
+
|
|
18
|
+
# Use a different cache store in production
|
|
19
|
+
# config.cache_store = :mem_cache_store
|
|
20
|
+
|
|
21
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
|
22
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
|
23
|
+
|
|
24
|
+
# Disable delivery errors, bad email addresses will be ignored
|
|
25
|
+
# config.action_mailer.raise_delivery_errors = false
|
|
26
|
+
|
|
27
|
+
# Enable threaded mode
|
|
28
|
+
# config.threadsafe!
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
config.action_view.cache_template_loading = true
|
|
16
|
+
|
|
17
|
+
# Disable request forgery protection in test environment
|
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
|
19
|
+
|
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
|
22
|
+
# ActionMailer::Base.deliveries array.
|
|
23
|
+
config.action_mailer.delivery_method = :test
|
|
24
|
+
|
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
27
|
+
# like if you have constraints or database-specific column types
|
|
28
|
+
# config.active_record.schema_format = :sql
|
|
@@ -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
|
+
ActionController::Base.cookie_verifier_secret = '4dffe0811802de53bd6ba93066511182617d57c896d6728d864bf473fe1731eb8858cb8788b8c65119a47dc6ca5d17feacad3182ca9a55aeb6cb1799052f5a55';
|
|
@@ -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,15 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
|
4
|
+
# If you change this key, all old sessions 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
|
+
ActionController::Base.session = {
|
|
8
|
+
:key => '_rails2_session',
|
|
9
|
+
:secret => 'bea65fe1561ce0ac1ec7e3524c6b5b9707e3bc6c32d803a7aa2da6cb7463c8f29e30f4517e827666c08277fa2183166bbc18f076a356d4b73d22b0c5dd68de8b'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
# Use the database for sessions instead of the cookie-based default,
|
|
13
|
+
# which shouldn't be used to store highly confidential information
|
|
14
|
+
# (create the session table with "rake db:sessions:create")
|
|
15
|
+
# ActionController::Base.session_store = :active_record_store
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require "rubygems"
|
|
3
|
+
require "bundler"
|
|
4
|
+
rescue LoadError
|
|
5
|
+
raise "Could not load the bundler gem. Install it with `gem install bundler`."
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
|
|
9
|
+
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
|
|
10
|
+
"Run `gem install bundler` to upgrade."
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
# Set up load paths for all bundled gems
|
|
15
|
+
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
|
|
16
|
+
Bundler.setup
|
|
17
|
+
rescue Bundler::GemNotFound
|
|
18
|
+
raise RuntimeError, "Bundler couldn't find some gems." +
|
|
19
|
+
"Did you run `bundle install`?"
|
|
20
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
|
2
|
+
map.resources :users
|
|
3
|
+
|
|
4
|
+
map.resources :posts
|
|
5
|
+
|
|
6
|
+
map.resources :users, :posts
|
|
7
|
+
|
|
8
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
|
9
|
+
|
|
10
|
+
# Sample of regular route:
|
|
11
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
|
12
|
+
# Keep in mind you can assign values other than :controller and :action
|
|
13
|
+
|
|
14
|
+
# Sample of named route:
|
|
15
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
|
16
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
|
17
|
+
|
|
18
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
|
19
|
+
# map.resources :products
|
|
20
|
+
|
|
21
|
+
# Sample resource route with options:
|
|
22
|
+
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
|
23
|
+
|
|
24
|
+
# Sample resource route with sub-resources:
|
|
25
|
+
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
|
26
|
+
|
|
27
|
+
# Sample resource route with more complex sub-resources
|
|
28
|
+
# map.resources :products do |products|
|
|
29
|
+
# products.resources :comments
|
|
30
|
+
# products.resources :sales, :collection => { :recent => :get }
|
|
31
|
+
# end
|
|
32
|
+
|
|
33
|
+
# Sample resource route within a namespace:
|
|
34
|
+
# map.namespace :admin do |admin|
|
|
35
|
+
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
|
36
|
+
# admin.resources :products
|
|
37
|
+
# end
|
|
38
|
+
|
|
39
|
+
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
|
40
|
+
# map.root :controller => "welcome"
|
|
41
|
+
|
|
42
|
+
# See how all your routes lay out with "rake routes"
|
|
43
|
+
|
|
44
|
+
# Install the default routes as the lowest priority.
|
|
45
|
+
# Note: These default routes make all actions in every controller accessible via GET requests. You should
|
|
46
|
+
# consider removing or commenting them out if you're using named routes and resources.
|
|
47
|
+
map.connect ':controller/:action/:id'
|
|
48
|
+
map.connect ':controller/:action/:id.:format'
|
|
49
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Empty fixtures, just here for table cleanup with transactionata
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class PostsControllerTest < ActionController::TestCase
|
|
4
|
+
test_data do
|
|
5
|
+
puts "Loading test data in #{self}"
|
|
6
|
+
15.times do
|
|
7
|
+
Factory.create(:post)
|
|
8
|
+
end
|
|
9
|
+
Factory.create(:post, :title => "Foobar")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def setup
|
|
13
|
+
@post = Post.find_by_title!('Foobar')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
test "should get index" do
|
|
17
|
+
get :index
|
|
18
|
+
assert_response :success
|
|
19
|
+
assert_not_nil assigns(:posts)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
test "should get new" do
|
|
23
|
+
get :new
|
|
24
|
+
assert_response :success
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
test "should create post" do
|
|
28
|
+
assert_difference('Post.count') do
|
|
29
|
+
post :create, :post => { }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
assert_redirected_to post_path(assigns(:post))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
test "should show post" do
|
|
36
|
+
get :show, :id => @post.to_param
|
|
37
|
+
assert_response :success
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
test "should get edit" do
|
|
41
|
+
get :edit, :id => @post.to_param
|
|
42
|
+
assert_response :success
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
test "should update post" do
|
|
46
|
+
put :update, :id => @post.to_param, :post => { }
|
|
47
|
+
assert_redirected_to post_path(assigns(:post))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
test "should destroy post" do
|
|
51
|
+
assert_difference('Post.count', -1) do
|
|
52
|
+
delete :destroy, :id => @post.to_param
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
assert_redirected_to posts_path
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class UsersControllerTest < ActionController::TestCase
|
|
4
|
+
test_data do
|
|
5
|
+
puts "Loading test data in #{self}"
|
|
6
|
+
Factory.create(:user, :login => 'colszowka')
|
|
7
|
+
8.times do
|
|
8
|
+
Factory.create(:user)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def setup
|
|
13
|
+
@user = User.find_by_login!('colszowka')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
test "should get index" do
|
|
17
|
+
get :index
|
|
18
|
+
assert_response :success
|
|
19
|
+
assert_equal 9, assigns(:users).count
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
test "should get new" do
|
|
23
|
+
get :new
|
|
24
|
+
assert_response :success
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
test "should create user" do
|
|
28
|
+
assert_difference('User.count') do
|
|
29
|
+
post :create, :user => { }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
assert_redirected_to user_path(assigns(:user))
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
test "should show user" do
|
|
36
|
+
get :show, :id => @user.to_param
|
|
37
|
+
assert_response :success
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
test "should get edit" do
|
|
41
|
+
get :edit, :id => @user.to_param
|
|
42
|
+
assert_response :success
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
test "should update user" do
|
|
46
|
+
put :update, :id => @user.to_param, :user => { }
|
|
47
|
+
assert_redirected_to user_path(assigns(:user))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
test "should destroy user" do
|
|
51
|
+
assert_difference('User.count', -1) do
|
|
52
|
+
delete :destroy, :id => @user.to_param
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
assert_redirected_to users_path
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class UiTest < ActionController::IntegrationTest
|
|
4
|
+
fixtures :all
|
|
5
|
+
|
|
6
|
+
test_data do
|
|
7
|
+
puts "Loading test data in #{self}"
|
|
8
|
+
user = Factory.create(:user, :login => 'testuser')
|
|
9
|
+
|
|
10
|
+
5.times do
|
|
11
|
+
Factory.create(:post, :user => user)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
test "GET /users" do
|
|
16
|
+
get "/users"
|
|
17
|
+
assert_response :success
|
|
18
|
+
assert_equal 1, assigns(:users).count
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
test "GET /posts" do
|
|
22
|
+
get '/posts'
|
|
23
|
+
assert_response :success
|
|
24
|
+
assert_equal 7, assigns(:posts).count # 5 for user, 2 from fixtures
|
|
25
|
+
end
|
|
26
|
+
end
|