Giter Site home page Giter Site logo

andreslemik / regressor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ndea/regressor

0.0 2.0 0.0 166 KB

Generate specs for your rails application the easy way. Regressor generates model and controller specs based on validations, associations, enums, database, routes, callbacks. Use regressor to capture your rails application behaviour.

License: MIT License

Ruby 96.22% HTML 3.78%

regressor's Introduction

Gem Version Code Climate Bitdeli Badge

Regressor

Regressor is a regression based testing tool. What is regression testing? see here. You can generate specs based on your ActiveRecord models.

Made with โ™ฅ at Qurasoft

Get Regressor

Directly from GitHub
gem 'regressor', git: 'https://github.com/ndea/regressor.git', branch: 'master'

or

Rubygems
gem 'regressor', '~> 0.6.0'

Install

bundle install
rails g regressor:install

This will create an initializer in config/initializers. This initializers looks like this:

Initializer
# If the regressor gem is inside a group wrap your initializer in
# if defined?(Regressor) do .. end
Regressor.configure do |config|
  # Defines the path where the generated files for your models will be placed
  # config.regression_path = 'spec/models/regression'

  # Defines the path where the generated files for your controllers will be placed
  # config.regression_controller_path = 'spec/controllers/regression'

  # Exclude Models for regression spec generation.
  # Provide model names as String (e.g. 'User')
  # config.excluded_models = []

  # Exclude Controllers for regression generation.
  # Provide controller names as String (e.g. 'UsersController').
  # config.excluded_controllers = []

  # If you are using enums in Rails 4 enable this option to generate regression specs for enums.
  # If your Rails version is =< Rails 3 set this option to false.
  # Default this option is set to true.
  # config.include_enums = true
end

Then require the gem dependency 'shoulda-matchers' in your rails_helper (or spec_helper if you're using RSpec 2.x):

require 'shoulda/matchers'

If you are using mongoid please add mongoid-rspec.

Usage

Run the generator:

Be sure to run the generators in the test environment so that development-only gems are not being loaded, causing strange issues with controller filters and ActiveRecord callbacks.

ActiveRecord
RAILS_ENV=test rails generate regressor:model # Create Regression specs for your models
RAILS_ENV=test rails generate regressor:controller # Create Regression specs for your controllers
Mongoid
RAILS_ENV=test rails generate regressor:mongoid:model # Create regression specs for your mongoid models
Factories

You can even generate empty factories for your models simply by running

RAILS_ENV=test rails generate regressor:factory # Create empty factories based on your models
Supported Regressions
Factories

Empty factories can be created.

Models
ActiveRecord
  • Relations
    • belongs_to
    • has_many
    • has_one
  • Nested Attributes
  • Validations
    • Length
    • Presence
    • Numericality
  • Database
    • Columns
    • Indexes
  • Enums (Rails 4)
Mongoid
  • Relations
    • belongs_to
    • has_many
    • has_one
    • embeds_one
    • embeds_many
  • Database
    • Fields
  • Document
    • Includes
    • Versioning
Controllers
  • Routing
  • Callbacks
    • Before filter
    • After filter
    • Around filter

Also see

Airpair - Generate specs for your Rails application

Guard for regressor

Contributing

  1. Fork it ( https://github.com/ndea/regressor/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contribution topics wanted

  • Specs
  • Documentation
  • Bugfixes
  • Codestyle
  • Anything that improves this gem

regressor's People

Contributors

andreslemik avatar bitdeli-chef avatar buren avatar damirsvrtan avatar krzysiek1507 avatar

Watchers

 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.