Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rspec-match_table

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rspec-match_table

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

rspec-match_table

It is array of hashes matcher.

Gem Version Build Status

Installation

Add this line to your application's Gemfile:

gem 'rspec-match_table'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rspec-match_table

Usage

require 'rspec/match_table'

RSpec.describe do
  specify do
  context 'when not match' do
    specify do
      expect(
        [
          {foo: 'bar', 100 => :zoo,  '100' => 100},
          {bar: 'foo', 200 => :baz,  '200' => 200},
          {baz: 'bar', 300 => 'foo', '300' => 300},
        ]
      ).to match_table( # or match_table_without_order
        [
          {foo: 'bar', 100 => :zoo,  '100' => 100},
          {bar: 'foo', 200 => 'baz', '200' => 200},
          {baz: 'bar', 300 => 'foo', '300' => 301},
        ]
      )
      #=> Failure/Error:
      #     expect(
      #       [
      #         {foo: 'bar', 100 => :zoo,  '100' => 100},
      #         {bar: 'foo', 200 => :baz,  '200' => 200},
      #         {baz: 'bar', 300 => 'foo', '300' => 300},
      #       ]
      #     ).to match_table(
      #       [
      #         {foo: 'bar', 100 => :zoo,  '100' => 100},
      #         {bar: 'foo', 200 => 'baz', '200' => 200},
      #
      #     expected: [{:foo=>"bar", 100=>:zoo, "100"=>100}, {:bar=>"foo", 200=>"baz", "200"=>200}, {:baz=>"bar", 300=>"foo", "300"=>301}]
      #          got: [{:foo=>"bar", 100=>:zoo, "100"=>100}, {:bar=>"foo", 200=>:baz, "200"=>200}, {:baz=>"bar", 300=>"foo", "300"=>300}]
      #
      #     Diff:
      #     @@ -1,4 +1,4 @@
      #      [{100=>:zoo, "100"=>100, :foo=>"bar"},
      #     - {200=>"baz", "200"=>200, :bar=>"foo"},
      #     - {300=>"foo", "300"=>301, :baz=>"bar"}]
      #     + {200=>:baz, "200"=>200, :bar=>"foo"},
      #     + {300=>"foo", "300"=>300, :baz=>"bar"}]
    end
  end
end

FAQs

Package last updated on 28 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc