File tree 2 files changed +25
-0
lines changed
lib/overcommit/hook/pre_commit
spec/overcommit/hook/pre_commit
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ def schema_files
46
46
47
47
def schema
48
48
@schema ||= schema_files . map { |file | File . read ( file ) } . join
49
+ @schema . tr ( '_' , '' )
49
50
end
50
51
51
52
def non_zero_schema_version?
Original file line number Diff line number Diff line change 94
94
it { should pass }
95
95
end
96
96
97
+ context 'when a Ruby schema file with the latest version in Rails 5.2 format and migrations are added' do
98
+ before do
99
+ subject . stub ( :applicable_files ) . and_return ( migration_files << ruby_schema_file )
100
+ end
101
+
102
+ around do |example |
103
+ repo do
104
+ FileUtils . mkdir_p ( 'db/migrate' )
105
+
106
+ File . open ( ruby_schema_file , 'w' ) { |f | f . write ( '2014_03_05_123456' ) }
107
+ `git add #{ ruby_schema_file } `
108
+
109
+ migration_files . each do |migration_file |
110
+ File . open ( migration_file , 'w' ) { |f | f . write ( 'migration' ) }
111
+ `git add #{ migration_file } `
112
+ end
113
+
114
+ example . run
115
+ end
116
+ end
117
+
118
+ it { should pass }
119
+ end
120
+
97
121
context 'when a Ruby schema file which is not at the latest version and migrations are added' do
98
122
before do
99
123
subject . stub ( :applicable_files ) . and_return ( migration_files << ruby_schema_file )
You can’t perform that action at this time.
0 commit comments