Permalink
Browse files

don't put user on window

  • Loading branch information...
1 parent 1c216a0 commit 3f3f31c13de74ef26a2c4d4dd6f70f41c59e995e Michael Sofaer committed Jan 27, 2012
Showing with 10 additions and 10 deletions.
  1. +3 −3 spec/javascripts/helpers/SpecHelper.js
  2. +7 −7 spec/javascripts/stop_censorship_spec.js
@@ -5,8 +5,8 @@ beforeEach(function() {
var promise = CloudFlare.require(["stop_censorship","cloudflare/jquery1.7", "cloudflare/user"],
function(stop_censorship, $, user){
self.sopa = stop_censorship;
+ self.user = user
window.$ = $
- window.user = user
}
)
@@ -16,8 +16,8 @@ beforeEach(function() {
});
afterEach(function(){
- user.setCookie("__cfduid", "")
- user.setCookie("cf_sopa", "")
+ this.user.setCookie("__cfduid", "")
+ this.user.setCookie("cf_sopa", "")
$(".sopa_badge").remove()
this.sopa.config.cookie = null
})
@@ -18,8 +18,8 @@ describe("#sopafy", function(){
})
describe("when there is a CDN cookie, and no censorship cookie", function(){
beforeEach(function(){
- user.setCookie("__cfduid", "something")
- user.setCookie("cf_sopa", "")
+ this.user.setCookie("__cfduid", "something")
+ this.user.setCookie("cf_sopa", "")
this.target.sopafy()
this.sopa_wrappers = $("span.sopafied", this.target)
})
@@ -46,7 +46,7 @@ describe("#sopafy", function(){
expect(this.sopa.inspirationalDialog).toHaveBeenCalled();
})
it("should set a censorship cookie", function(){
- expect(user.getCookie("cf_sopa")).toBe("true")
+ expect(this.user.getCookie("cf_sopa")).toBe("true")
})
it("should create a reminder badge", function(){
expect($(".sopa_badge").length).toBe(1);
@@ -80,8 +80,8 @@ describe("#sopafy", function(){
})
describe("when there is a censorship cookie", function(){
beforeEach(function(){
- user.setCookie("__cfduid", "something")
- user.setCookie("cf_sopa", "true")
+ this.user.setCookie("__cfduid", "something")
+ this.user.setCookie("cf_sopa", "true")
})
describe("and persistent mode is not on", function(){
beforeEach(function(){
@@ -165,10 +165,10 @@ describe("protestContent", function(){
expect(this.content.text()).toContain("907-456-0233")
})
it("should have a button to restore the bars", function(){
- spyOn(user, "setCookie")
+ spyOn(this.user, "setCookie")
spyOn($.fn, "sopafy")
$(this.content.find(".recensor")).click()
- expect(user.setCookie.calls[0].args).toEqual(["cf_sopa", ""])
+ expect(this.user.setCookie.calls[0].args).toEqual(["cf_sopa", ""])
expect($.fn.sopafy).toHaveBeenCalled()
})
it("should have a link to the PIPA video", function(){

0 comments on commit 3f3f31c

Please sign in to comment.