Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bborn committed Oct 6, 2011
1 parent ee6aaf8 commit 0d62ade
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 151 deletions.
49 changes: 34 additions & 15 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------------
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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! :)
-------------------------
Expand Down
111 changes: 0 additions & 111 deletions community_engine_setup_template.rb

This file was deleted.

17 changes: 0 additions & 17 deletions sample_files/amazon_s3.yml

This file was deleted.

21 changes: 17 additions & 4 deletions sample_files/s3.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions test/functional/sessions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/functional/users_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 0d62ade

Please sign in to comment.