rspec-rails-matchers 0.2.0 → 0.2.1
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.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/rspec-rails-matchers.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require 'rspec/matchers'
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift(File.expand_path('
|
4
|
+
$LOAD_PATH.unshift(File.expand_path('../', __FILE__))
|
5
5
|
|
6
6
|
module RspecRailsMatchers
|
7
7
|
autoload :Message, 'rspec_rails_matchers/message'
|
8
8
|
autoload :Validations, 'rspec_rails_matchers/validations'
|
9
9
|
autoload :Associations, 'rspec_rails_matchers/associations'
|
10
10
|
autoload :Behavior, 'rspec_rails_matchers/behavior'
|
11
|
+
autoload :Sugar, 'rspec_rails_matchers/sugar'
|
11
12
|
end
|
12
13
|
|
13
14
|
Rspec.configure do |c|
|
14
15
|
c.include RspecRailsMatchers::Validations
|
15
16
|
c.include RspecRailsMatchers::Associations
|
16
17
|
c.include RspecRailsMatchers::Behavior
|
18
|
+
c.include RspecRailsMatchers::Sugar
|
17
19
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RspecRailsMatchers
|
2
|
+
module Sugar
|
3
|
+
def self.included( rspec )
|
4
|
+
rspec.extend ClassContextMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module ClassContextMethods
|
8
|
+
def its(attribute, &block)
|
9
|
+
describe("its #{attribute}") do
|
10
|
+
define_method(:subject) { super().send(attribute) }
|
11
|
+
it(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -26,10 +26,7 @@ module RspecRailsMatchers
|
|
26
26
|
if min && min >= 1
|
27
27
|
model.send("#{attr}=", 'a' * (min - 1))
|
28
28
|
|
29
|
-
model.invalid? &&
|
30
|
-
model.errors[attr].include?(
|
31
|
-
I18n::t('errors.messages.too_short', :count => min)
|
32
|
-
)
|
29
|
+
model.invalid? && model.errors[attr].any?
|
33
30
|
end
|
34
31
|
end
|
35
32
|
|
@@ -39,10 +36,7 @@ module RspecRailsMatchers
|
|
39
36
|
if max
|
40
37
|
model.send("#{attr}=", 'a' * (max + 1))
|
41
38
|
|
42
|
-
model.invalid? &&
|
43
|
-
model.errors[attr].include?(
|
44
|
-
I18n::t('errors.messages.too_long', :count => max)
|
45
|
-
)
|
39
|
+
model.invalid? && model.errors[attr].any?
|
46
40
|
end
|
47
41
|
end
|
48
42
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rspec-rails-matchers}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cyril David"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-17}
|
13
13
|
s.description = %q{Helps you write rspec with rails for fun}
|
14
14
|
s.email = %q{cyx@sinefunc.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/rspec_rails_matchers/behavior.rb",
|
34
34
|
"lib/rspec_rails_matchers/behavior/lint.rb",
|
35
35
|
"lib/rspec_rails_matchers/message.rb",
|
36
|
+
"lib/rspec_rails_matchers/sugar.rb",
|
36
37
|
"lib/rspec_rails_matchers/validations.rb",
|
37
38
|
"lib/rspec_rails_matchers/validations/confirmation_of.rb",
|
38
39
|
"lib/rspec_rails_matchers/validations/length_of.rb",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Cyril David
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-17 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/rspec_rails_matchers/behavior.rb
|
58
58
|
- lib/rspec_rails_matchers/behavior/lint.rb
|
59
59
|
- lib/rspec_rails_matchers/message.rb
|
60
|
+
- lib/rspec_rails_matchers/sugar.rb
|
60
61
|
- lib/rspec_rails_matchers/validations.rb
|
61
62
|
- lib/rspec_rails_matchers/validations/confirmation_of.rb
|
62
63
|
- lib/rspec_rails_matchers/validations/length_of.rb
|