You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map\(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# another good line\n# good line\n/)
50
+
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map\n#\n# another good line\n# good line\n/)
51
51
AnnotateRoutes.do_annotations
52
52
end
53
53
54
54
it"should not add a newline if there are empty lines"do
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map\(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# another good line\n# good line\n/)
56
+
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map\n#\n# another good line\n# good line\n/)
57
57
AnnotateRoutes.do_annotations
58
58
end
59
59
60
-
it"should not add a timestamp when :no-timestamp is passed"do
@mock_file.should_receive(:puts).with(/ActionController::Routing...\nfoo\n\n# == Route Map\(Updated \d{4}-\d{2}-\d{2} \d{2}:\d{2}\)\n#\n# another good line\n# good line\n/)
63
+
AnnotateRoutes.do_annotations:timestamp=>true
64
64
end
65
65
66
66
end
@@ -74,13 +74,13 @@ def mock_file(stubs={})
74
74
end
75
75
76
76
it"should remove trailing annotation and trim trailing newlines, but leave leading newlines alone"do
77
-
File.should_receive(:read).with("config/routes.rb").and_return("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nActionController::Routing...\nfoo\n\n\n\n\n\n\n\n\n\n\n# == Route Map (Updated 2012-08-16 00:00)\n#\n# another good line\n# good line\n")
77
+
File.should_receive(:read).with("config/routes.rb").and_return("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nActionController::Routing...\nfoo\n\n\n\n\n\n\n\n\n\n\n# == Route Map\n#\n# another good line\n# good line\n")
it"should remove prepended annotation and trim leading newlines, but leave trailing newlines alone"do
83
-
File.should_receive(:read).with("config/routes.rb").and_return("# == Route Map (Updated 2012-08-16 00:00)\n#\n# another good line\n# good line\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nActionController::Routing...\nfoo\n\n\n\n\n\n\n\n\n\n\n")
83
+
File.should_receive(:read).with("config/routes.rb").and_return("# == Route Map\n#\n# another good line\n# good line\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nActionController::Routing...\nfoo\n\n\n\n\n\n\n\n\n\n\n")
0 commit comments