chai-jquery-rails 0.0.3 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,8 @@ Gem::Specification.new do |gem|
13
13
  gem.require_paths = ["lib"]
14
14
  gem.version = Chai::Jquery::Rails::VERSION
15
15
 
16
+ gem.add_development_dependency('bundler')
17
+
16
18
  gem.add_dependency "railties", "~> 3.1"
17
19
  gem.add_dependency "sprockets"
18
20
  end
@@ -1,7 +1,7 @@
1
1
  module Chai
2
2
  module Jquery
3
3
  module Rails
4
- VERSION = "0.0.3"
4
+ VERSION = "1.1.1"
5
5
  end
6
6
  end
7
7
  end
@@ -5,20 +5,25 @@
5
5
  module.exports = chaiJquery;
6
6
  } else if (typeof define === "function" && define.amd) {
7
7
  // AMD
8
- define(function () {
9
- return chaiJquery;
8
+ define(['jquery'], function ($) {
9
+ return function (chai, utils) {
10
+ return chaiJquery(chai, utils, $);
11
+ };
10
12
  });
11
13
  } else {
12
14
  // Other environment (usually <script> tag): plug in to global chai instance directly.
13
- chai.use(chaiJquery);
15
+ chai.use(function (chai, utils) {
16
+ return chaiJquery(chai, utils, jQuery);
17
+ });
14
18
  }
15
- }(function (chai, utils) {
19
+ }(function (chai, utils, $) {
16
20
  var inspect = utils.inspect,
17
21
  flag = utils.flag;
22
+ $ = $ || jQuery;
18
23
 
19
- jQuery.fn.inspect = function (depth) {
20
- var el = jQuery('<div />').append(this.clone());
21
- if (depth) {
24
+ $.fn.inspect = function (depth) {
25
+ var el = $('<div />').append(this.clone());
26
+ if (depth !== undefined) {
22
27
  var children = el.children();
23
28
  while (depth-- > 0)
24
29
  children = children.children();
@@ -114,7 +119,7 @@
114
119
  );
115
120
  });
116
121
 
117
- jQuery.each(['visible', 'hidden', 'selected', 'checked', 'disabled'], function (i, attr) {
122
+ $.each(['visible', 'hidden', 'selected', 'checked', 'disabled'], function (i, attr) {
118
123
  chai.Assertion.addProperty(attr, function () {
119
124
  this.assert(
120
125
  flag(this, 'object').is(':' + attr)
@@ -126,7 +131,7 @@
126
131
  chai.Assertion.overwriteProperty('exist', function (_super) {
127
132
  return function () {
128
133
  var obj = flag(this, 'object');
129
- if (obj instanceof jQuery) {
134
+ if (obj instanceof $) {
130
135
  this.assert(
131
136
  obj.length > 0
132
137
  , 'expected ' + inspect(obj.selector) + ' to exist'
@@ -140,7 +145,7 @@
140
145
  chai.Assertion.overwriteProperty('empty', function (_super) {
141
146
  return function () {
142
147
  var obj = flag(this, 'object');
143
- if (obj instanceof jQuery) {
148
+ if (obj instanceof $) {
144
149
  this.assert(
145
150
  obj.is(':empty')
146
151
  , 'expected #{this} to be empty'
@@ -155,7 +160,7 @@
155
160
  return function () {
156
161
  var be = function (selector) {
157
162
  var obj = flag(this, 'object');
158
- if (obj instanceof jQuery) {
163
+ if (obj instanceof $) {
159
164
  this.assert(
160
165
  obj.is(selector)
161
166
  , 'expected #{this} to be #{exp}'
@@ -174,7 +179,7 @@
174
179
  chai.Assertion.overwriteMethod('match', function (_super) {
175
180
  return function (selector) {
176
181
  var obj = flag(this, 'object');
177
- if (obj instanceof jQuery) {
182
+ if (obj instanceof $) {
178
183
  this.assert(
179
184
  obj.is(selector)
180
185
  , 'expected #{this} to match #{exp}'
@@ -192,7 +197,7 @@
192
197
  _super.call(this);
193
198
  var contain = function (text) {
194
199
  var obj = flag(this, 'object');
195
- if (obj instanceof jQuery) {
200
+ if (obj instanceof $) {
196
201
  this.assert(
197
202
  obj.is(':contains(\'' + text + '\')')
198
203
  , 'expected #{this} to contain #{exp}'
@@ -211,7 +216,7 @@
211
216
  chai.Assertion.overwriteProperty('have', function (_super) {
212
217
  return function () {
213
218
  var obj = flag(this, 'object');
214
- if (obj instanceof jQuery) {
219
+ if (obj instanceof $) {
215
220
  var have = function (selector) {
216
221
  this.assert(
217
222
  // Using find() rather than has() to work around a jQuery bug:
metadata CHANGED
@@ -1,48 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chai-jquery-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
4
  prerelease:
5
+ version: 1.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Schlensker
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-26 00:00:00.000000000 Z
12
+ date: 2013-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: railties
15
+ name: bundler
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
16
22
  requirement: !ruby/object:Gem::Requirement
17
23
  none: false
18
24
  requirements:
19
- - - ~>
25
+ - - ! '>='
20
26
  - !ruby/object:Gem::Version
21
- version: '3.1'
22
- type: :runtime
27
+ version: '0'
23
28
  prerelease: false
29
+ type: :development
30
+ - !ruby/object:Gem::Dependency
31
+ name: railties
24
32
  version_requirements: !ruby/object:Gem::Requirement
25
33
  none: false
26
34
  requirements:
27
35
  - - ~>
28
36
  - !ruby/object:Gem::Version
29
37
  version: '3.1'
38
+ requirement: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '3.1'
44
+ prerelease: false
45
+ type: :runtime
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: sprockets
32
- requirement: !ruby/object:Gem::Requirement
48
+ version_requirements: !ruby/object:Gem::Requirement
33
49
  none: false
34
50
  requirements:
35
51
  - - ! '>='
36
52
  - !ruby/object:Gem::Version
37
53
  version: '0'
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
54
+ requirement: !ruby/object:Gem::Requirement
41
55
  none: false
42
56
  requirements:
43
57
  - - ! '>='
44
58
  - !ruby/object:Gem::Version
45
59
  version: '0'
60
+ prerelease: false
61
+ type: :runtime
46
62
  description: Adds chai-jquery plugin to rails asset pipeline
47
63
  email:
48
64
  - christian@cswebartisan.com
@@ -52,7 +68,6 @@ extra_rdoc_files: []
52
68
  files:
53
69
  - .gitignore
54
70
  - .gitmodules
55
- - .rvmrc
56
71
  - Gemfile
57
72
  - LICENSE
58
73
  - README.md
@@ -73,18 +88,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
88
  - - ! '>='
74
89
  - !ruby/object:Gem::Version
75
90
  version: '0'
91
+ hash: 859057575067123486
76
92
  segments:
77
93
  - 0
78
- hash: -401249594129084681
79
94
  required_rubygems_version: !ruby/object:Gem::Requirement
80
95
  none: false
81
96
  requirements:
82
97
  - - ! '>='
83
98
  - !ruby/object:Gem::Version
84
99
  version: '0'
100
+ hash: 859057575067123486
85
101
  segments:
86
102
  - 0
87
- hash: -401249594129084681
88
103
  requirements: []
89
104
  rubyforge_project:
90
105
  rubygems_version: 1.8.24
data/.rvmrc DELETED
@@ -1,52 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p194@chai-jquery-rails"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.14.2 ()" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- if [[ $- == *i* ]] # check for interactive shells
29
- then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
30
- else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
31
- fi
32
- else
33
- # If the environment file has not yet been created, use the RVM CLI to select.
34
- rvm --create use "$environment_id" || {
35
- echo "Failed to create RVM environment '${environment_id}'."
36
- return 1
37
- }
38
- fi
39
-
40
- # If you use bundler, this might be useful to you:
41
- # if [[ -s Gemfile ]] && {
42
- # ! builtin command -v bundle >/dev/null ||
43
- # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
44
- # }
45
- # then
46
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
47
- # gem install bundler
48
- # fi
49
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
50
- # then
51
- # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
52
- # fi