Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a failing test case for the rails 4 test helper.

  • Loading branch information...
commit 378a5b2bd4b20c63adfd8ed8fa7cf8ed6247ba33 1 parent be088d9
@keithpitt keithpitt authored
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
4 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
View
27 spec/integration/rspec_spec.rb
@@ -0,0 +1,27 @@
+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
+
+ 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", :version => 1
+
+ response.should have_exposed(:echo => "ping")
+ end
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.