01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
05: *
06: * The contents of this file are subject to the terms of either the GNU
07: * General Public License Version 2 only ("GPL") or the Common
08: * Development and Distribution License("CDDL") (collectively, the
09: * "License"). You may not use this file except in compliance with the
10: * License. You can obtain a copy of the License at
11: * http://www.netbeans.org/cddl-gplv2.html
12: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13: * specific language governing permissions and limitations under the
14: * License. When distributing the software, include this License Header
15: * Notice in each file and include the License file at
16: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17: * particular file as subject to the "Classpath" exception as provided
18: * by Sun in the GPL Version 2 section of the License file that
19: * accompanied this code. If applicable, add the following below the
20: * License Header, with the fields enclosed by brackets [] replaced by
21: * your own identifying information:
22: * "Portions Copyrighted [year] [name of copyright owner]"
23: *
24: * Contributor(s):
25: *
26: * Portions Copyrighted 2007 Sun Microsystems, Inc.
27: */
28: package org.netbeans.modules.ruby.hints;
29:
30: /**
31: * Test the rails deprecations test hint
32: *
33: * @author Tor Norbye
34: */
35: public class RailsDeprecationsTest extends HintTestBase {
36:
37: public RailsDeprecationsTest(String testName) {
38: super (testName);
39: }
40:
41: // // Not working yet
42: // public void testRegistered() throws Exception {
43: // ensureRegistered(new RailsDeprecations());
44: // }
45:
46: public void testInstanceField() throws Exception {
47: // Refers to @request
48: findHints(
49: this ,
50: new RailsDeprecations(),
51: "testfiles/projects/railsproj/app/controllers/foo_controller.rb",
52: null);
53: }
54:
55: public void testSkipNonRails() throws Exception {
56: // Shouldn't find deprecations in files that aren't in Rails projects
57: findHints(this , new RailsDeprecations(),
58: "testfiles/notrails.rb", null);
59: }
60:
61: public void testFinders() throws Exception {
62: // Shouldn't mistake Enumerations find_all methods for ActiveRecord ones
63: findHints(
64: this ,
65: new RailsDeprecations(),
66: "testfiles/projects/railsproj/app/controllers/findall.rb",
67: null);
68: }
69:
70: public void testRenderTemplate() throws Exception {
71: // Should identify render_template in non spec files
72: findHints(
73: this ,
74: new RailsDeprecations(),
75: "testfiles/projects/railsproj/app/controllers/rendertemplate.rb",
76: null);
77: }
78:
79: public void testRSpec() throws Exception {
80: // Shouldn't identify render_template in specs
81: findHints(
82: this ,
83: new RailsDeprecations(),
84: "testfiles/projects/railsproj/app/controllers/rendertemplate_spec.rb",
85: null);
86: }
87: }
|