summaryrefslogtreecommitdiff
path: root/spec/javascripts
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/views/google_sync_button_spec.js.coffee23
1 files changed, 19 insertions, 4 deletions
diff --git a/spec/javascripts/views/google_sync_button_spec.js.coffee b/spec/javascripts/views/google_sync_button_spec.js.coffee
index 6862465..d12b0df 100644
--- a/spec/javascripts/views/google_sync_button_spec.js.coffee
+++ b/spec/javascripts/views/google_sync_button_spec.js.coffee
@@ -3,10 +3,25 @@ describe "GoogleSyncButton", ->
beforeEach ->
@subject = new Stronglifters.GoogleSyncButton()
+ it 'displays the correct button text', ->
+ expect(@subject.get('text')).toEqual("Sync with Google")
+
describe "synchronize", ->
+ beforeEach ->
+ @drive = { syncFile: null }
+ spyOn(@drive, 'syncFile')
+ spyOn(@subject, 'drive').and.returnValue(@drive)
+
it 'synchronizes the drive', ->
- drive = { syncFile: null }
- spyOn(drive, 'syncFile')
- @subject.synchronize(drive)
- expect(drive).to haveCalled('syncFile')
+ @subject.synchronize(@drive)
+ expect(@drive.syncFile).toHaveBeenCalled()
+
+ it 'changes the text on the button', ->
+ @subject.synchronize(@drive)
+ expect(@subject.get('text')).toEqual('Syncing...')
+
+ it 'changes the button icon', ->
+ @subject.synchronize(@drive)
+ expect(@subject.get('icon')).toContain('fa-spin')
+ expect(@subject.get('icon')).toContain('fa-spinner')