Sha256: c70a5393e4ba2bbc85cde7568818afb1b1f5501ffedbe344dfb55f7b10893406

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module Spec
  module Helpers
    module FortitudeRailsHelpers
      def rails_server_project_root
        @rails_server_project_root ||= File.expand_path(File.join(File.dirname(__FILE__), '../..'))
      end

      def rails_server_gemfile_modifier
        Proc.new do |gemfile|
          gemfile.set_specs!('fortitude', :path => rails_server_project_root)
        end
      end

      def rails_server_default_version
        ENV['FORTITUDE_SPECS_RAILS_VERSION']
      end

      def rails_server_wraps_template_errors?
        !! (rails_server.actual_rails_version =~ /^5\./)
      end

      def expect_actionview_exception(subpath, class_name, message)
        actual_class_expected = if rails_server_wraps_template_errors?
          'ActionView::Template::Error'
        else
          class_name
        end

        hash = expect_exception(subpath, actual_class_expected, message)

        if rails_server_wraps_template_errors?
          cause = hash['exception']['cause']
          expect(cause).to be
          expect(cause['class']).to eq(class_name.to_s)
        end

        hash
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fortitude-0.9.6-java spec/helpers/fortitude_rails_helpers.rb
fortitude-0.9.6 spec/helpers/fortitude_rails_helpers.rb
fortitude-0.9.5-java spec/helpers/fortitude_rails_helpers.rb
fortitude-0.9.5 spec/helpers/fortitude_rails_helpers.rb