Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: oakho/rocket_pants
base: 19fffa23d5
...
head fork: oakho/rocket_pants
compare: 08ed9c52ee
  • 5 commits
  • 5 files changed
  • 0 commit comments
  • 2 contributors
View
2  .travis.yml
@@ -15,7 +15,7 @@ env:
matrix:
exclude:
rvm: 1.8.7
- env: RAILS_VERSION="~>4.0.0.beta1"
+ env: 'RAILS_VERSION="~>4.0.0.beta1"'
notifications:
email:
- sutto@sutto.net
View
4 Gemfile
@@ -1,4 +1,4 @@
-source :rubygems
+source 'https://rubygems.org'
# Allow testing multiple versions with Travis.
rails_version = ENV['RAILS_VERSION']
@@ -23,4 +23,4 @@ end
gem 'active_model_serializers'
-gemspec
+gemspec
View
4 Rakefile
@@ -7,7 +7,7 @@ require 'bundler/gem_tasks'
desc "Run all specs in spec directory (excluding plugin specs)"
RSpec::Core::RakeTask.new(:spec)
-INTEGRATION_LIBS = %w(will_paginate kaminari active_record active_model_serializers)
+INTEGRATION_LIBS = %w(will_paginate kaminari active_record active_model_serializers rspec)
namespace :spec do
@@ -33,4 +33,4 @@ namespace :spec do
end
end
-task :default => ([:spec] + INTEGRATION_LIBS.map { |l| "spec:integration:#{l}" })
+task :default => ([:spec] + INTEGRATION_LIBS.map { |l| "spec:integration:#{l}" })
View
14 lib/rocket_pants/test_helper.rb
@@ -5,6 +5,8 @@ module TestHelper
extend ActiveSupport::Concern
included do
+ require 'action_controller/test_case'
+
# Extend the response on first include.
class_attribute :_default_version
unless ActionController::TestResponse < ResponseHelper
@@ -13,7 +15,7 @@ module TestHelper
end
module ResponseHelper
-
+
def recycle_cached_body!
@_parsed_body = @_decoded_body = nil
end
@@ -73,7 +75,15 @@ def have_decoded_response(value)
protected
# Like process, but automatically adds the api version.
- def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
+ def process(action, http_method = 'GET', *args)
+ # Rails 4 changes the method signature. In rails 3, http_method is actually
+ # the paramters.
+ if http_method.kind_of?(String)
+ parameters, session, flash = args
+ else
+ parameters = http_method
+ end
+
response.recycle_cached_body!
parameters ||= {}
if _default_version.present? && parameters[:version].blank? && parameters['version'].blank?
View
29 spec/integration/rspec_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe TestController, 'rspec integration', :integration => true, :target => 'rspec' do
+ # Hack to allow us to include the ActionController::TestCase::Behaviour module
+ def self.setup(*args); end
+ def self.teardown(*args); end
+
+ # Important to include behaviour before the RocketPants::TestHelpers
+ include ActionController::TestCase::Behavior
+ include RocketPants::TestHelper
+ include RocketPants::RSpecMatchers
+
+ default_version 1
+
+ before do
+ @routes = TestRouter
+ @controller = TestController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ describe 'should have_exposed' do
+ it "allows you to asset what should have been exposed by an action" do
+ get :echo, :echo => "ping"
+
+ response.should have_exposed(:echo => "ping")
+ end
+ end
+end

No commit comments for this range

Something went wrong with that request. Please try again.