Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about a unified adapters project? #1

Open
jesseclark opened this issue Nov 13, 2014 · 4 comments
Open

How about a unified adapters project? #1

jesseclark opened this issue Nov 13, 2014 · 4 comments

Comments

@jesseclark
Copy link

Hi there.

I just converted the JugglingDB adapter in to a Mongoose adapter. There were only very minor code changes required to accomplish this task.

I could go ahead and clone your project and change the name and modify the tests for the adapter I created and publish it. However, it occurs to me that the tests for each new adapter are basically going to be identical except for the names. Perhaps it would make sense to create one FactoryGirlAdapters project that consolidates all the adapters in one repo?

We could have the module expose adapters like:

var FactoryGirlAdapters = require('factory-girl-adapters');
var myDbAdapter = FactoryGirlAdapters.MyDBAdapter;

@aexmachina Would you be interested in adding the adapters you have created to such a project if we get one going?

@simonexmachina
Copy link

Hey @jesseclark, I initially thought that's a great idea, but then on reflection realised that it's no benefit to consumers, it's just an aid to our natural inclination to laziness :) I want to stick to the Node ethos of small packages that do one thing.

However you're right that the tests generally do the same thing, so we could definitely create a suite of tests that adapter modules can I use. I'm thinking that factory-girl should provide this, so you could require('factory-girl/lib/adapter-tests') in your tests.

I'll set this up for the adapters that I've authored and push a new version which you can use.

@simonexmachina
Copy link

Hi there, I've pushed some new stuff regarding this. See the example test/adapter-test.js in v1.1.2, and I've implemented it in factory-girl-bookshelf.

@jesseclark
Copy link
Author

I am ok with this approach too. It reduces code duplication without adding unnecessary dependencies to user's projects.

When I get a minute, I will integrate the adapter-tests and publish my Mongoose adapter.

I'll also update the README and maybe create a Wiki page for keeping track of adapter projects.

@simonexmachina
Copy link

Yeah a Wiki for adapter authors is a great idea. We can use npmjs.org for the list of adapters using the keyword factory-girl, I've create a link on the readme to the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants