oojs 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ # =require_tree ./jasmine_helpers
@@ -0,0 +1,28 @@
1
+ # =require modules
2
+
3
+ TIMEOUT = 500 # ms - Used to be 300, but FF was too slow
4
+ extendClass 'specs.jasmine.AjaxHelpers', (self)->
5
+ ajaxServer = null
6
+ initialize: (fakeAjaxServer, options={})->
7
+ ajaxServer = fakeAjaxServer
8
+ TIMEOUT = options.timeout if options.timeout
9
+ ajaxSettings: -> ajaxServer.ajaxSettings()
10
+ waitsFor: (condition, message="waited event didn't happen", timeout=TIMEOUT)->
11
+ waitsFor (-> condition.call self), message, timeout
12
+ waitsForAjaxRequest: (message = "An AJAX call was expected", timeout=TIMEOUT, extraCondition)->
13
+ @waitsFor (-> ajaxServer.ajaxCallbacksQueue.length and
14
+ (not extraCondition or extraCondition.call self)), message, timeout
15
+ waitsForAjaxRequestAnd: (condition, message, timeout)->
16
+ @waitsForAjaxRequest(message, timeout, condition)
17
+ nextRequest: (url, method, format)->
18
+ @checkRequestSettings(url, method, format)
19
+ ajaxServer.processNextRequest()
20
+ checkRequestSettings: (url, method, format)->
21
+ s = @ajaxSettings()
22
+ expect(s.url).toBe url unless url is undefined
23
+ expect(s.type).toBe method unless method is undefined
24
+ expect(s.dataType).toBe format unless format is undefined
25
+ ignoreRequest: (url, method, format)->
26
+ @checkRequestSettings(url, method, format)
27
+ ajaxServer.ignoreNextRequest()
28
+
@@ -0,0 +1,6 @@
1
+ # =require jasmine-jquery
2
+
3
+ jasmine.JQuery.matchersClass.toHaveCss = (css)->
4
+ (return false unless @actual.css(prop) is value) for prop, value of css
5
+ true
6
+
@@ -5,6 +5,7 @@ $ -> new specs.<%= class_name %>Spec
5
5
  extendClass 'specs.<%= class_name %>Spec', (spec)->
6
6
  initialize: ->
7
7
  @createFakeServer()
8
+ @extend this, new specs.jasmine.AjaxHelpers(@fakeServer)
8
9
  @describe()
9
10
 
10
11
  describe: ->
@@ -12,12 +13,12 @@ extendClass 'specs.<%= class_name %>Spec', (spec)->
12
13
  @beforeAll()
13
14
  beforeEach @beforeEach
14
15
  @runSpecs()
15
- @afterAll()
16
+ runs @afterAll
16
17
 
17
18
  beforeAll: ->
18
19
  @fakeServer.start()
19
20
 
20
- afterAll: ->
21
+ afterAll: =>
21
22
  @fakeServer.stop()
22
23
 
23
24
  beforeEach: =>
@@ -1,7 +1,7 @@
1
1
  # =require application
2
2
  # =require modules
3
3
  # =require jquery
4
- # =require jasmine-jquery
4
+ # =require jasmine_helpers
5
5
  # #require jquery.ba-bbq # uncomment for enabling $.deparam()
6
6
  #
7
7
  # Put your common spec code here.
data/lib/oojs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Oojs
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oojs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -58,6 +58,9 @@ files:
58
58
  - LICENSE
59
59
  - README.md
60
60
  - Rakefile
61
+ - lib/assets/javascripts/jasmine_helpers.js.coffee
62
+ - lib/assets/javascripts/jasmine_helpers/ajax_spec_helpers.js.coffee
63
+ - lib/assets/javascripts/jasmine_helpers/extra_matchers.js.coffee
61
64
  - lib/generators/oojs/spec/USAGE
62
65
  - lib/generators/oojs/spec/spec_generator.rb
63
66
  - lib/generators/oojs/spec/templates/fake_ajax_server.js.coffee.erb
@@ -85,7 +88,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
88
  version: '0'
86
89
  segments:
87
90
  - 0
88
- hash: -3292733354914937011
91
+ hash: -347818735898025810
89
92
  required_rubygems_version: !ruby/object:Gem::Requirement
90
93
  none: false
91
94
  requirements:
@@ -94,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
97
  version: '0'
95
98
  segments:
96
99
  - 0
97
- hash: -3292733354914937011
100
+ hash: -347818735898025810
98
101
  requirements: []
99
102
  rubyforge_project:
100
103
  rubygems_version: 1.8.21