Skip to content

Commit

Permalink
add rails 3.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Feb 20, 2012
1 parent 9197fb9 commit 8c22b36
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 33 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,7 @@ rvm:
gemfile:
- gemfiles/rails-3-2.gemfile
- gemfiles/rails-3-1.gemfile
- gemfiles/rails-3-0.gemfile
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
4 changes: 4 additions & 0 deletions Appraisals
Expand Up @@ -5,3 +5,7 @@ end
appraise 'rails-3-1' do
gem 'rails', '~> 3.1.0'
end

appraise 'rails-3-0' do
gem 'rails', '~> 3.0.0'
end
2 changes: 1 addition & 1 deletion focused_controller.gemspec
Expand Up @@ -18,7 +18,7 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]

s.add_dependency 'actionpack', '~> 3.1'
s.add_dependency 'actionpack', '~> 3.0'

s.add_development_dependency 'minitest', '~> 2.11.2'
s.add_development_dependency 'capybara', '~> 1.1.2'
Expand Down
7 changes: 7 additions & 0 deletions gemfiles/rails-3-0.gemfile
@@ -0,0 +1,7 @@
# This file was generated by Appraisal

source "http://rubygems.org"

gem "rails", "~> 3.0.0"

gemspec :path=>"../"
2 changes: 0 additions & 2 deletions test/app/app/controllers/application_controller.rb
@@ -1,5 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery

include FocusedController::Mixin
end
1 change: 0 additions & 1 deletion test/app/app/views/layouts/application.html.erb
Expand Up @@ -4,7 +4,6 @@
<title>App</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>

Expand Down
7 changes: 1 addition & 6 deletions test/app/config/application.rb
Expand Up @@ -3,12 +3,7 @@
require 'action_controller/railtie'
require 'rails/test_unit/railtie'

if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
Bundler.require

module App
class Application < Rails::Application
Expand Down
14 changes: 0 additions & 14 deletions test/app/config/initializers/wrap_parameters.rb

This file was deleted.

8 changes: 4 additions & 4 deletions test/app/spec/controllers/posts_controller_spec.rb
Expand Up @@ -31,28 +31,28 @@

describe PostsController::Show do
it "should show post" do
get :id => @post
get :id => @post.id
response.should be_success
end
end

describe PostsController::Edit do
it "should get edit" do
get :id => @post
get :id => @post.id
response.should be_success
end
end

describe PostsController::Update do
it "should update post" do
put :id => @post, :post => @post.attributes
put :id => @post.id, :post => @post.attributes
response.should redirect_to(post_path(subject.post))
end
end

describe PostsController::Destroy do
it "should destroy post" do
expect { delete :id => @post }.to change(Post, :count).by(-1)
expect { delete :id => @post.id }.to change(Post, :count).by(-1)
response.should redirect_to(posts_path)
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/app/test/functional/posts_controller_test.rb
Expand Up @@ -36,29 +36,29 @@ class CreateTest < TestCase

class ShowTest < TestCase
test "should show post" do
get :id => @post
get :id => @post.id
assert_response :success
end
end

class EditTest < TestCase
test "should get edit" do
get :id => @post
get :id => @post.id
assert_response :success
end
end

class UpdateTest < TestCase
test "should update post" do
put :id => @post, :post => @post.attributes
put :id => @post.id, :post => @post.attributes
assert_redirected_to post_path(@controller.post)
end
end

class DestroyTest < TestCase
test "should destroy post" do
assert_difference('Post.count', -1) do
delete :id => @post
delete :id => @post.id
end

assert_redirected_to posts_path
Expand Down
2 changes: 1 addition & 1 deletion test/helper.rb
Expand Up @@ -28,6 +28,6 @@ def self.root
end

def self.application
OpenStruct.new(:env_config => {})
OpenStruct.new(:env_config => {}, :env_defaults => {})
end
end

0 comments on commit 8c22b36

Please sign in to comment.