Doing TDD in RubyMine, missing the "create missing method"

When doing TDD, I write the test spec first, creating the interface of the class under test. The new methods doesn't exist, and RubyMine notices this, underlining it with a grey line and yielding a short help command. Great! But where is the "implement missing method"-functionality, which you get in IntelliJ IDEA. I consider it an extremely powerful tool and encourages TDD (important in itself). I couldn't find information about this feature, is it planned for any release?

9 comments

Hi Ole,

This feature is supposed to work, but only in case when RubyMine is able to determine type of qualifier.
Only in this case we know the class/module to create declaration in.

Regards,
Oleg

0

You're right, it does work! Writting the new method in a test, then hitting alt+enter, yields the choice of creating the method in that class!

I guess I have evaluate my workflow. In unit tests of the object/class, new methods are easily recognized by the IDE, but that's not necessarily as easy in functional tests or somehow bigger unit tests with mulitple objects. The need for a new method is often discovered writing the latter, "bigger picture" test, which explains why I didn't believe the feature was supported.

Thank you, keep it up!

0

Hi Oleg,

I still think that this feature i.e. "create missing method" requires more polishing.

Take for instance these 2 classes (each in their own file):

class Grade

     def self.max(student)

          # do stuff to calc max

          @max_grade

     end

end


class Student


     def get_info

          {:max_grade => Grade.max(self), :average_grade => Grade.average(self)}

     end

end

Notice that Grade#average is not defined. I should be able to use the same option+enter to generate the skeleton code for this method (while still in the Student class, which would be in its own file). Currently, or at least, as fas as I've seen, the 'create missing method' feature ONLY works if you are trying to call a missing method from within the target.

So if I modified Grade as follows:

class Grade

     def self.max(student)

           # do stuff to calc max

          grades = self.get_all_grades_for_student(student)

          @max_grade

     end

end

I'd get an option to create get_all_grades_for_student while in the max method of the Grade file/class!

Bottom line, I'd love to see this feature implemented (and if I've missed it, please tell me how to access it )

H

0

I also think it should be more "inteligent". Suppose I have a class:

class User
  def instance_method
  end

  protected

  def protected_method
  end
end



When I do "create method" in test class newly created method will be placed under "protected_method", so I won't be able to use it in test. Is this possible to RubyMine be so inteligent to recognize public,protected, private blocks and place new created methods (create method, extract method refactorings) in correct places? Maybe some checkbox in dialog?
0

Hi Sebastian,

I also think it should be more "inteligent". Suppose I have a class:

class User
  def instance_method
  end

  protected

  def protected_method
  end
end

When I do "create method" in test class newly created method will be placed under "protected_method", so I won't be able to use it in test. Is this possible to RubyMine be so inteligent to recognize public,protected, private blocks and place new created methods (create method, extract method refactorings) in correct places? Maybe some checkbox in dialog?

Please submit a bug at: youtrack.jetbrains.net/issues/RUBY

Regards,
Oleg

0

Hi Harold,

I've just tried to reproduce it using latest RubyMine 2.0.2 RC2 (build 93.170) and eveything worked fine for me.
Please try this version: http://confluence.jetbrains.net/display/RUBYDEV/RubyMine+EAP

Regards,
Oleg

0

I have RubyMine 2.0.1 running on Mac OS X. That's the latest production version of your product. How soon before 2.0.2 moves from RC2 to production?

H

0

I downloaded 2.0.2 and tried the feature; works exactly as I'd have expected for .rb files.
How soon before 2.0.2 moves from RC2 to production?

cheers
H

0

Hi Harold,

We expect 2.0.2 final to be published as soon as possible, I think in a week.
So far it is pretty stable.

Regards,
Oleg

0

Please sign in to leave a comment.