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?
In short - these modules have the same aim (testing) but different kinds of toolsets to reach that.
RubySpec . RubySpec is a project to write an executable specification for the Ruby Programming Language.
RSpec - RSpec is a Behaviour-Driven Development tool for Ruby programmers. BDD is an approach to software development that combines Test-Driven Development, Domain Driven Design, and Acceptance Test-Driven Planning. RSpec helps you do the TDD part of that equation, focusing on the documentation and design aspects of TDD.
MSpec - MSpec is a specialized framework that is syntax-compatible with RSpec for basic things like +describe+, +it+ blocks and +before+, +after+ actions. MSpec contains additional features that assist in writing the RubySpecs used by multiple Ruby implementations.
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 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 right.
But RubySpec is not something need if you're just using ruby to develop your own web project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With