Comments (8)
That's fantastic! Great work. I think you're on the right track. Without the tests I have no idea what the output will look like though, so I hope you can find the time.
I agree, having a Cucumber dependency is a little awkward. Something I have discovered about gem dependencies is that copy-paste is not always an evil, and is often preferable to adding a whole gem dependency when all you want is a specific bit of functionality that is unlikely to ever change (with a credit at the top of course, to say where it has been copied from). Do you think it would be possible to extract just the Table class?
from pact-ruby.
I'll have a look if the diffing can be extracted from the Table class, I hope it's not too coupled. First I have to create a use case for my company though to allow me to invest more time into pact.
One thing I'm not sure of how to do (according to my understanding of the code, it probably can't be done yet) is how to define per request if additional columns or rows are allowed. The differ itself has an options hash but at least the RSpec matcher doesn't pass any options. I assume that you could create a configured instance of a Differ in the configuration instead of the class, but this would only allow setting options for all requests with the same mime-type, right?
from pact-ruby.
Yes, you can only set the Differ per mime-type, not per request. But this
may not be a problem - keep reading.
So, Pact follows Postel's law for matching. Requests should have only what
is expected, and no more. Responses should allow extra things in them that
can be ignored by the consumer (as there may be more than one consumer, and
they may be interested in different columns). This makes more obvious sense
for a JSON request/response than as CSV, I'll admit. If the response
columns have headers, and the client looks up the data by knowing the names
of the headers, I would say that extra columns should be allowed all the
time, and order shouldn't matter, because any extra columns/order would
just be ignored. If the response columns are keyed by index, then any extra
columns on the end should be ok, but not any in the middle, and order
should matter.
The difference between the request and the response diffing is that the
option allow_unexpected_keys: false is passed in to the Differ for
requests, and as you have noticed, no options are passed in to the Differ
options for responses (it defaults to allowing unexpected keys).
It seems to me that there should be two types of CSV Differs - one that
caters for a CSV with headers, and one that caters for a CSV with no
headers.
What do you think?
On Wed, Nov 5, 2014 at 9:06 PM, Martin Mauch [email protected]
wrote:
I'll have a look if the diffing can be extracted from the Table class, I
hope it's not too coupled. First I have to create a use case for my company
though to allow me to invest more time into pact.
One thing I'm not sure of how to do (according to my understanding of the
code, it probably can't be done yet) is how to define per request if
additional columns or rows are allowed. The differ itself has an options
hash but at least the RSpec matcher doesn't pass any options
https://github.com/realestate-com-au/pact/blob/master/lib/pact/provider/rspec/matchers.rb#L36.
I assume that you could create a configured instance of a Differ in the
configuration
https://github.com/crealytics/pact/blob/1757b54e163090b2e4084fc3929ef012998937d5/example/animal-service/spec/service_consumers/pact_helper.rb#L16
instead of the class, but this would only allow setting options for all
requests with the same mime-type, right?—
Reply to this email directly or view it on GitHub
https://github.com/realestate-com-au/pact/issues/57#issuecomment-61784855
.
from pact-ruby.
Hi Beth,
sorry for the long delay after your detailed answer.
I got pulled into other stuff and I don't know when I'll be able to continue on CSV support for pact.
If you want, I'll close this issue for the time being and update/reopen it when I have time to continue with it.
Best
Martin
from pact-ruby.
Okey dokey. If I find someone else who needs it, are you happy to publish the gem, or share gem publishing permissions?
from pact-ruby.
I've published my initial version here:
http://rubygems.org/gems/pact-csv
I'm happy to share gem publishing permissions if someone wants to continue.
Shall I give you permissions just in case?
from pact-ruby.
Just in case! I'd prefer not to write my actual rubygems email address on a github issue, can I send it to info at crealytics.com?
from pact-ruby.
You can send it to mauch at crealytics de. Also it seems rubygems.org is already publishing my private email address :p
from pact-ruby.
Related Issues (20)
- Add support for consumer version selectors for deployed and released versions
- Set "enable pending" to true by default HOT 1
- Let's Encrypt certificate verify failed September 30th HOT 28
- Ruby pact-provider-verifier --enable-pending returns non-zero exit code if pending pact provider state setup fails HOT 2
- Naming collision with term-ansicolor gem HOT 1
- app_version_branch is absent in MessageProviderDSL
- Service Provider and Message Provider seem incompatible in pact_helper HOT 8
- Support for provider states with no operations
- Pact v3 specification implementation for Pact Ruby HOT 2
- Pact v4 specification implementation for Pact Ruby HOT 3
- Verify when the provider has no matching Pacts HOT 1
- "Ignoring unsupported combine AND for path" on every property HOT 2
- Set order of interactions in Pact file HOT 2
- Service provider configuration overlaps with other service providers HOT 1
- undefined method `href' for nil:NilClass (NoMethodError)
- rails pact:verify runs tests and sends to broker, then hangs HOT 3
- Pact creating conflict when using Minitest on Rails 7.1 HOT 2
- Any plan for a new release with support of Rack 3? HOT 1
- Pact No such file or directory publish_dir HOT 1
- Need Guidance on Injecting Dynamic Authentication Headers in Provider Verification HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pact-ruby.