Browse files

test fixes

  • Loading branch information...
1 parent ee6aaf8 commit 0d62ade6e772311ad18afa232cfc9c1d979aea6e @bborn committed Oct 6, 2011
View
49 README.markdown
@@ -5,9 +5,6 @@ Information at: [http://www.communityengine.org](http://www.communityengine.org)
Requirements:
- RAILS VERSION 3.1.0 (lower versions are not supported)
- - For now, patched versions of: meta_search, authlogic, calendar_date_select, and omniauth
- - All other requirements are brought in automatically
- - Don't forget to include the gems you plan to include in your application
Getting CommunityEngine Running
--------------------------------
@@ -16,11 +13,6 @@ Getting CommunityEngine Running
gem 'community_engine', '2.0.0.beta', :git => 'https://github.com/bborn/communityengine.git', :branch => 'rails3'
- # Temporary edge sources for other libraries
- gem 'authlogic', :git => 'https://github.com/bborn/authlogic.git'
- gem 'calendar_date_select', :git => 'https://github.com/paneq/calendar_date_select.git', :branch => 'rails3test'
-
-
2. From your app's root directory run:
$ bundle install --binstubs
@@ -70,14 +62,12 @@ Photo Uploading
By default CommunityEngine uses the filesystem to store photos.
-To use Amazon S3 as the backend for your file uploads, you'll need the aws-s3 gem installed, and you'll need to add a file called `amazon_s3.yml` to the application's root config directory (examples are in `/community_engine/sample_files`).
+To use Amazon S3 as the backend for your file uploads,you'll need to add a file called `s3.yml` to the application's root config directory (examples are in `/community_engine/sample_files`).
You'll need to change your configuration in your `application.yml` to tell CommunityEngine to use s3 as the photo backend. For more, see the Paperclip documentation on S3 storage for uploads: https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/storage/s3.rb
Finally, you'll need an S3 account for S3 photo uploading.
-Create an s3.yml file in `Rails.root/config`
-
Roles
@@ -133,16 +123,45 @@ Akismet: Unfortunately, bots aren't the only ones submitting spam; humans do it
akismet_key: YOUR_KEY
+Integrating with Your Application & Overriding CE
+-------------------------------------------------
+
+To make a controller from your application use CE's layout and inherit CE's helper methods, make it inherit from `BaseController`. For example:
+
+ class RecipesController < BaseController
+
+ before_filter :login_required
+
+ uses_tiny_mce do
+ {:only => [:show], :options => configatron.default_mce_options}
+ end
+
+ end
+
+To override or modify a controller, helper, or model from CE, you can use the `require_from_ce` helper method. For example, to override a method in CE's `User` model, create `app/models/user.rb`:
+
+ class User < ActiveRecordBase
+ require_from_ce('models/user')
+
+ #add a new association
+ has_many :recipes
+
+ #override an existing method
+ def display_name
+ login.capitalize
+ end
+
+ end
+
+
+
+
Other notes
-----------
Any views you create in your app directory will override those in CommunityEngine
For example, you could create `Rails.root/app/views/layouts/application.html.haml` and have that include your own stylesheets, etc.
-You can also override CommunityEngine's controllers by creating identically-named controllers in your application's `app/controllers` directory.
-
-
-
Contributors - Thanks! :)
-------------------------
View
111 community_engine_setup_template.rb
@@ -1,111 +0,0 @@
-# Utility methods
-def say(message)
- puts " [CE SETUP] #{message} \n "
-end
-
-def checkout_ce_branch(branch)
- inside 'vendor/plugins/community_engine' do
- say "Checking out the #{branch} branch"
- run "git checkout --track -b #{branch} origin/#{branch}"
- end
-end
-
-def modify_environment_files
- in_root do
- say "Modifying your environment.rb and environments files to work with CE"
- sentinel = "require File.join(File.dirname(__FILE__), 'boot')"
- desert_require = "require 'desert'"
- gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
- "#{match}\n #{desert_require}\n"
- end
-
- ce_plugins_config = <<EOF
-config.plugins = [:community_engine, :white_list, :all]
-config.plugin_paths += ["\#{Rails.root}/vendor/plugins/community_engine/plugins"]
-EOF
- environment ce_plugins_config
-
- ce_boot_line = "\n require \"\#{Rails.root}/vendor/plugins/community_engine/config/boot.rb\""
- append_file 'config/environment.rb', ce_boot_line
-
- say "Modifying environment files ..."
- ['development', 'test'].each do |env|
- environment "\nconfigatron.app_host = \"http://localhost:3000\"", :env => env
- end
- configatron.app_host = ask("Please enter the url where you plan to deploy this app (use 'example.com' for now if you don't know yet):")
- environment "\nconfigatron.app_host = \"http://#{configatron.app_host}\"", :env => 'production'
- end
-end
-
-def add_application_yml(name)
- file("config/application.yml") do
- "community_name: #{name}"
- end
-end
-
-
-# CommunityEngine Setup
-ce_git_repo = "git://github.com/bborn/communityengine.git"
-app_name = ask("Please enter the application's name: ")
-
-# Delete unnecessary files
-run "rm public/index.html"
-
-# Set up git repository
-git :init
-git :add => '.'
-
-# Set up .gitignore files
- run "touch tmp/.gitignore log/.gitignore vendor/.gitignore"
- run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore}
- file '.gitignore', <<-END
-.DS_Store
-log/*.log
-tmp/**/*
-config/database.yml
-db/*.sqlite3
-END
-
-# Install all gems
-gem 'desert', :lib => 'desert'
-gem 'rmagick', :lib => 'RMagick'
-gem 'hpricot', :lib => 'hpricot'
-gem 'htmlentities', :lib => 'htmlentities'
-gem 'haml', :lib => 'haml'
-gem "aws-s3", :lib => "aws/s3"
-gem 'calendar_date_select'
-gem 'ri_cal'
-gem 'authlogic'
-gem 'searchlogic'
-gem 'rakismet'
-
-rake('gems:install', :sudo => true)
-
-
-plugin 'community_engine', :git => ce_git_repo, :submodule => true
-
-# Initialize submodules
-git :submodule => "init"
-git :submodule => "update"
-checkout_ce_branch('edge')
-
-# Add CE routes
-route "map.routes_from_plugin :community_engine"
-
-modify_environment_files
-add_application_yml(app_name)
-
-generate :plugin_migration
-
-rake('db:create:all')
-rake('db:migrate')
-
-capify!
-
-# Commit all work so far to the repository
-git :add => '.'
-git :commit => "-a -m 'Initial commit'"
-
-# Success!
-puts "SUCCESS!"
-puts "Next, you should probably run `rake test` and `rake community_engine:test` and make sure all tests pass. "
View
17 sample_files/amazon_s3.yml
@@ -1,17 +0,0 @@
-development:
- bucket_name: bucket
- access_key_id: 'KEY'
- secret_access_key: 'SECRET_KEY'
- use_persistent: true
-
-test:
- bucket_name: bucket
- access_key_id: 'KEY'
- secret_access_key: 'SECRET_KEY'
- use_persistent: false
-
-production:
- bucket_name: bucket
- access_key_id: 'KEY'
- secret_access_key: 'SECRET_KEY'
- use_persistent: false
View
21 sample_files/s3.yml
@@ -1,4 +1,17 @@
-aws_access_key: 'KEY'
-aws_secret_access_key: 'SECRET_KEY'
-options:
- use_ssl: true
+development:
+ bucket_name: bucket
+ access_key_id: 'KEY'
+ secret_access_key: 'SECRET_KEY'
+ use_persistent: true
+
+test:
+ bucket_name: bucket
+ access_key_id: 'KEY'
+ secret_access_key: 'SECRET_KEY'
+ use_persistent: false
+
+production:
+ bucket_name: bucket
+ access_key_id: 'KEY'
+ secret_access_key: 'SECRET_KEY'
+ use_persistent: false
View
6 test/functional/sessions_controller_test.rb
@@ -4,13 +4,13 @@ class SessionsControllerTest < ActionController::TestCase
fixtures :all
def test_should_login_and_redirect
- post :create, :login => 'quentin', :password => 'test'
+ post :create, :email => 'quentin@example.com', :password => 'test'
assert_equal users(:quentin), UserSession.find.record
assert_response :redirect
end
def test_should_fail_login_and_not_redirect
- post :create, :login => 'quentin', :password => 'bad password'
+ post :create, :email => 'quentin@example.com', :password => 'bad password'
assert_nil UserSession.find
assert_response :success
end
@@ -48,7 +48,7 @@ def test_should_login_with_reset_password
quentin.reset_password
newpass = quentin.password
quentin.save_without_session_maintenance
- post :create, :login => 'quentin', :password => newpass
+ post :create, :email => 'quentin@example.com', :password => newpass
assert_equal users(:quentin), UserSession.find.record
end
View
2 test/functional/users_controller_test.rb
@@ -342,7 +342,7 @@ def test_should_not_resend_activation_for_nonexistent_user
def test_assume_should_assume_users_id
login_as :admin
- post :assume, :id => users(:quentin).id
+ post :assume, :id => users(:quentin)
assert_response :redirect
assert_equal UserSession.find.record, users(:quentin)
assert_not_nil session[:admin_id]

0 comments on commit 0d62ade

Please sign in to comment.