GithubHelp home page GithubHelp logo

vsc-rspec's Introduction

Rspec snippets for Ruby and Rails

A simple rspec snippets to make life easier.

Enjoy!

Context and Blocks

  • rspec-new-rails-file : Rails standard new spec file template.
  • rspec-new-file : New spec file template.
  • rspec-new-shared-example : New rspec shared example file
  • rspec-new-shared-context : New rspec shared context file
  • rspec-include_context : include_context shared context
  • rspec-describe-block : Describe block
  • rspec-context-block : Context block
  • rspec-it-block : Rspec it block
  • rspec-it_behaves_like : it_behaves_like shared examples
  • rspec-it-inline : One liner it that uses subject

File Fixture

  • rspec-fixture : Declared a file fixture
  • rspec-fixture:size : Get the file size of fixture file
  • rspec-fixture:read : Read fixture file as string
  • rspec-fixture:read-json : Read fixture file as hash object
  • rspec-fixture:read-json-symbolize_keys : Read fixture file as hash object with its key symbolized
  • rspec-fixture:read-json-array-symbolize_keys : Read fixture file as array of hashes where the keys are symbolized

Let Declares

  • rspec-let : Let declaration
  • rspec-let-instance-double : Let declaration of instance double
  • rspec-let-class-double : Let declaration of class double
  • rspec-let-job-peform : Let declaration that triggers the ActiveJob
  • rspec-let-module : Let you test methods in module by calling them directly

Matchers

  • rspec-string : Test string
  • rspec-array : Test Array
  • rspec-hash : Test Hash
  • rspec-numeric : Test Numbers
  • rspec-exception : Test Exceptions

Boolean

  • rspec-truthy : be_truthy shortcut
  • rspec-truthy-subject : Inline test using subject
  • rspec-falsy : be_falsy shortcut
  • rspec-falsy-subject : Inline test using subject

Mock/Stub/Allow

  • rspec-expect:mock-return : Rspec expectition with mock
  • rspec-expect:mock : Rspec expectition
  • rspec-expect:execution-inline : Rspec expect execution inline with "expect {}.to"
  • rspec-expect:mock-minimum : Rspec expectition minimum
  • rspec-mock-rails-logger : Mocks Rails logger to check if a message was sent
  • rspec-instance-double : Declare instance double
  • rspec-instance-double-new: Initialize instance double
  • rspec-allow-receive-return : Allow to receive and return value
  • rspec-allow-receive-with-and-return : Allow to receive with param and return value

Active Jobs

  • rspec-job-enqueued : Check it see if a ActiveJob was enqueued after a code is executed
  • rspec-its(:size) : Check the size of the hash
  • rspec-its(:keys) : Check all key names only
  • rspec-its([:key]) : Check hash key value
  • rspec-its([:key1, :key2]) : subject { {key1: {key2: 3} } } | its([:key1, :key2]) { is_expected.to eq(3) }

Active Model

  • rspec-allow_value : Test usage of allow_value inline
  • rspec-allow_value-qualifiers : Test usage of allow_value with qualifiers
  • rspec-have_secure_password : Test usage of have_secure_password
  • rspec-validate_absence_of : Test usage of validates_absence_of
  • rspec-validate_acceptance_of : Test usage of validates_acceptance_of
  • rspec-validate_confirmation_of : Test usage of validates_confirmation_of
  • rspec-validate_exclusion_of : Test usage of validate_exclusion_of
  • rspec-validate_inclusion_of : Test usage of validates_inclusion_of
  • rspec-validate_length_of : Test usage of validates_length_of
  • rspec-validate_length_of:minimum : Test usage of validate_length_of inline
  • rspec-validate_numericality_of : Test usage of validates_numericality_of
  • rspec-validate_presence_of : Test usage of validates_presence_of

Active Record

  • rspec-accepts_nested_attributes_for : Tests usage of accepts_nested_attributes_for inline
  • rspec-accepts_nested_attributes_for-qualifiers : Tests usage of accepts_nested_attributes_for with qualifiers
  • rspec-belongs_to : Test usage of belongs_to
  • rspec-has_many : Test usage of has_many
  • rspec-have_one : Test usage of have_one
  • rspec-validate_uniqueness_of : Tests usage of validate_uniqueness_of

Controller & Route

  • rspec-permit : Test controller params
  • rspec-redirect : Test redirect
  • rspec-route : Test routing
  • rspec-render-template : Test render template
  • rspec-render-partial : Test partial template
  • rspec-respond-with : Test http status code
  • rspec-check-session : Test session

Release Notes

For changelog see CHANGELOG.md

vsc-rspec's People

Contributors

saimonl avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

halilim

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.