Giter Club home page Giter Club logo

rspec-request_snapshot's People

Contributors

adimania avatar bruno-campos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

Forkers

ak47 tgaff tsubik

rspec-request_snapshot's Issues

Sort object keys before serializing?

Hello and thanks for the wonderful project!

I'm currently doing some performance work on an API which has changed the order in which object keys are sorted, but otherwise not changed the output. Unfortunately, this is causing my snapshot tests to fail, despite the responses being functionally the same.

I've resorted to using jq -S to recursively sort the keys in my snapshots to validate that the before and after are identical other than key order.

My sense is that for most cases, ignoring key order (likely by sorting before serializing) would be useful to avoid false negatives, but I could also see some edge cases where key order would matter, so might make sense to expose as a configuration option rather than default behavior.

Weekly Digest (18 July, 2020 - 25 July, 2020)

Here's the Weekly Digest for CareMessagePlatform/rspec-request_snapshot:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please ๐Ÿ‘€ Watch and โญ Star the repository CareMessagePlatform/rspec-request_snapshot to receive next weekly updates. ๐Ÿ˜ƒ

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. ๐Ÿ“†

allow arrays in payloads

test

  it 'foo' do
    expect(JSON.generate({ foo: [] })).to match_snapshot("foo")
  end

error

     Failure/Error: expect(JSON.generate({ foo: [] })).to match_snapshot("foo")
     
     NoMethodError:
       undefined method `each_key' for []:Array
       Did you mean?  each_entry
     # /Users/mathieu/.rvm/gems/ruby-2.3.3/gems/rspec-request_snapshot-0.5.0/lib/rspec/request_snapshot/handlers/json.rb:19:in `deep_transform_values'
     # /Users/mathieu/.rvm/gems/ruby-2.3.3/gems/rspec-request_snapshot-0.5.0/lib/rspec/request_snapshot/handlers/json.rb:9:in `comparable'
     # /Users/mathieu/.rvm/gems/ruby-2.3.3/gems/rspec-request_snapshot-0.5.0/lib/rspec/request_snapshot/matcher.rb:18:in `block (2 levels) in <module:RequestSnapshot>'
     # ./spec/pdf/extract_spec.rb:129:in `block (2 levels) in <top (required)>'

`expect` with Hash/Array object (not JSON string)

Hi

I'm trying to switch from this gem https://github.com/yesmeck/rspec-snapshot (which is not maintained anymore) to yours

I'm not testing HTTP calls to APIs but simple JSON-like hashes/arrays and I'm forced to stringify them to JSON like so :

  it 'foo' do
    expect(JSON.generate({ foo: [] })).to match_snapshot("foo")
  end

Snapshots are then stored as JSON.

I was wandering if there was a way to avoid the JSON.generate in my code and I guess some sort of JSON.parse in your code

Weekly Digest (26 July, 2020 - 2 August, 2020)

Here's the Weekly Digest for CareMessagePlatform/rspec-request_snapshot:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please ๐Ÿ‘€ Watch and โญ Star the repository CareMessagePlatform/rspec-request_snapshot to receive next weekly updates. ๐Ÿ˜ƒ

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. ๐Ÿ“†

Weekly Digest (2 August, 2020 - 9 August, 2020)

Here's the Weekly Digest for CareMessagePlatform/rspec-request_snapshot:


ISSUES

Last week, no issues were created.


PULL REQUESTS

Last week, no pull requests were created, updated or merged.


COMMITS

Last week there were no commits.


CONTRIBUTORS

Last week there were no contributors.


STARGAZERS

Last week there were no stargazers.


RELEASES

Last week there were no releases.


That's all for last week, please ๐Ÿ‘€ Watch and โญ Star the repository CareMessagePlatform/rspec-request_snapshot to receive next weekly updates. ๐Ÿ˜ƒ

You can also view all Weekly Digests by clicking here.

Your Weekly Digest bot. ๐Ÿ“†

specify dependency of ruby version (>= 2.3)

since the &. operator was introduced by ruby 2.3, you should add
spec.required_ruby_version = '>= 2.3'
to your gemspec

or avoid it to be compatible for older versions of ruby

An error occurred while loading ./spec/pdf/extract/utils/others_spec.rb.
Failure/Error: require 'rspec/request_snapshot'

SyntaxError:
  /Users/mathieu/.rvm/gems/ruby-2.2.9/gems/rspec-request_snapshot-0.5.0/lib/rspec/request_snapshot/matcher.rb:35: syntax error, unexpected '.'
        @options[:format]&.to_sym || RSpec.configuration...
                           ^
# /Users/mathieu/.rvm/gems/ruby-2.2.9/gems/rspec-request_snapshot-0.5.0/lib/rspec/request_snapshot.rb:6:in `require'
# /Users/mathieu/.rvm/gems/ruby-2.2.9/gems/rspec-request_snapshot-0.5.0/lib/rspec/request_snapshot.rb:6:in `<top (required)>'
# ./spec/spec_helper.rb:6:in `require'
# ./spec/spec_helper.rb:6:in `<top (required)>'
# ./spec/pdf/extract/utils/others_spec.rb:1:in `require'
# ./spec/pdf/extract/utils/others_spec.rb:1:in `<top (required)>'

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.