Skip to content

Commit

Permalink
Put real functions in a class (and remove dummy stuff)
Browse files Browse the repository at this point in the history
  • Loading branch information
kerryb committed Mar 24, 2013
1 parent dffda64 commit ba515da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
15 changes: 6 additions & 9 deletions app/assets/javascripts/encryptor.coffee
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
window.Encryptor = class Encryptor
@addOne: (number) ->
number + 1
@encrypt: =>
plainText = $("#plain-text").val()
$.get "/encrypt", {text: plainText}, @update

encrypt = ->
plainText = $("#plain-text").val()
$.get "/encrypt", {text: plainText}, update

update = (data) ->
$("#encrypted-text").val data.text
@update: (data) =>
$("#encrypted-text").val data.text

$ ->
$("#plain-text").keyup encrypt
$("#plain-text").keyup window.Encryptor.encrypt
7 changes: 0 additions & 7 deletions spec/javascripts/dummy_spec.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
describe "2 + 2", ->
it "is 4", ->
expect(2 + 2).toEqual 4

describe "addOne", ->
it "adds one to a number", ->
expect(window.Encryptor.addOne(42)).toEqual 43

0 comments on commit ba515da

Please sign in to comment.