merb_screw_unit 0.9.7 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,9 @@
1
1
  Screw.Matchers = (function($) {
2
+ var jquerize = function(obj) {
3
+ if(typeof obj == "string") return iframeWindow.$(obj);
4
+ else return obj;
5
+ }
6
+
2
7
  return matchers = {
3
8
  expect: function(actual) {
4
9
  return {
@@ -15,12 +20,39 @@ Screw.Matchers = (function($) {
15
20
  }
16
21
  },
17
22
 
23
+ exist: {
24
+ match: function(expected, actual) {
25
+ return actual.length > 0;
26
+ },
27
+ failure_message: function(expected, actual, not) {
28
+ return 'expected ' + $.print(actual) + (not ? ' to not ' : ' to ') + "exist";
29
+ }
30
+ },
31
+
32
+ contain_text: {
33
+ match: function(expected, actual) {
34
+ return jquerize(actual).filter(":contains(\"" + expected + "\")").length > 0;
35
+ },
36
+ failure_message: function(expected, actual, not) {
37
+ return 'expected ' + $.print(jquerize(actual)) + (not ? ' to not have ' : ' to have ') + $.print(expected);
38
+ }
39
+ },
40
+
18
41
  have: {
19
42
  match: function(expected, actual) {
20
- return actual.find(expected).length > 0;
43
+ return jquerize(actual).find(expected).length > 0;
44
+ },
45
+ failure_message: function(expected, actual, not) {
46
+ return 'expected ' + $.print(jquerize(actual)) + (not ? ' to not have ' : ' to have ') + $.print(expected);
47
+ }
48
+ },
49
+
50
+ be_visible: {
51
+ match: function(expected, actual) {
52
+ return jquerize(actual).is(":visible");
21
53
  },
22
54
  failure_message: function(expected, actual, not) {
23
- return 'expected ' + $.print(actual) + (not ? ' to not have ' : ' to have ') + $.print(expected);
55
+ return 'expected ' + $.print(jquerize(actual)) + (not ? ' to not ' : ' to ') + "be visible";
24
56
  }
25
57
  },
26
58
 
@@ -61,13 +93,14 @@ Screw.Matchers = (function($) {
61
93
 
62
94
  be_empty: {
63
95
  match: function(expected, actual) {
64
- if (actual.length == undefined) throw(actual.toString() + " does not respond to length");
96
+ if (jquerize(actual).length == undefined)
97
+ throw($.print(jquerize(actual)) + " does not respond to length");
65
98
 
66
99
  return actual.length == 0;
67
100
  },
68
101
 
69
102
  failure_message: function(expected, actual, not) {
70
- return 'expected ' + $.print(actual) + (not ? ' to not be empty' : ' to be empty');
103
+ return 'expected ' + $.print(jquerize(actual)) + (not ? ' to not be empty' : ' to be empty');
71
104
  }
72
105
  }
73
106
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb_screw_unit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.7
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-09 00:00:00 +03:00
12
+ date: 2008-10-07 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.7
23
+ version: 0.9.8
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: merb-slices
@@ -30,7 +30,7 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.7
33
+ version: 0.9.8
34
34
  version:
35
35
  description: Merb Slice that provides support for Screw.Unit testing
36
36
  email: ykatz@engineyard.com
@@ -65,7 +65,7 @@ files:
65
65
  - app/views/main
66
66
  - app/views/main/index.html.erb
67
67
  - public/javascripts
68
- - public/javascripts/jquery-1.2.3.js
68
+ - public/javascripts/jquery-1.2.6.js
69
69
  - public/javascripts/jquery.fn.js
70
70
  - public/javascripts/jquery.print.js
71
71
  - public/javascripts/master.js