Sha256: 9e342e28f54d47f8a724274d96a1bd0558319e3e53f788edcf68d417e54c0351

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

## Testing the cookie is now notoriously difficult, and entirely undocumented for Rails 3.2:
## https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs/cookies
## CacheableFlash::TestHelpers is now integration tested in the controllers/dummy_controller_spec.rb
#
#require 'spec_helper'
#
#module CacheableFlash
#  describe TestHelpers do
#    attr_reader :controller, :request, :response, :flash, :cookies
#    include TestHelpers
#    before do
#      @controller = ActionController::Base.new
#      @request = ActionDispatch::TestRequest.new
#      @response = ActionDispatch::TestResponse.new
#      controller.send(:initialize_template_class, response)
#      controller.send(:assign_shortcuts, request, response)
#
#      @flash = controller.send(:flash)
#      class << controller
#        include CacheableFlash
#      end
#    end
#
#    describe "#flash_cookie" do
#      it "returns the flash hash send as a cookie" do
#        expected_flash = {
#        'errors' => "This is an Error",
#        'notice' => "This is a Notice"
#        }
#        flash['errors'] = expected_flash['errors']
#        flash['notice'] = expected_flash['notice']
#
#        controller.write_flash_to_cookie
#        @cookies = response.cookies # simulate setting the cookie instance variable in rails tests
#
#        flash_cookie.should == expected_flash
#      end
#    end
#  end
#end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cacheable_flash-1.0.0 spec/cacheable_flash/test_helpers_spec.rb
cacheable_flash-0.3.4 spec/cacheable_flash/test_helpers_spec.rb
cacheable_flash-0.3.3 spec/cacheable_flash/test_helpers_spec.rb
cacheable_flash-0.3.2 spec/cacheable_flash/test_helpers_spec.rb
cacheable_flash-0.3.1 spec/cacheable_flash/test_helpers_spec.rb
cacheable_flash-0.3.0 spec/cacheable_flash/test_helpers_spec.rb
cacheable_flash-0.2.10 spec/cacheable_flash/test_helpers_spec.rb
cacheable_flash-0.2.9 spec/cacheable_flash/test_helpers_spec.rb