Code Monkey home page Code Monkey logo

factory_girl_rspec's Introduction

factory_girl_rspec

Build Status

Integrate FactoryGirl fixture initialization into the RSpec DSL.

Features

Usage

Basic usage:

# spec/models/user_spec.rb
describe User do
  context 'basic user' do
    # instantiate FactoryGirl :user fixture
    with :user
    it { user.should be_inactive }
    it { user.should_not be_happy }
  end
end

Advanced usage:

# spec/models/user_spec.rb
describe User do
  context 'when user.first_name == nil' do
    # instantiate FactoryGirl :user fixture with custom options
    with :user, :first_name => nil
    it { user.should be_inactive }
    it { user.should_not be_happy }
  end

  context 'when user is inactive' do
    # instantiate FactoryGirl :user fixture with custom traits
    with :user, :when_inactive
    it { user_when_inactive.should be_inactive }
  end
end

Installation

# Bundler Gemfile
gem 'factory_girl_rspec'

Contributing

  • Fork the project
  • Fix the issue
  • Add unit tests
  • Submit pull request on github

Original implementation described on Ryan Sonnek's blog

See CONTRIBUTORS.txt for list of project contributors

Copyright

Copyright (c) 2011 Ryan Sonnek See LICENSE.txt for further details.

factory_girl_rspec's People

Contributors

wireframe avatar releu avatar jredville avatar

Watchers

James Cloos avatar  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.