@@ -29,13 +29,13 @@ def handle_request(request); end
2929 setup do
3030 configuration = MCP ::Configuration . new
3131 configuration . instrumentation_callback = instrumentation_helper . callback
32-
32+
3333 @server = Server . new (
3434 name : "test_server" ,
3535 version : "1.0.0" ,
36- configuration : configuration
36+ configuration : configuration ,
3737 )
38-
38+
3939 @mock_transport = MockTransport . new ( @server )
4040 @server . transport = @mock_transport
4141 end
@@ -69,7 +69,7 @@ def handle_request(request); end
6969
7070 test "notification methods work without transport" do
7171 server_without_transport = Server . new ( name : "test_server" )
72-
72+
7373 # Should not raise any errors
7474 assert_nothing_raised do
7575 server_without_transport . notify_tools_list_changed
@@ -85,16 +85,16 @@ def send_notification(method, params = nil)
8585 raise StandardError , "Transport error"
8686 end
8787 end . new ( @server )
88-
88+
8989 @server . transport = error_transport
90-
90+
9191 # Mock the exception reporter
9292 expected_contexts = [
9393 { notification : "tools_list_changed" } ,
9494 { notification : "prompts_list_changed" } ,
95- { notification : "resources_list_changed" }
95+ { notification : "resources_list_changed" } ,
9696 ]
97-
97+
9898 call_count = 0
9999 @server . configuration . exception_reporter . expects ( :call ) . times ( 3 ) . with do |exception , context |
100100 assert_kind_of StandardError , exception
@@ -103,14 +103,14 @@ def send_notification(method, params = nil)
103103 call_count += 1
104104 true
105105 end
106-
106+
107107 # Should not raise errors to the caller
108108 assert_nothing_raised do
109109 @server . notify_tools_list_changed
110110 @server . notify_prompts_list_changed
111111 @server . notify_resources_list_changed
112112 end
113-
113+
114114 assert_equal 3 , call_count
115115 end
116116
@@ -120,7 +120,7 @@ def send_notification(method, params = nil)
120120 @server . notify_resources_list_changed
121121
122122 assert_equal 3 , @mock_transport . notifications . size
123-
123+
124124 notifications = @mock_transport . notifications
125125 assert_equal Methods ::NOTIFICATIONS_TOOLS_LIST_CHANGED , notifications [ 0 ] [ :method ]
126126 assert_equal Methods ::NOTIFICATIONS_PROMPTS_LIST_CHANGED , notifications [ 1 ] [ :method ]
@@ -133,4 +133,4 @@ def send_notification(method, params = nil)
133133 assert_equal "notifications/resources/list_changed" , Methods ::NOTIFICATIONS_RESOURCES_LIST_CHANGED
134134 end
135135 end
136- end
136+ end
0 commit comments