nttstar nttstar - 1 year ago 100
Ruby Question

Confusing with ruby spec

Which is the difference among spec / rspec and mspec?
In ruby spec home, it said that we should use mspec command.

But some other guys said it should be 'spec kind_of_spec.rb'.

Also someones said we should use 'rspec'.

Which is the difference of these three modules?

Answer Source

These are different tools / project with very simliar names but completely different aims!

1) rspec

RSpec is a Tool you use to test your own ruby code. It's a replacement for the built in testing framework of Rails described in the Rails Guide here.

If you switch to rspec, you run the command

rake spec

to run your whole test suite, or you run a command like

rspec rspec spec/models/course_spec.rb

to run one specific part of the test.

2) rubyspec and mspec

RubySpec is a project to write an executable specification for the Ruby Programming Language. There is a need for such a specification because there a several different ruby interpreters: Matz's Ruby Interpreter (called MRI) is the de facto standard, but there are also Rubinius, JRuby, IronRuby, MacRuby, HotRuby,...

MSpec is a tool used in developin the Ruby Specs. It's similar in usage zu rspec.

If you want to write a new Ruby interpreter you can use rubyspec to test if you are doing it write.

But RubySpec is not something need if you're just using ruby to develop your own web project.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download