Code Monkey home page Code Monkey logo

rspec-design-helpers's Introduction

RSpec-Design-Helper is a gem that enhances RSpec for the simple first steps of BDD.

When the need for a class first appears, you can easily generate failing specs that describe the interface to your class.

implements

Specifies that the subject must implement the specified methods.

Use When: You are designing the class, and you want to ensure that it exposes a field with a method implementation.

class FailingUser
end

class PassingUser
  def name
    'Billy Chatteroonski'
  end
end

describe FailingUser do
  implements :name # One spec fails. A FailingUser.new does not have a :new method
end

describe PassingUser
  implements :name # One spec passes. A PassingUser.new has a :new method.
end

class_implements

Specifies that the described_class must implement the specified methods.

Use When:

class FailingUser
end

class PassingUser
  def species
    Human
  end
end

describe FailingUser do
  class_implements :species # fails one spec.
end

describe PassingUser do
  class_implements :species # passes one spec.
end

Persistent Classes (a.k.a. Models)

is_persistible

Specifies that instances of described_class respond to save, save! and reload

Use When:

persists

Specifies that the subject is able to assign a sample value, save itself, then reload itself.

Use When:

rspec-design-helpers's People

Contributors

betawaffle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.