Sha256: f4752048fd78a88f9cdc8bb145164f41d60ca90a0b1d1b50d74b40513894bc87

Contents?: true

Size: 1022 Bytes

Versions: 2

Compression:

Stored size: 1022 Bytes

Contents

require_relative '../../lib/stockor'
require 'lanes/spec_helper'

class Lanes::TestCase
    include Skr
end

module Skr

    # Add more helper methods to be used by all tests here...

    class TestCase < Lanes::TestCase
        include Skr
    end

    class ApiTestCase < Lanes::ApiTestCase
        include Skr
    end

end

module StockorFixtureTestPatches
    extend ActiveSupport::Concern

    included do
        alias_method_chain :table_rows, :custom_autoset_stockor_fields
    end

    def table_rows_with_custom_autoset_stockor_fields
        results = table_rows_without_custom_autoset_stockor_fields
        if model_class && model_class < ActiveRecord::Base
            results[ table_name ].each do | row |
                if self['hash_code'].blank? && model_class.column_names.include?('hash_code')
                    row['hash_code'] = Lanes::Strings.random(8)
                end
            end
        end
        results
    end
end

ActiveRecord::FixtureSet.send :include, StockorFixtureTestPatches

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stockor-0.1.9 spec/server/spec_helper.rb
stockor-0.1.8 spec/server/spec_helper.rb