Created
October 22, 2015 14:14
-
-
Save diogob/8c7b00ab992bd217c429 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.dirname(File.expand_path(__FILE__)) + '/test_helper' | |
describe AttributeNormalizer do | |
let(:klass) do | |
Class.new do | |
include AttributeNormalizer | |
end | |
end | |
describe '.normalize_attributes' do | |
it 'should exist when included' do | |
expect(klass).to respond_to(:normalize_attributes) | |
end | |
end | |
describe '.normalize_attribute' do | |
it 'should exist when included' do | |
expect(klass).to respond_to(:normalize_attribute) | |
end | |
end | |
describe '.table_exists?' do | |
it 'should not fail due to database exceptions' do | |
class PGError < RuntimeError; end | |
Class.new(ActiveRecord::Base) do | |
def self.table_exists? | |
raise PGError, "FATAL: something bad happened trying to probe for table existence" | |
end | |
include AttributeNormalizer | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment