Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8264457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:27:50+00:00 2026-06-08T04:27:50+00:00

I am trying to test a DS.Model using jasmine. I am trying to test

  • 0

I am trying to test a DS.Model using jasmine. I am trying to test that when i create a record it is setup properly.

When i do

bb = App.BuildingBlock.createRecord(name: "Test")

i get the error

Cannot read property ‘createRecord’ of undefined

but if i do

bb = App.BuildingBlock.create(name: "Test")

i get

Error: You should not call create on a model. Instead, call createRecord with the attributes you would like to set.

So it seems to know its a model ??? Also if i do

expect(App.BuildingBlock).toBeDefined()

it passes.

Anyone help me with this ?

thanks
Rick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:27:53+00:00Added an answer on June 8, 2026 at 4:27 am

    Add the following to the top of your spec

    store = DS.Store.create({ revision: 4 })
    

    Then use

    store.createRecord(App.BuildingBlock, {name: "Test"});
    

    The reason for the errors you’re seeing is that DS.Model aliases createRecord to the store and that is what is undefined.

    At the bottom of model.js you will see the following lines:

    DS.Model.reopenClass({
      isLoaded: storeAlias('recordIsLoaded'),
      find: storeAlias('find'),
      filter: storeAlias('filter'),
    
      _create: DS.Model.create,
    
      create: function() {
        throw new Ember.Error("You should not call `create` on a model. Instead, call `createRecord` with the attributes you would like to set.");
      },
    
      createRecord: storeAlias('createRecord')
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it good to use an autoloader that load root/app/model/test.php when trying to use
I'm trying to test an application that runs on App Engine. I'm using the
I'm trying to test a model method using Play Framework 2.0 and Specs2. Global.scala
I'm trying to test that a UserProfile model is created as a new User
I am trying to create a car make/model form using Javascript or AJAX, problem
I'm trying to write a test for a model with a picture, using paperclip.
I am trying to test my controller's create action. I am using Devise for
I was trying to learn the ways of testing Backbone-based app using Jasmine. For
I'm trying to create a test using Mockito, however I'm getting a NullPointerException. The
I'm trying to move a Rails 3 app that's using Fixtures over to Factory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.