shoulda-matchers 1.0.0.beta1 → 1.0.0.beta2

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/Gemfile CHANGED
@@ -1,10 +1,4 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '3.0.3'
4
- gem 'sqlite3-ruby', :require => 'sqlite3'
5
- gem 'mocha'
6
- gem 'rspec-rails'
7
- gem 'ruby-debug'
8
- gem 'cucumber'
9
- gem "aruba"
3
+ gemspec
10
4
 
data/Gemfile.lock CHANGED
@@ -1,3 +1,8 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ shoulda-matchers (1.0.0.beta2)
5
+
1
6
  GEM
2
7
  remote: http://rubygems.org/
3
8
  specs:
@@ -28,12 +33,15 @@ GEM
28
33
  activemodel (= 3.0.3)
29
34
  activesupport (= 3.0.3)
30
35
  activesupport (3.0.3)
31
- arel (2.0.6)
32
- aruba (0.2.7)
33
- background_process
36
+ archive-tar-minitar (0.5.2)
37
+ arel (2.0.8)
38
+ aruba (0.2.8)
39
+ childprocess (~> 0.1.6)
34
40
  cucumber (~> 0.10.0)
35
- background_process (1.2)
41
+ rspec (~> 2.3.0)
36
42
  builder (2.1.2)
43
+ childprocess (0.1.6)
44
+ ffi (~> 0.6.3)
37
45
  columnize (0.3.2)
38
46
  cucumber (0.10.0)
39
47
  builder (>= 2.1.2)
@@ -44,13 +52,15 @@ GEM
44
52
  diff-lcs (1.1.2)
45
53
  erubis (2.6.6)
46
54
  abstract (>= 1.0.0)
47
- gherkin (2.3.2)
55
+ ffi (0.6.3)
56
+ rake (>= 0.8.7)
57
+ gherkin (2.3.3)
48
58
  json (~> 1.4.6)
49
- term-ansicolor (~> 1.0.5)
50
59
  i18n (0.5.0)
51
60
  json (1.4.6)
52
- linecache (0.43)
53
- mail (2.2.12)
61
+ linecache19 (0.5.11)
62
+ ruby_core_source (>= 0.1.4)
63
+ mail (2.2.15)
54
64
  activesupport (>= 2.3.6)
55
65
  i18n (>= 0.4.0)
56
66
  mime-types (~> 1.16)
@@ -62,7 +72,7 @@ GEM
62
72
  rack (1.2.1)
63
73
  rack-mount (0.6.13)
64
74
  rack (>= 1.0.0)
65
- rack-test (0.5.6)
75
+ rack-test (0.5.7)
66
76
  rack (>= 1.0)
67
77
  rails (3.0.3)
68
78
  actionmailer (= 3.0.3)
@@ -82,35 +92,43 @@ GEM
82
92
  rspec-core (~> 2.3.0)
83
93
  rspec-expectations (~> 2.3.0)
84
94
  rspec-mocks (~> 2.3.0)
85
- rspec-core (2.3.0)
95
+ rspec-core (2.3.1)
86
96
  rspec-expectations (2.3.0)
87
97
  diff-lcs (~> 1.1.2)
88
98
  rspec-mocks (2.3.0)
89
- rspec-rails (2.3.0)
99
+ rspec-rails (2.3.1)
90
100
  actionpack (~> 3.0)
91
101
  activesupport (~> 3.0)
92
102
  railties (~> 3.0)
93
103
  rspec (~> 2.3.0)
94
- ruby-debug (0.10.4)
95
- columnize (>= 0.1)
96
- ruby-debug-base (~> 0.10.4.0)
97
- ruby-debug-base (0.10.4)
98
- linecache (>= 0.3)
99
- sqlite3-ruby (1.3.2)
104
+ ruby-debug-base19 (0.11.24)
105
+ columnize (>= 0.3.1)
106
+ linecache19 (>= 0.5.11)
107
+ ruby_core_source (>= 0.1.4)
108
+ ruby-debug19 (0.11.6)
109
+ columnize (>= 0.3.1)
110
+ linecache19 (>= 0.5.11)
111
+ ruby-debug-base19 (>= 0.11.19)
112
+ ruby_core_source (0.1.4)
113
+ archive-tar-minitar (>= 0.5.2)
114
+ sqlite3 (1.3.3)
115
+ sqlite3-ruby (1.3.3)
116
+ sqlite3 (>= 1.3.3)
100
117
  term-ansicolor (1.0.5)
101
118
  thor (0.14.6)
102
119
  treetop (1.4.9)
103
120
  polyglot (>= 0.3.1)
104
- tzinfo (0.3.23)
121
+ tzinfo (0.3.24)
105
122
 
106
123
  PLATFORMS
107
124
  ruby
108
125
 
109
126
  DEPENDENCIES
110
- aruba
111
- cucumber
112
- mocha
127
+ aruba (~> 0.2.7)
128
+ cucumber (~> 0.10.0)
129
+ mocha (~> 0.9.10)
113
130
  rails (= 3.0.3)
114
- rspec-rails
115
- ruby-debug
116
- sqlite3-ruby
131
+ rspec-rails (~> 2.3.0)
132
+ ruby-debug19 (~> 0.11.6)
133
+ shoulda-matchers!
134
+ sqlite3-ruby (~> 1.3.2)
@@ -1,8 +1 @@
1
- require 'shoulda/matchers/version'
2
-
3
- if defined?(RSpec)
4
- require 'shoulda/matchers/integrations/rspec'
5
- else
6
- require 'shoulda/matchers/integrations/test_unit'
7
- end
8
-
1
+ require 'shoulda/matchers'
@@ -0,0 +1,8 @@
1
+ require 'shoulda/matchers/version'
2
+ require 'shoulda/matchers/assertion_error'
3
+
4
+ if defined?(RSpec)
5
+ require 'shoulda/matchers/integrations/rspec'
6
+ else
7
+ require 'shoulda/matchers/integrations/test_unit'
8
+ end
@@ -60,7 +60,7 @@ module Shoulda # :nodoc:
60
60
  private
61
61
 
62
62
  def assigned_value?
63
- if !@controller.instance_variables.include?("@#{@variable}")
63
+ if !@controller.instance_variables.map(&:to_s).include?("@#{@variable}")
64
64
  @failure_message =
65
65
  "Expected action to assign a value for @#{@variable}"
66
66
  false
@@ -49,7 +49,7 @@ module Shoulda # :nodoc:
49
49
  @context.send(:assert_redirected_to, @url)
50
50
  @negative_failure_message = "Didn't expect to redirect to #{@url}"
51
51
  true
52
- rescue Test::Unit::AssertionFailedError => error
52
+ rescue Shoulda::Matchers::AssertionError => error
53
53
  @failure_message = error.message
54
54
  false
55
55
  end
@@ -41,7 +41,7 @@ module Shoulda # :nodoc:
41
41
  @context.send(:assert_template, @template)
42
42
  @negative_failure_message = "Didn't expect to render #{@template}"
43
43
  true
44
- rescue Test::Unit::AssertionFailedError => error
44
+ rescue Shoulda::Matchers::AssertionError => error
45
45
  @failure_message = error.message
46
46
  false
47
47
  end
@@ -80,7 +80,7 @@ module Shoulda # :nodoc:
80
80
  rescue ::ActionController::RoutingError => error
81
81
  @failure_message = error.message
82
82
  false
83
- rescue Test::Unit::AssertionFailedError => error
83
+ rescue Shoulda::Matchers::AssertionError => error
84
84
  @failure_message = error.message
85
85
  false
86
86
  end
@@ -29,7 +29,7 @@ module Shoulda # :nodoc:
29
29
  "is not read-only"
30
30
  else
31
31
  @failure_message = "#{class_name} is making " <<
32
- "#{readonly_attributes.to_sentence} " <<
32
+ "#{readonly_attributes.to_a.to_sentence} " <<
33
33
  "read-only, but not #{@attribute}."
34
34
  end
35
35
  false
@@ -17,13 +17,8 @@ module Shoulda # :nodoc:
17
17
  # default_error_message(:too_short, :count => 5)
18
18
  # default_error_message(:too_long, :count => 60)
19
19
  def default_error_message(key, values = {})
20
- if Object.const_defined?(:I18n) # Rails >= 2.2
21
- result = I18n.translate("activerecord.errors.messages.#{key}", values)
22
- if result =~ /^translation missing/
23
- I18n.translate("errors.messages.#{key}", values)
24
- else
25
- result
26
- end
20
+ if Object.const_defined?(:I18n) # Rails >= 2.2
21
+ I18n.translate(:"activerecord.errors.messages.#{key}", {:default => :"errors.messages.#{key}"}.merge(values))
27
22
  else # Rails <= 2.1.x
28
23
  ::ActiveRecord::Errors.default_error_messages[key] % values[:count]
29
24
  end
@@ -8,7 +8,7 @@ module Shoulda # :nodoc:
8
8
  # Options:
9
9
  # * <tt>with_message</tt> - value the test expects to find in
10
10
  # <tt>errors.on(:attribute)</tt>. <tt>Regexp</tt> or <tt>String</tt>.
11
- # Defaults to the translation for <tt>:blank</tt>.
11
+ # Defaults to the translation for <tt>:invalid</tt>.
12
12
  # * <tt>with(string to test against)</tt>
13
13
  # * <tt>not_with(string to test against)</tt>
14
14
  #
@@ -49,7 +49,7 @@ module Shoulda # :nodoc:
49
49
 
50
50
  def matches?(subject)
51
51
  super(subject)
52
- @expected_message ||= :blank
52
+ @expected_message ||= :invalid
53
53
  return disallows_value_of(@value_to_fail, @expected_message) if @value_to_fail
54
54
  allows_value_of(@value_to_pass, @expected_message) if @value_to_pass
55
55
  end
@@ -47,7 +47,8 @@ module Shoulda # :nodoc:
47
47
  end
48
48
 
49
49
  def collection?
50
- if reflection = @subject.class.reflect_on_association(@attribute)
50
+ if @subject.class.respond_to?(:reflect_on_association) &&
51
+ reflection = @subject.class.reflect_on_association(@attribute)
51
52
  [:has_many, :has_and_belongs_to_many].include?(reflection.macro)
52
53
  else
53
54
  false
@@ -0,0 +1,11 @@
1
+ module Shoulda
2
+ module Matchers
3
+ if RUBY_VERSION > "1.9"
4
+ require 'minitest/unit'
5
+ AssertionError = MiniTest::Assertion
6
+ else
7
+ require 'test/unit/assertionfailederror'
8
+ AssertionError = Test::Unit::AssertionFailedError
9
+ end
10
+ end
11
+ end
@@ -9,15 +9,23 @@ end
9
9
 
10
10
  if defined?(::ActionController)
11
11
  require 'shoulda/matchers/action_controller'
12
- module RSpec::Rails::ControllerExampleGroup
13
- include Shoulda::Matchers::ActionController
12
+ module RSpec
13
+ module Rails
14
+ module ControllerExampleGroup
15
+ include Shoulda::Matchers::ActionController
16
+ end
17
+ end
14
18
  end
15
19
  end
16
20
 
17
21
  if defined?(::ActionMailer)
18
22
  require 'shoulda/matchers/action_mailer'
19
- module RSpec::Rails::MailerExampleGroup
20
- include Shoulda::Matchers::ActionMailer
23
+ module RSpec
24
+ module Rails
25
+ module MailerExampleGroup
26
+ include Shoulda::Matchers::ActionMailer
27
+ end
28
+ end
21
29
  end
22
30
  end
23
31
 
@@ -1,5 +1,5 @@
1
1
  module Shoulda
2
2
  module Matchers
3
- VERSION = "1.0.0.beta1"
3
+ VERSION = "1.0.0.beta2".dup
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoulda-matchers
3
3
  version: !ruby/object:Gem::Version
4
- hash: 299253597
5
- prerelease: true
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- - beta1
11
- version: 1.0.0.beta1
4
+ prerelease: 6
5
+ version: 1.0.0.beta2
12
6
  platform: ruby
13
7
  authors:
14
8
  - Tammer Saleh
@@ -20,10 +14,86 @@ autorequire:
20
14
  bindir: bin
21
15
  cert_chain: []
22
16
 
23
- date: 2011-01-19 00:00:00 -05:00
17
+ date: 2011-03-17 00:00:00 -04:00
24
18
  default_executable:
25
- dependencies: []
26
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rails
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ version: 3.0.3
28
+ type: :development
29
+ prerelease: false
30
+ version_requirements: *id001
31
+ - !ruby/object:Gem::Dependency
32
+ name: sqlite3-ruby
33
+ requirement: &id002 !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: 1.3.2
39
+ type: :development
40
+ prerelease: false
41
+ version_requirements: *id002
42
+ - !ruby/object:Gem::Dependency
43
+ name: mocha
44
+ requirement: &id003 !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ~>
48
+ - !ruby/object:Gem::Version
49
+ version: 0.9.10
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: *id003
53
+ - !ruby/object:Gem::Dependency
54
+ name: rspec-rails
55
+ requirement: &id004 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: 2.3.0
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: *id004
64
+ - !ruby/object:Gem::Dependency
65
+ name: cucumber
66
+ requirement: &id005 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: 0.10.0
72
+ type: :development
73
+ prerelease: false
74
+ version_requirements: *id005
75
+ - !ruby/object:Gem::Dependency
76
+ name: aruba
77
+ requirement: &id006 !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 0.2.7
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: *id006
86
+ - !ruby/object:Gem::Dependency
87
+ name: ruby-debug19
88
+ requirement: &id007 !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.11.6
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: *id007
27
97
  description: Making tests easy on the fingers and eyes
28
98
  email: support@thoughtbot.com
29
99
  executables: []
@@ -69,9 +139,11 @@ files:
69
139
  - lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb
70
140
  - lib/shoulda/matchers/active_record/validation_matcher.rb
71
141
  - lib/shoulda/matchers/active_record.rb
142
+ - lib/shoulda/matchers/assertion_error.rb
72
143
  - lib/shoulda/matchers/integrations/rspec.rb
73
144
  - lib/shoulda/matchers/integrations/test_unit.rb
74
145
  - lib/shoulda/matchers/version.rb
146
+ - lib/shoulda/matchers.rb
75
147
  - lib/shoulda-matchers.rb
76
148
  has_rdoc: true
77
149
  homepage: http://thoughtbot.com/community/
@@ -89,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
161
  requirements:
90
162
  - - ">="
91
163
  - !ruby/object:Gem::Version
92
- hash: 3
164
+ hash: 3667913558593923355
93
165
  segments:
94
166
  - 0
95
167
  version: "0"
@@ -98,14 +170,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
170
  requirements:
99
171
  - - ">="
100
172
  - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
173
  version: "0"
105
174
  requirements: []
106
175
 
107
176
  rubyforge_project:
108
- rubygems_version: 1.3.7
177
+ rubygems_version: 1.6.1
109
178
  signing_key:
110
179
  specification_version: 3
111
180
  summary: Making tests easy on the fingers and eyes