RSpec

From Infogalactic: the planetary knowledge core
Jump to: navigation, search
RSpec
Developer(s) David Chelimsky, Myron Marston, Andy Lindeman, Jon Rowe, Paul Casaretto, Sam Phippen, Bradley Schaefer[1]
Initial release May 18, 2007; 17 years ago (2007-05-18)[2]
Stable release 3.4.0 [3] / November 12, 2015 (2015-11-12)
Operating system Cross-platform
Type Behavior driven development framework / Test tool
License MIT License
Website rspec.info

RSpec is a behavior-driven development (BDD) framework for the Ruby programming language, inspired by JBehave.[4] It contains its own mocking framework that is fully integrated into the framework based upon JMock. The framework can be considered a domain-specific language (DSL) and resembles a natural language specification.

Usage Examples

#Testing for our User class
describe User do
  context 'with admin privileges' do
    before :each do
      @admin = Admin.get(1)
    end

    it 'should exist' do
      expect(@admin).not_to be_nil
    end
    
    it 'should have a name' do
      expect(@admin.name).not_to be_false
    end
  end

  #...
end

See also

References

  1. RSpec core team. Retrieved 8 April 2013.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. https://rubygems.org/gems/rspec/versions/3.4.0
  4. Ed Gibbs, JBehave and RSpec History (Blog entry)

Further reading

  • Lua error in package.lua at line 80: module 'strict' not found.

External links

<templatestyles src="Asbox/styles.css"></templatestyles>