ssl_requirement /shoulda_macros/ssl_requirement_macros.rb

Language Ruby Lines 32
MD5 Hash fdf726c34e9765c71d7a73b47ac6c573
Repository https://github.com/amishyn/ssl_requirement.git View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Test::Unit::TestCase.class_eval do
  def self.without_ssl_context
    context "without ssl" do
      setup do
        @request.env['HTTPS'] = nil
      end

      context "" do
        yield
      end
    end
  end

  def self.with_ssl_context
    context "with ssl" do
      setup do
        @request.env['HTTPS'] = 'on'
      end
    
      context "" do
        yield
      end
    end
  end

  def self.should_redirect_to_ssl
    should 'redirect to ssl' do
      assert_redirected_to "https://" + @request.host + @request.request_uri
    end    
  end
end
Back to Top