Skip to content

Commit 8173e8f

Browse files
committed
Added test.
1 parent d7cb38b commit 8173e8f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/annotate/annotate_routes_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ def mock_file(stubs={})
3232
AnnotateRoutes.do_annotations
3333
end
3434

35+
it 'should insert annotations if file does not contain annotations and ignore routes' do
36+
expect(File).to receive(:read).with(ROUTE_FILE).and_return("")
37+
expect(File).to receive(:open).with(ROUTE_FILE, 'wb').and_yield(mock_file)
38+
expect(@mock_file).to receive(:puts).with("\n# == Route Map\n#\n")
39+
expect(AnnotateRoutes).to receive(:puts).with(ANNOTATION_ADDED)
40+
41+
AnnotateRoutes.do_annotations(ignore_routes: 'my_route')
42+
end
43+
3544
it 'should skip annotations if file does already contain annotation' do
3645
expect(File).to receive(:read).with(ROUTE_FILE).and_return("\n# == Route Map\n#\n")
3746
expect(AnnotateRoutes).to receive(:puts).with(FILE_UNCHANGED)

0 commit comments

Comments
 (0)