Sha256: aead815dd290bdda9f0227b2d43d29e7f21549ea69fa2917a68fe57fcb1065cf

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

require 'action_view'
require 'action_view/template'
require 'action_controller'
require 'active_model'
require 'action_controller'
require 'active_support/core_ext'

require 'coveralls'
Coveralls.wear! do
  add_filter "/spec/"
end

require 'signed_form'

module SignedFormViewHelper
  include ActionView::Helpers

  if defined?(ActionView::RecordIdentifier)
    include ActionView::RecordIdentifier
  elsif defined?(ActionController::RecordIdentifier)
    include ActionController::RecordIdentifier
  end

  include ActionView::Context if defined?(ActionView::Context)
  include SignedForm::ActionView::FormHelper

  def self.included(base)
    base.class_eval do
      attr_accessor :output_buffer
    end
  end

  def protect_against_forgery?
    false
  end

  def user_path(*)
    '/users'
  end

  def polymorphic_path(*)
    '/users'
  end

  def _routes(*)
    double('routes', url_for: '')
  end

  def controller(*)
    double('controller')
  end

  def default_url_options
    {}
  end

  def get_data_from_form(content)
    Marshal.load Base64.strict_decode64(content.match(/name="form_signature" value="(.*)--/)[1])
  end
end

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true

  config.filter_run_excluding action_pack: ->(version) { ActionPack::VERSION::STRING.match(/\d+\.\d+/)[0] !~ version }

  config.order = 'random'

  config.around(:each) do |example|
    pristine_module = SignedForm.dup
    example.run
    Object.send :remove_const, :SignedForm
    SignedForm = pristine_module
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signed_form-0.2.0 spec/spec_helper.rb