Skip to content

Instantly share code, notes, and snippets.

@brian428
Created September 6, 2012 04:17
Show Gist options
  • Save brian428/3651157 to your computer and use it in GitHub Desktop.
Save brian428/3651157 to your computer and use it in GitHub Desktop.
Spec involving asynchronous behavior and testing a non-view object
it "allows store to be filtered", ->
# We can test methods on a non-view object, including tests that involve asynchronous activities.
# This really doesn't belong in the MainTabPanelTest, but for simplicty I'm including it here.
store = Deft.ioc.Injector.resolve( "companyStore" )
waitsFor( ( -> store.getCount() > 0 ), "Store data never loaded.", 2000 )
runs( ->
expect( store.filters.length ).toBe( 0 )
store.filterIndustry( "Manufacturing" )
expect( store.filters.length ).toBe( 1 )
store.data.each ( thisCompany ) ->
expect( thisCompany.get( "industry" ) ).toEqual( "Manufacturing" )
store.clearFilter()
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment