File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
spec/lib/code_ownership/private/ownership_mappers Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,43 @@ module CodeOwnership
214214 end
215215 end
216216
217+ context 'haml has annotation' do
218+ let ( :filename ) { 'app.my_file.html.haml' }
219+
220+ before do
221+ write_file ( filename , <<~CONTENTS )
222+ -# @team Foo
223+
224+ -# Some content
225+ CONTENTS
226+
227+ write_file ( 'package.yml' , <<~CONTENTS )
228+ enforce_dependency: true
229+ enforce_privacy: true
230+ CONTENTS
231+ end
232+
233+ it 'removes the annotation' do
234+ current_ownership = CodeOwnership . for_file ( filename )
235+ expect ( current_ownership &.name ) . to eq 'Foo'
236+ expect ( File . read ( filename ) ) . to eq <<~HAML
237+ -# @team Foo
238+
239+ -# Some content
240+ HAML
241+
242+ remove_file_annotation
243+
244+ new_ownership = CodeOwnership . for_file ( filename )
245+ expect ( new_ownership ) . to eq nil
246+ expected_output = <<~HAML
247+ -# Some content
248+ HAML
249+
250+ expect ( File . read ( filename ) ) . to eq expected_output
251+ end
252+ end
253+
217254 context 'file has new lines after the annotation' do
218255 let ( :filename ) { 'app/my_file.rb' }
219256
You can’t perform that action at this time.
0 commit comments