- identifiable_trace_file.stub :trace_name, "#{GPX_TRACE_DIR}/4.gpx" do
- visible = MiniTest::Mock.new
- visible.expect :find, identifiable_trace_file, [String]
- visible.expect :find, identifiable_trace_file, [String]
- visible.expect :find, identifiable_trace_file, [String]
- Trace.stub :visible, visible do
- # Authenticate as the owner of the trace we will be using
- basic_authorization(users(:public_user).display_name, "test")
-
- # First get the data as is
- get :api_data, :display_name => users(:public_user).display_name, :id => identifiable_trace_file.id
- check_trace_data identifiable_trace_file, "application/x-gzip", "gpx.gz"
-
- # Now ask explicitly for XML format
- get :api_data, :display_name => users(:public_user).display_name, :id => identifiable_trace_file.id, :format => "xml"
- check_trace_data identifiable_trace_file, "application/xml", "xml"
-
- # # Now ask explicitly for GPX format
- get :api_data, :display_name => users(:public_user).display_name, :id => identifiable_trace_file.id, :format => "gpx"
- check_trace_data identifiable_trace_file
- end
+ Trace.stub_any_instance :trace_name, "#{GPX_TRACE_DIR}/4.gpx" do
+ # Authenticate as the owner of the trace we will be using
+ basic_authorization(users(:public_user).display_name, "test")
+
+ # First get the data as is
+ get :api_data, :display_name => users(:public_user).display_name, :id => identifiable_trace_file.id
+ check_trace_data identifiable_trace_file, "application/x-gzip", "gpx.gz"
+
+ # Now ask explicitly for XML format
+ get :api_data, :display_name => users(:public_user).display_name, :id => identifiable_trace_file.id, :format => "xml"
+ check_trace_data identifiable_trace_file, "application/xml", "xml"
+
+ # # Now ask explicitly for GPX format
+ get :api_data, :display_name => users(:public_user).display_name, :id => identifiable_trace_file.id, :format => "gpx"
+ check_trace_data identifiable_trace_file