From ad37222563eb146240a1c1347f546f533c881ac7 Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Mon, 15 Jun 2015 15:58:19 -0300 Subject: [PATCH] Fix syntax error in Javascripts --- app/assets/javascripts/repository/state.js.coffee | 8 ++++---- spec/javascripts/repository/branch_spec.js.coffee | 24 +++++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/app/assets/javascripts/repository/state.js.coffee b/app/assets/javascripts/repository/state.js.coffee index 91b32ef..3ab0136 100644 --- a/app/assets/javascripts/repository/state.js.coffee +++ b/app/assets/javascripts/repository/state.js.coffee @@ -2,15 +2,15 @@ class Repository.State constructor: (@project_id, @repository_id) -> poll_state: (last_state) -> - $.post '/projects/' + @project_id + '/repositories/' + @repository_id + '/state', - last_state: last_state + $.post('/projects/' + @project_id + '/repositories/' + @repository_id + '/state', + last_state: last_state) schedule_poll_state: (last_state) -> context = this call = () -> - context.poll_state(last_state) + context.poll_state(last_state) - setTimeout( call, 15000 ) # Delays in 15s the next call + setTimeout(call, 15000) # Delays in 15s the next call @set_loader: (loading_html) -> $('div#processing_information').html(loading_html) \ No newline at end of file diff --git a/spec/javascripts/repository/branch_spec.js.coffee b/spec/javascripts/repository/branch_spec.js.coffee index 2849e1e..23a1754 100644 --- a/spec/javascripts/repository/branch_spec.js.coffee +++ b/spec/javascripts/repository/branch_spec.js.coffee @@ -1,5 +1,5 @@ #= require application -#= require 'sinon' +#= require sinon describe "Branch#constructor", -> it "should construct a branch", -> @@ -8,23 +8,29 @@ describe "Branch#constructor", -> assert.isNull(subject.request) describe "toggle", -> - @subject = new Repository.Branch() - beforeEach -> + before -> + @subject = new Repository.Branch() + @combo_box = sinon.stub() $ = sinon.stub(window, "$") $.withArgs("#branches").returns(@combo_box) + context "scm_type = SVN", -> - @combo_box.hide = sinon.spy() - it "should hide the branches combo box", -> + before -> + @combo_box.hide = sinon.spy() $.withArgs("#repository_scm_type").returns({val: -> "SVN"}) + + it "should hide the branches combo box", -> @subject.toggle() assert.isTrue(@combo_box.hide.calledOnce) + context "scm_type != SVN", -> - @combo_box.show = sinon.spy() + before -> + @combo_box.show = sinon.spy() $.withArgs("#repository_address").returns({val: -> "https://github.com/mezuro/prezento.git"}) - sinon.stub(@subject, "fetch").withArgs("https://github.com/mezuro/prezento.git") - @subject.stub = sinon.spy() - it "should show the branches combo box", -> $.withArgs("#repository_scm_type").returns({val: -> "GIT"}) + sinon.stub(@subject, "fetch").withArgs("https://github.com/mezuro/prezento.git") + + it "should show the branches combo box", -> @subject.toggle() assert.isTrue(@combo_box.show.calledOnce) -- libgit2 0.21.2