Sha256: ddc9e95b0f2d17042dbf25cc95cb4cb60e05333673762272560f0a219215695e

Contents?: true

Size: 837 Bytes

Versions: 2

Compression:

Stored size: 837 Bytes

Contents

require 'test_helper'
require 'active_support/core_ext/class'

class PostsDataTest < Test::Unit::TestCase

  class SSLPoster
    include PostsData

    attr_accessor :logger
  end

  def setup
    @poster = SSLPoster.new
  end

  def test_logger_warns_if_ssl_strict_disabled
    @poster.logger = stub()
    @poster.logger.expects(:warn).with("PostsDataTest::SSLPoster using ssl_strict=false, which is insecure")

    Connection.any_instance.stubs(:request)

    SSLPoster.ssl_strict = false
    @poster.raw_ssl_request(:post, "https://shopify.com", "", {})
  end

  def test_logger_no_warning_if_ssl_strict_enabled
    @poster.logger = stub()
    @poster.logger.stubs(:warn).never
    Connection.any_instance.stubs(:request)

    SSLPoster.ssl_strict = true
    @poster.raw_ssl_request(:post, "https://shopify.com", "", {})
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_utils-1.0.5 test/unit/posts_data_test.rb
active_utils-1.0.4 test/unit/posts_data_test.rb