diff --git a/.travis.yml b/.travis.yml index ea4c82d1..9526bd16 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,16 @@ language: ruby rvm: - 1.9.3 -script: "bundle exec rspec spec" +before_install: + - wget http://phantomjs.googlecode.com/files/phantomjs-1.7.0-linux-i686.tar.bz2 + - tar -xf phantomjs-1.7.0-linux-i686.tar.bz2 + - sudo rm -rf /usr/local/phantomjs + - sudo mv phantomjs-1.7.0-linux-i686 /usr/local/phantomjs +before_script: + - bundle exec rakep + - bundle exec rackup -s puma -p 5000 -D + - sleep 3 +script: "bundle exec rspec spec && ./run_jasmine.coffee http://localhost:5000/spec.html" notifications: irc: "irc.freenode.org#travis" campfire: diff --git a/assets/scripts/spec/spec_helper.coffee b/assets/scripts/spec/spec_helper.coffee index 5e1f2fe5..e49fa538 100644 --- a/assets/scripts/spec/spec_helper.coffee +++ b/assets/scripts/spec/spec_helper.coffee @@ -30,3 +30,26 @@ _Date = Date @Date = (date) -> new _Date(date || '2012-07-02T00:03:00Z') @Date.UTC = _Date.UTC + +# hacks for missing features in webkit +unless Function::bind + Function::bind = (oThis) -> + + # closest thing possible to the ECMAScript 5 internal IsCallable function + throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable") if typeof this isnt "function" + aArgs = Array::slice.call(arguments, 1) + fToBind = this + fNOP = -> + + fBound = -> + fToBind.apply (if this instanceof fNOP and oThis then this else oThis), aArgs.concat(Array::slice.call(arguments_)) + + fNOP.prototype = @.prototype + fBound.prototype = new fNOP() + fBound + +window.history.state = {} +oldPushState = window.history.pushState +window.history.pushState = (state, title, href) -> + window.history.state = state + oldPushState.apply this, arguments