Giter VIP home page Giter VIP logo

accept_values_for's Introduction

AcceptValuesFor

Writing specs for complex validations is annoying. AcceptValuesFor makes it easy to test your validations with real world values, asserting which values should be accepted by your model and which should not.

Read the original blog post.

Gem Version Build Status Code Climate

Usage

describe User do
  describe "validation" do
    subject(:user) { User.new }

    it { should accept_values_for(:email, "[email protected]", "[email protected]") }
    it { should_not accept_values_for(:email, nil, " ", "john", "john@example") }
  end
end

Dependencies

  • Active Model (6, 7)
  • RSpec (3)

Installation

Gemfile

group :test do
  gem "accept_values_for"
end

Self-Promotion

Like AcceptValuesFor?

Watch the repository on GitHub and read my blog.

accept_values_for's People

Contributors

bogdan avatar christiannelson avatar deepj avatar laserlemon avatar lukerollans avatar masterkain avatar morygonzalez avatar petergoldstein avatar softwaregravy avatar tylergannon avatar zhuravel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

accept_values_for's Issues

Latest version still claims dependence on rails 3

Does not look like this is working with rails 4.

| Dependency Path | Rails Requirement |
+------------------------------------------------+------------------------+
| accept_values_for 0.5.1 | activemodel ~> 3.2.0

Deprecation warning with rspec 3

Thanks for the cool gem. There are new deprecation Warnings with rspec3.

Deprecation Warnings:
--------------------------------------------------------------------------------
AcceptValuesFor implements a legacy RSpec matcher
protocol. For the current protocol you should expose the failure messages
via the `failure_message` and `failure_message_when_negated` methods.
(Used from /Users/kitsane/src/gsc/spec/models/role_spec.rb:17:in `block (2 levels) in <top (required)>')
--------------------------------------------------------------------------------

Expectation fails if the error is added to :base

It's not always possible or desirable to assign a validation failure to a single attribute, in which case you can add errors for :base. If you do so, however, the validation failure won't satisfy the expectation, because the expectation only looks for errors on the attribute name.

I'm thinking about extending the matcher to compare the number of errors on :base before and after the change. Thoughts?

Version 0.5.0

I see in your gemspec that the version has been bumped to 0.5.0 and there's a Git tag for it as well, but version 0.5.0 of the gem doesn't exist on rubygems.org.

Rails 5.1.1 support with version bump?

It seems the version from rubygems (0.7.3) matches the version in this repo, but it does not not reflect the new code that supports up to Rails '<5.2'. Any chance you might bump the version and push it up to ruby gems so I can grab the new one via bundler?

thanks

Rspec 3.x support

Hi, it seems that you freeze rspec gem version in Gemfile. Is it possible to run accept_values_for using Rspec 3?

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.