Commit ad37222563eb146240a1c1347f546f533c881ac7
Committed by
Heitor
1 parent
aab7ae61
Exists in
colab
and in
4 other branches
Fix syntax error in Javascripts
Signed-off-by: Heitor Reis <marcheing@gmail.com>
Showing
2 changed files
with
19 additions
and
13 deletions
Show diff stats
app/assets/javascripts/repository/state.js.coffee
| @@ -2,15 +2,15 @@ class Repository.State | @@ -2,15 +2,15 @@ class Repository.State | ||
| 2 | constructor: (@project_id, @repository_id) -> | 2 | constructor: (@project_id, @repository_id) -> |
| 3 | 3 | ||
| 4 | poll_state: (last_state) -> | 4 | poll_state: (last_state) -> |
| 5 | - $.post '/projects/' + @project_id + '/repositories/' + @repository_id + '/state', | ||
| 6 | - last_state: last_state | 5 | + $.post('/projects/' + @project_id + '/repositories/' + @repository_id + '/state', |
| 6 | + last_state: last_state) | ||
| 7 | 7 | ||
| 8 | schedule_poll_state: (last_state) -> | 8 | schedule_poll_state: (last_state) -> |
| 9 | context = this | 9 | context = this |
| 10 | call = () -> | 10 | call = () -> |
| 11 | - context.poll_state(last_state) | 11 | + context.poll_state(last_state) |
| 12 | 12 | ||
| 13 | - setTimeout( call, 15000 ) # Delays in 15s the next call | 13 | + setTimeout(call, 15000) # Delays in 15s the next call |
| 14 | 14 | ||
| 15 | @set_loader: (loading_html) -> | 15 | @set_loader: (loading_html) -> |
| 16 | $('div#processing_information').html(loading_html) | 16 | $('div#processing_information').html(loading_html) |
| 17 | \ No newline at end of file | 17 | \ No newline at end of file |
spec/javascripts/repository/branch_spec.js.coffee
| 1 | #= require application | 1 | #= require application |
| 2 | -#= require 'sinon' | 2 | +#= require sinon |
| 3 | 3 | ||
| 4 | describe "Branch#constructor", -> | 4 | describe "Branch#constructor", -> |
| 5 | it "should construct a branch", -> | 5 | it "should construct a branch", -> |
| @@ -8,23 +8,29 @@ describe "Branch#constructor", -> | @@ -8,23 +8,29 @@ describe "Branch#constructor", -> | ||
| 8 | assert.isNull(subject.request) | 8 | assert.isNull(subject.request) |
| 9 | 9 | ||
| 10 | describe "toggle", -> | 10 | describe "toggle", -> |
| 11 | - @subject = new Repository.Branch() | ||
| 12 | - beforeEach -> | 11 | + before -> |
| 12 | + @subject = new Repository.Branch() | ||
| 13 | + | ||
| 13 | @combo_box = sinon.stub() | 14 | @combo_box = sinon.stub() |
| 14 | $ = sinon.stub(window, "$") | 15 | $ = sinon.stub(window, "$") |
| 15 | $.withArgs("#branches").returns(@combo_box) | 16 | $.withArgs("#branches").returns(@combo_box) |
| 17 | + | ||
| 16 | context "scm_type = SVN", -> | 18 | context "scm_type = SVN", -> |
| 17 | - @combo_box.hide = sinon.spy() | ||
| 18 | - it "should hide the branches combo box", -> | 19 | + before -> |
| 20 | + @combo_box.hide = sinon.spy() | ||
| 19 | $.withArgs("#repository_scm_type").returns({val: -> "SVN"}) | 21 | $.withArgs("#repository_scm_type").returns({val: -> "SVN"}) |
| 22 | + | ||
| 23 | + it "should hide the branches combo box", -> | ||
| 20 | @subject.toggle() | 24 | @subject.toggle() |
| 21 | assert.isTrue(@combo_box.hide.calledOnce) | 25 | assert.isTrue(@combo_box.hide.calledOnce) |
| 26 | + | ||
| 22 | context "scm_type != SVN", -> | 27 | context "scm_type != SVN", -> |
| 23 | - @combo_box.show = sinon.spy() | 28 | + before -> |
| 29 | + @combo_box.show = sinon.spy() | ||
| 24 | $.withArgs("#repository_address").returns({val: -> "https://github.com/mezuro/prezento.git"}) | 30 | $.withArgs("#repository_address").returns({val: -> "https://github.com/mezuro/prezento.git"}) |
| 25 | - sinon.stub(@subject, "fetch").withArgs("https://github.com/mezuro/prezento.git") | ||
| 26 | - @subject.stub = sinon.spy() | ||
| 27 | - it "should show the branches combo box", -> | ||
| 28 | $.withArgs("#repository_scm_type").returns({val: -> "GIT"}) | 31 | $.withArgs("#repository_scm_type").returns({val: -> "GIT"}) |
| 32 | + sinon.stub(@subject, "fetch").withArgs("https://github.com/mezuro/prezento.git") | ||
| 33 | + | ||
| 34 | + it "should show the branches combo box", -> | ||
| 29 | @subject.toggle() | 35 | @subject.toggle() |
| 30 | assert.isTrue(@combo_box.show.calledOnce) | 36 | assert.isTrue(@combo_box.show.calledOnce) |