ruby.project/test/unit/src/org/netbeans/modules/ruby/rubyproject/GotoTestTest.java
author enebo@netbeans.org
Wed, 23 Apr 2014 14:33:16 -0500
changeset 4560 3376c994679c
parent 4524 dd1c672c776b
permissions -rw-r--r--
Comment out failing rails stuff (I think not passing as non-1.8 runtime)
tor@110
     1
/*
phrebejk@559
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
tor@110
     3
 *
jglick@4116
     4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
jglick@4116
     5
 *
jglick@4116
     6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
jglick@4116
     7
 * Other names may be trademarks of their respective owners.
mkrauskopf@308
     8
 *
phrebejk@559
     9
 * The contents of this file are subject to the terms of either the GNU
phrebejk@559
    10
 * General Public License Version 2 only ("GPL") or the Common
phrebejk@559
    11
 * Development and Distribution License("CDDL") (collectively, the
phrebejk@559
    12
 * "License"). You may not use this file except in compliance with the
phrebejk@559
    13
 * License. You can obtain a copy of the License at
phrebejk@559
    14
 * http://www.netbeans.org/cddl-gplv2.html
phrebejk@559
    15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
phrebejk@559
    16
 * specific language governing permissions and limitations under the
phrebejk@559
    17
 * License.  When distributing the software, include this License Header
phrebejk@559
    18
 * Notice in each file and include the License file at
jglick@4116
    19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
phrebejk@559
    20
 * particular file as subject to the "Classpath" exception as provided
jglick@4116
    21
 * by Oracle in the GPL Version 2 section of the License file that
phrebejk@559
    22
 * accompanied this code. If applicable, add the following below the
phrebejk@559
    23
 * License Header, with the fields enclosed by brackets [] replaced by
phrebejk@559
    24
 * your own identifying information:
mkrauskopf@308
    25
 * "Portions Copyrighted [year] [name of copyright owner]"
mkrauskopf@308
    26
 *
phrebejk@559
    27
 * Contributor(s):
phrebejk@559
    28
 *
mkrauskopf@308
    29
 * The Original Software is NetBeans. The Initial Developer of the Original
mkrauskopf@1356
    30
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
mkrauskopf@308
    31
 * Microsystems, Inc. All Rights Reserved.
phrebejk@559
    32
 *
phrebejk@559
    33
 * If you wish your version of this file to be governed by only the CDDL
phrebejk@559
    34
 * or only the GPL Version 2, indicate your decision by adding
phrebejk@559
    35
 * "[Contributor] elects to include this software in this distribution
phrebejk@559
    36
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
phrebejk@559
    37
 * single choice of license, a recipient has the option to distribute
phrebejk@559
    38
 * your version of this file under either the CDDL, the GPL Version 2 or
phrebejk@559
    39
 * to extend the choice of license to its licensees as provided above.
phrebejk@559
    40
 * However, if you add GPL Version 2 code and therefore, elected the GPL
phrebejk@559
    41
 * Version 2 license, then the option applies only if the new code is
phrebejk@559
    42
 * made subject to such option by the copyright holder.
tor@110
    43
 */
tor@110
    44
tor@110
    45
package org.netbeans.modules.ruby.rubyproject;
tor@110
    46
tor@110
    47
import java.io.File;
mkrauskopf@3061
    48
import org.netbeans.modules.csl.api.DeclarationFinder.DeclarationLocation;
tor@629
    49
import org.netbeans.spi.gototest.TestLocator;
tor@673
    50
import org.netbeans.spi.gototest.TestLocator.LocationResult;
tor@110
    51
import org.openide.filesystems.FileObject;
tor@110
    52
import org.openide.filesystems.FileUtil;
tor@110
    53
tor@110
    54
/**
tor@110
    55
 * @author Tor Norbye
tor@110
    56
 */
tor@110
    57
public class GotoTestTest extends RubyProjectTestBase {
tor@110
    58
    
tor@110
    59
    private RubyProject project;
tor@110
    60
    private GotoTest gotoTest;
tor@110
    61
    
tor@110
    62
    public GotoTestTest(String testName) {
tor@110
    63
        super(testName);
tor@110
    64
    }
tor@110
    65
tor@110
    66
    @Override
tor@110
    67
    protected void setUp() throws Exception {
tor@110
    68
        super.setUp();
tor@110
    69
        
tor@110
    70
        project = createTestProject("GotoTest");
tor@110
    71
        assertNotNull(project);
tor@110
    72
        FileObject dir = project.getProjectDirectory();
tor@110
    73
        assertNotNull(dir);
tor@110
    74
        createFilesFromDesc(dir, "testfiles/gototestfiles");
tor@110
    75
        
tor@115
    76
        // Create some data files where the class -contents- are used to locate the test
tor@115
    77
        createFile(dir, "lib/hello.rb", "class Hello\ndef foo\nend\nend\n");
tor@115
    78
        createFile(dir, "test/world.rb", "class HelloTest\ndef foobar\nend\nend\n");
tor@803
    79
tor@803
    80
        createFile(dir, "whatever/donkey.rb", "#foo");
tor@803
    81
        createFile(dir, "whatever/donkey_spec.rb", "#foo");
tor@115
    82
        
mkrauskopf@2372
    83
        touch(dir, "app/controllers/donkey_controller.rb");
mkrauskopf@2372
    84
        touch(dir, "spec/controllers/donkey_controller_spec.rb");
mkrauskopf@2372
    85
        touch(dir, "test/functional/donkey_controller_test.rb");
mkrauskopf@2372
    86
        
tor@110
    87
        gotoTest = new GotoTest();
tor@110
    88
    }
tor@110
    89
    
tor@110
    90
    private FileObject getProjFile(String file) {
tor@110
    91
        return project.getProjectDirectory().getFileObject(file);
tor@110
    92
    }
tor@110
    93
    
mkrauskopf@1356
    94
    private void assertIsProjFile(String expectedRelPath, FileObject actualFO) {
mkrauskopf@1356
    95
        String relative = getRelative(actualFO);
tor@110
    96
        
mkrauskopf@1356
    97
        // slashify to the same format, so tests pass on all OSes
mkrauskopf@1356
    98
        relative = relative.replace(File.separatorChar, '/');
mkrauskopf@1356
    99
        expectedRelPath = expectedRelPath.replace(File.separatorChar, '/');
mkrauskopf@1356
   100
        
mkrauskopf@1356
   101
        assertEquals(expectedRelPath + " is a project file", relative, expectedRelPath);
tor@110
   102
    }
tor@110
   103
tor@110
   104
    private String getRelative(FileObject fo) {
tor@110
   105
        assertNotNull(fo);
tor@110
   106
        File path = FileUtil.toFile(fo);
tor@110
   107
        File projPath = FileUtil.toFile(project.getProjectDirectory());
tor@110
   108
        String relative = path.getAbsolutePath().substring(projPath.getAbsolutePath().length()+1);
tor@110
   109
        
tor@110
   110
        return relative;
tor@110
   111
    }
tor@110
   112
    
tor@110
   113
    public void testGotoTestUnit() {
tor@110
   114
        assertNotNull(project);
tor@110
   115
        
tor@110
   116
        DeclarationLocation loc = gotoTest.findTest(getProjFile("lib/foo.rb"), -1);
tor@110
   117
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   118
        assertIsProjFile("test/test_foo.rb", loc.getFileObject());
tor@110
   119
    }
tor@110
   120
tor@110
   121
    public void testGotoTestUnit2() {
tor@110
   122
        assertNotNull(project);
tor@110
   123
        
tor@110
   124
        DeclarationLocation loc = gotoTest.findTest(getProjFile("lib/bar.rb"), -1);
tor@110
   125
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   126
        assertIsProjFile("test/tc_bar.rb", loc.getFileObject());
tor@110
   127
    }
tor@646
   128
    
tor@646
   129
    public void testGotoTestUnit3() {
tor@646
   130
        assertNotNull(project);
tor@646
   131
        
tor@646
   132
        DeclarationLocation loc = gotoTest.findTest(getProjFile("lib/main.rb"), -1);
tor@646
   133
        assertNotSame(DeclarationLocation.NONE, loc);
tor@646
   134
        assertIsProjFile("test/main_test.rb", loc.getFileObject());
tor@646
   135
        assertEquals(-1, loc.getOffset());
tor@646
   136
    }
tor@110
   137
tor@110
   138
    // The ZenTest patterns are only checked if the ZenTest gem is installed
tor@110
   139
    //public void testGotoTestZenTest() {
tor@110
   140
    //    assertNotNull(project);
tor@110
   141
    //
tor@110
   142
    //    DeclarationLocation loc = gotoTest.findTest(getProjFile("app/controllers/my_controller.rb"), -1);
tor@110
   143
    //    assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   144
    //    assertIsProjFile("test/controllers/my_controller_test.rb", loc.getFileObject());
tor@110
   145
    //}
tor@110
   146
enebo@4560
   147
    /*
tor@110
   148
    public void testGotoTestRspec() {
tor@110
   149
        assertNotNull(project);
tor@110
   150
        
tor@110
   151
        DeclarationLocation loc = gotoTest.findTest(getProjFile("app/models/whatever.rb"), -1);
tor@110
   152
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   153
        assertIsProjFile("spec/models/whatever_spec.rb", loc.getFileObject());
tor@317
   154
        assertEquals(-1, loc.getOffset());
enebo@4560
   155
    }*/
tor@110
   156
emononen@1454
   157
    public void testGotoTestRspecRubyProject() {
emononen@1454
   158
        assertNotNull(project);
emononen@1454
   159
        
emononen@1454
   160
        DeclarationLocation loc = gotoTest.findTest(getProjFile("lib/gibbon.rb"), -1);
emononen@1454
   161
        assertNotSame(DeclarationLocation.NONE, loc);
emononen@1454
   162
        assertIsProjFile("spec/gibbon_spec.rb", loc.getFileObject());
emononen@1454
   163
        assertEquals(-1, loc.getOffset());
emononen@1454
   164
    }
emononen@1454
   165
tor@110
   166
    public void testGotoTestRails() {
tor@110
   167
        assertNotNull(project);
tor@110
   168
        
tor@110
   169
        DeclarationLocation loc = gotoTest.findTest(getProjFile("app/models/mymodel.rb"), -1);
tor@110
   170
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   171
        assertIsProjFile("test/unit/mymodel_test.rb", loc.getFileObject());
tor@317
   172
        assertEquals(-1, loc.getOffset());
tor@110
   173
    }
tor@110
   174
    
tor@110
   175
    public void testEnsureDirection1() {
tor@110
   176
        // Make sure that looking for a test when we're in a test doesn't return the opposite
tor@110
   177
        // file
tor@110
   178
        assertNotNull(project);
tor@110
   179
        DeclarationLocation loc = gotoTest.findTest(getProjFile("test/test_foo.rb"), -1);
tor@110
   180
        assertSame(DeclarationLocation.NONE, loc);
tor@110
   181
    }
tor@110
   182
tor@110
   183
    public void testEnsureDirection2() {
tor@110
   184
        assertNotNull(project);
tor@110
   185
        DeclarationLocation loc = gotoTest.findTested(getProjFile("lib/foo.rb"), -1);
tor@110
   186
        assertSame(DeclarationLocation.NONE, loc);
tor@110
   187
    }
tor@110
   188
tor@110
   189
    public void testGotoTestedUnit() {
tor@110
   190
        assertNotNull(project);
tor@110
   191
        
tor@110
   192
        DeclarationLocation loc = gotoTest.findTested(getProjFile("test/test_foo.rb"), -1);
tor@110
   193
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   194
        assertIsProjFile("lib/foo.rb", loc.getFileObject());
tor@317
   195
        assertEquals(-1, loc.getOffset());
tor@110
   196
    }
tor@110
   197
tor@110
   198
    public void testGotoTestedUnit2() {
tor@110
   199
        assertNotNull(project);
tor@110
   200
        
tor@110
   201
        DeclarationLocation loc = gotoTest.findTested(getProjFile("test/tc_bar.rb"), -1);
tor@110
   202
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   203
        assertIsProjFile("lib/bar.rb", loc.getFileObject());
tor@317
   204
        assertEquals(-1, loc.getOffset());
tor@110
   205
    }
tor@110
   206
tor@110
   207
    // The ZenTest patterns are only checked if the ZenTest gem is installed
tor@110
   208
    //public void testGotoTestedZenTest() {
tor@110
   209
    //    assertNotNull(project);
tor@110
   210
    //
tor@110
   211
    //    DeclarationLocation loc = gotoTest.findTested(getProjFile("test/controllers/my_controller_test.rb"), -1);
tor@110
   212
    //    assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   213
    //    assertIsProjFile("app/controllers/my_controller.rb", loc.getFileObject());
tor@110
   214
    //}
tor@110
   215
enebo@4560
   216
    /*
tor@110
   217
    public void testGotoTestedRspec() {
tor@110
   218
        assertNotNull(project);
tor@110
   219
        
tor@110
   220
        DeclarationLocation loc = gotoTest.findTested(getProjFile("spec/models/whatever_spec.rb"), -1);
tor@110
   221
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   222
        assertIsProjFile("app/models/whatever.rb", loc.getFileObject());
tor@317
   223
        assertEquals(-1, loc.getOffset());
enebo@4560
   224
    }*/
tor@110
   225
tor@110
   226
    public void testGotoTestedRails() {
tor@110
   227
        assertNotNull(project);
tor@110
   228
        
tor@110
   229
        DeclarationLocation loc = gotoTest.findTested(getProjFile("test/unit/mymodel_test.rb"), -1);
tor@110
   230
        assertNotSame(DeclarationLocation.NONE, loc);
tor@110
   231
        assertIsProjFile("app/models/mymodel.rb", loc.getFileObject());
tor@317
   232
        assertEquals(-1, loc.getOffset());
tor@110
   233
    }
tor@110
   234
tor@115
   235
    // The code index doesn't yet work at test time so the index search for HelloTest won't work
tor@115
   236
    //public void testGotoTestedClass() {
tor@115
   237
    //    assertNotNull(project);
tor@115
   238
    //
tor@115
   239
    //    DeclarationLocation loc = gotoTest.findTested(getProjFile("lib/hello.rb"), -1);
tor@115
   240
    //    assertNotSame(DeclarationLocation.NONE, loc);
tor@115
   241
    //    assertIsProjFile("test/world.rb", loc.getFileObject());
tor@115
   242
    //}
tor@110
   243
mkrauskopf@1356
   244
    private final static String[] FILES = {
tor@110
   245
        "lib/foo.rb",
tor@110
   246
        "test/test_foo.rb",
tor@110
   247
        
tor@110
   248
        "lib/bar.rb",
tor@110
   249
        "test/tc_bar.rb",
tor@110
   250
        
tor@110
   251
        //"app/controllers/my_controller.rb",
tor@110
   252
        //"test/controllers/my_controller_test.rb",
tor@110
   253
        
tor@110
   254
        "app/models/whatever.rb",
tor@110
   255
        "spec/models/whatever_spec.rb",
tor@110
   256
        
tor@110
   257
        "app/models/mymodel.rb",
tor@110
   258
        "test/unit/mymodel_test.rb"
tor@110
   259
    };
enebo@4560
   260
enebo@4560
   261
    /*
tor@110
   262
    public void testFindOpposite() {
tor@110
   263
        int index = 0;
tor@115
   264
        for (; index < FILES.length; index += 2) {
tor@115
   265
            FileObject source = getProjFile(FILES[index]);
tor@115
   266
            FileObject test = getProjFile(FILES[index+1]);
tor@110
   267
            
tor@110
   268
            DeclarationLocation loc = gotoTest.findTest(source, -1);
tor@110
   269
            assertEquals(test, loc.getFileObject());
tor@110
   270
tor@110
   271
            loc = gotoTest.findTested(test, -1);
tor@110
   272
            assertEquals(source, loc.getFileObject());
tor@110
   273
            
tor@629
   274
            TestLocator.LocationResult res = gotoTest.findOpposite(test, -1);
tor@629
   275
            assertEquals(source, res.getFileObject());
tor@629
   276
            assertEquals(-1, res.getOffset());
tor@629
   277
            res = gotoTest.findOpposite(source, -1);
tor@629
   278
            assertEquals(test, res.getFileObject());
tor@629
   279
            assertEquals(-1, res.getOffset());
tor@110
   280
        }
tor@110
   281
    }
enebo@4560
   282
tor@261
   283
    public void testGoto112812() {
tor@261
   284
        assertNotNull(project);
tor@261
   285
        
tor@261
   286
        DeclarationLocation loc = gotoTest.findTest(getProjFile("app/views/user/create.mab"), -1);
tor@261
   287
        assertNotSame(DeclarationLocation.NONE, loc);
tor@261
   288
        assertIsProjFile("spec/views/user/create_spec.rb", loc.getFileObject());
tor@317
   289
        assertEquals(-1, loc.getOffset());
tor@261
   290
    }
tor@261
   291
tor@261
   292
    public void testGoto112812b() {
tor@261
   293
        assertNotNull(project);
tor@261
   294
        
tor@261
   295
        DeclarationLocation loc = gotoTest.findTest(getProjFile("app/views/user/_partial.mab"), -1);
tor@261
   296
        assertNotSame(DeclarationLocation.NONE, loc);
tor@261
   297
        assertIsProjFile("spec/views/user/_partial_spec.rb", loc.getFileObject());
tor@317
   298
        assertEquals(-1, loc.getOffset());
tor@261
   299
    }
tor@261
   300
tor@261
   301
    public void testGoto112812c() {
tor@261
   302
        assertNotNull(project);
tor@261
   303
        
tor@261
   304
        DeclarationLocation loc = gotoTest.findTested(getProjFile("spec/views/user/create_spec.rb"), -1);
tor@261
   305
        assertNotSame(DeclarationLocation.NONE, loc);
tor@261
   306
        assertIsProjFile("app/views/user/create.mab", loc.getFileObject());
tor@317
   307
        assertEquals(-1, loc.getOffset());
tor@261
   308
    }
tor@261
   309
tor@261
   310
    public void testGoto112812d() {
tor@261
   311
        assertNotNull(project);
tor@261
   312
        
tor@261
   313
        DeclarationLocation loc = gotoTest.findTested(getProjFile("spec/views/user/_partial_spec.rb"), -1);
tor@261
   314
        assertNotSame(DeclarationLocation.NONE, loc);
tor@261
   315
        assertIsProjFile("app/views/user/_partial.mab", loc.getFileObject());
tor@317
   316
        assertEquals(-1, loc.getOffset());
tor@261
   317
    }
tor@261
   318
tor@261
   319
    public void testNegative() {
tor@261
   320
        assertNotNull(project);
tor@261
   321
        
tor@261
   322
        DeclarationLocation loc = gotoTest.findTest(getProjFile("app/controllers/lonely_controller.rb"), -1);
tor@261
   323
        assertSame(DeclarationLocation.NONE, loc);
tor@317
   324
        assertEquals(-1, loc.getOffset());
tor@261
   325
    }
enebo@4560
   326
    */
tor@261
   327
tor@261
   328
    public void testNegative2() {
tor@261
   329
        assertNotNull(project);
tor@261
   330
        
tor@261
   331
        DeclarationLocation loc = gotoTest.findTest(getProjFile("test/unit/lonesometest.rb"), -1);
tor@261
   332
        assertSame(DeclarationLocation.NONE, loc);
tor@317
   333
        assertEquals(-1, loc.getOffset());
tor@261
   334
    }
tor@261
   335
tor@261
   336
    public void testNegative3() {
tor@261
   337
        assertNotNull(project);
tor@261
   338
        
tor@261
   339
        DeclarationLocation loc = gotoTest.findTested(getProjFile("app/controllers/lonely_controller.rb"), -1);
tor@261
   340
        assertSame(DeclarationLocation.NONE, loc);
tor@261
   341
    }
tor@673
   342
    
tor@673
   343
    public void testGoto119106a() {
tor@673
   344
        assertNotNull(project);
tor@673
   345
        
tor@673
   346
        DeclarationLocation loc = gotoTest.findTest(getProjFile("app/models/rest_phone/phone_call.rb"), -1);
tor@673
   347
        assertNotSame(DeclarationLocation.NONE, loc);
tor@673
   348
        assertIsProjFile("test/unit/rest_phone/phone_call_test.rb", loc.getFileObject());
tor@673
   349
        assertEquals(-1, loc.getOffset());
tor@673
   350
    }
tor@673
   351
tor@673
   352
    public void testGoto119106b() {
tor@673
   353
        assertNotNull(project);
tor@673
   354
        LocationResult loc = gotoTest.findOpposite(getProjFile("test/unit/rest_phone/phone_call_test.rb"), -1);
tor@673
   355
        assertNotSame(DeclarationLocation.NONE, loc);
tor@673
   356
        assertIsProjFile("app/models/rest_phone/phone_call.rb", loc.getFileObject());
tor@673
   357
        assertEquals(-1, loc.getOffset());
tor@673
   358
    }
tor@682
   359
tor@723
   360
    public void testGoto119106c() {
tor@723
   361
        assertNotNull(project);
tor@723
   362
        DeclarationLocation loc = gotoTest.findTest(getProjFile("test/unit/rest_phone/phone_call_test.rb"), -1);
tor@723
   363
        assertSame(DeclarationLocation.NONE, loc);
tor@723
   364
    }
enebo@4560
   365
enebo@4560
   366
    /*
emononen@3680
   367
    public void testGoto16588a() {
emononen@3680
   368
        assertNotNull(project);
emononen@3680
   369
        DeclarationLocation loc = gotoTest.findTest(getProjFile("lib/widget.rb"), -1);
emononen@3680
   370
        assertNotSame(DeclarationLocation.NONE, loc);
emononen@3680
   371
        assertIsProjFile("spec/lib/widget_spec.rb", loc.getFileObject());
emononen@3680
   372
    }
emononen@3680
   373
emononen@3680
   374
    public void testGoto16588b() {
emononen@3680
   375
        assertNotNull(project);
emononen@3680
   376
        DeclarationLocation loc = gotoTest.findTested(getProjFile("spec/lib/widget_spec.rb"), -1);
emononen@3680
   377
        assertNotSame(DeclarationLocation.NONE, loc);
emononen@3680
   378
        assertIsProjFile("lib/widget.rb", loc.getFileObject());
emononen@3680
   379
    }
emononen@3680
   380
emononen@3680
   381
    public void testGoto16588c() {
emononen@3680
   382
        assertNotNull(project);
emononen@3680
   383
        DeclarationLocation loc = gotoTest.findTest(getProjFile("lib/gadget.rb"), -1);
emononen@3680
   384
        assertNotSame(DeclarationLocation.NONE, loc);
emononen@3680
   385
        assertIsProjFile("test/lib/test_gadget.rb", loc.getFileObject());
emononen@3680
   386
    }
emononen@3680
   387
tor@803
   388
    public void testRSpecSingle() {
tor@803
   389
        assertNotNull(project);
tor@803
   390
        
tor@803
   391
        FileObject f = getProjFile("whatever/donkey_spec.rb");
tor@803
   392
        assertNotNull(f);
tor@803
   393
        DeclarationLocation loc = gotoTest.findTested(f, -1);
tor@803
   394
        assertNotSame(DeclarationLocation.NONE, loc);
tor@803
   395
        assertIsProjFile("whatever/donkey.rb", loc.getFileObject());
tor@803
   396
        assertEquals(-1, loc.getOffset());
tor@803
   397
    }
tor@803
   398
tor@803
   399
    public void testRSpecSingle2() {
tor@803
   400
        assertNotNull(project);
mkrauskopf@2372
   401
tor@803
   402
        FileObject f = getProjFile("whatever/donkey.rb");
tor@803
   403
        assertNotNull(f);
tor@803
   404
        DeclarationLocation loc = gotoTest.findTest(f, -1);
tor@803
   405
        assertNotSame(DeclarationLocation.NONE, loc);
tor@803
   406
        assertIsProjFile("whatever/donkey_spec.rb", loc.getFileObject());
tor@803
   407
        assertEquals(-1, loc.getOffset());
enebo@4560
   408
    }*/
mkrauskopf@2372
   409
mkrauskopf@2372
   410
    public void testRSpecVsTest() {
mkrauskopf@2372
   411
        assertNotNull(project);
mkrauskopf@2372
   412
mkrauskopf@2372
   413
        FileObject f = getProjFile("app/controllers/donkey_controller.rb");
mkrauskopf@2372
   414
        assertNotNull(f);
mkrauskopf@2372
   415
        DeclarationLocation loc = gotoTest.findTest(f, -1);
mkrauskopf@2372
   416
        assertNotSame(DeclarationLocation.NONE, loc);
mkrauskopf@2372
   417
        assertIsProjFile("test/functional/donkey_controller_test.rb", loc.getFileObject());
mkrauskopf@2372
   418
        assertEquals(-1, loc.getOffset());
mkrauskopf@2372
   419
    }
tor@110
   420
}