caremessageplatform / rspec-request_snapshot Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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.
Here's the Weekly Digest for CareMessagePlatform/rspec-request_snapshot:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
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. ๐
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)>'
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
Here's the Weekly Digest for CareMessagePlatform/rspec-request_snapshot:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
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. ๐
Here's the Weekly Digest for CareMessagePlatform/rspec-request_snapshot:
Last week, no issues were created.
Last week, no pull requests were created, updated or merged.
Last week there were no commits.
Last week there were no contributors.
Last week there were no stargazers.
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. ๐
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)>'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.