ember.js-emberjs Blogs
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
Kiprosh is now part of LawLytics
Written by Kiprosh, team of passionate and disciplined craftsmen turning your ideas into reality.
While working with any application, testing plays most important role. Data is main requirement for writing proper test cases. We need different kind of data to test complex features and here factories plays important role. Data factory is blueprint that allows us to create an object, or a collection of objects, with predefined set of values. Factories makes it easy for us to define different kind of data. In rails or ember we create model object to write test cases. In rails many of us use FactoryGirl to create such test data using factories. Same way ember has FactoryGuy. Ember's
Let's assume we have route in our application: app/router.js Router.map(function() { this.route('category', { path: '/category/:id' }); } This route has dynamic segment. Whenever application will be loaded it will create url as '/category/1' , 'category/2' etc. What is Dynamic segment? A dynamic segment is a section of the path for a route which will change based on the content of a page. Dynamic segments are made up of a : followed by an identifier in path. If user navigates to 'category/5' then it will have category_id '5' to load correct category. Dynamic Segment