protected Dependency getMainGemspecDependency(Dependency dependency1, Dependency dependency2) {
        if (dependency1 != null && dependency2 != null
                && Ecosystem.RUBY.equals(dependency1.getEcosystem())
                && Ecosystem.RUBY.equals(dependency2.getEcosystem())
                && isSameRubyGem(dependency1, dependency2)) {
            final File lFile = dependency1.getActualFile();
            final File left = lFile.getParentFile();
            if (left != null && left.getName().equalsIgnoreCase("specifications")) {
                return dependency1;
            }
            return dependency2;
        }
        return null;
    }
@Test
    public void testGetMainGemspecDependency() {
        Dependency dependency1 = null;
        Dependency dependency2 = null;
        DependencyMergingAnalyzer instance = new DependencyMergingAnalyzer();
        Dependency expResult = null;
        Dependency result = instance.getMainGemspecDependency(dependency1, dependency2);
        assertEquals(expResult, result);

        dependency1 = new Dependency(new File("specifications/some.gemspec"), true);
        dependency1.setPackagePath("path");
        dependency1.setEcosystem(Ecosystem.RUBY);
        dependency2 = new Dependency(new File("another.gemspec"), true);
        dependency2.setEcosystem(Ecosystem.RUBY);
        dependency2.setPackagePath("path");
        expResult = dependency1;
        result = instance.getMainGemspecDependency(dependency1, dependency2);
        assertEquals(expResult, result);

        dependency1 = new Dependency(new File("some.gemspec"), true);
        dependency1.setEcosystem(Ecosystem.RUBY);
        dependency1.setPackagePath("path");
        dependency2 = new Dependency(new File("specifications/another.gemspec"), true);
        dependency2.setEcosystem(Ecosystem.RUBY);
        dependency2.setPackagePath("path");
        expResult = dependency2;
        result = instance.getMainGemspecDependency(dependency1, dependency2);
        assertEquals(expResult, result);
    }