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

Fixtures #7

Open
ayarulin opened this issue Jul 10, 2013 · 10 comments
Open

Fixtures #7

ayarulin opened this issue Jul 10, 2013 · 10 comments

Comments

@ayarulin
Copy link

Will it have FixtureAdapter for testing?

@ghempton
Copy link
Contributor

Right now the closest thing is Ep.LocalAdapter, which simply does not interface with a backend. In EPF it is quite easy to load data into a session. For instance you could do the following:

session.merge(App.Post.create({id: '1', title: 'testing'}));

session.load(App.Post, 1).then ... // will return the post merged above.

This should make up for many of the features a fixture adapter might have, however I would like to give this more thought and come up with an official story. I will keep this issue open to track.

@taras
Copy link
Contributor

taras commented Jul 16, 2013

+1

I'd like to try epf instead of Ember Data, but I need to be able to use Fixtures.

@heartsentwined
Copy link
Contributor

Just leaving a note here for future googlers. The id must be a string, an integer won't work.

// works
session.merge(App.Post.create({id: '1', title: 'testing'}));

// doesn't work
session.merge(App.Post.create({id: 1, title: 'testing'}));

Perhaps this should be documented - or I actually feel that a numeric id should also be accepted. The current behavior is rather unexpected to me, because it doesn't parallel

session.load(App.Post, 1); // works with numeric argument!

The behind-the-scenes coercion of id to string could be consistently applied everywhere, IMO.

@ghempton
Copy link
Contributor

@heartsentwined I agree w/ that. We should coerce during merge. Could you open up a separate issue?

@heartsentwined
Copy link
Contributor

New issue over at #27

@ghempton
Copy link
Contributor

ghempton commented Aug 6, 2013

Just as a side note for people looking into testing, I am working on tests for an EPF project and am quite successfully using sinonjs with the normal rest adapter for testing. IMO this could ultimately produce a smoother transition from a local solution to a real backend (I have heard horror stories about people transitioning from ED's fixture adapter to a real rest adapter).

@IderAghbal
Copy link

@ghempton : I can't bring the Ep.LocalAdapter to work..
it's behaving like the restadapter and trying to GET data from the server (resulting in 404 and breaking the app) 😕

@anthillape
Copy link

@IGuider I am having the same issue, did you manage to resolve it?

@IderAghbal
Copy link

@anthillape no, I returned to ember-data

@ghempton
Copy link
Contributor

As I said in my previous comment, I would recommend using sinon.js rather than Ep.LocalAdapter. I would give the same recommendation over ED's fixture adapter as well.

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

No branches or pull requests

6 participants