Permalink
Browse files

Update history

- also split out module declarations in ar_be_valid
  for consistency.
  • Loading branch information...
1 parent b3f9b23 commit 9446fef1ad12b815e649d139959afc29bb1023e1 @dchelimsky committed Jan 12, 2010
Showing with 26 additions and 18 deletions.
  1. +6 −0 History.rdoc
  2. +1 −3 lib/spec/rails/matchers.rb
  3. +19 −15 lib/spec/rails/matchers/ar_be_valid.rb
View
@@ -1,3 +1,9 @@
+=== Version 1.3.1 / 2010-01-12
+
+* bug fix
+ * ensure that Spec::Rails module is defined (Jack Chen and Ryan Bigg).
+ Closes #939.
+
=== Version 1.3.0 / 2010-01-11
* enhancements
@@ -1,5 +1,3 @@
-dir = File.dirname(__FILE__)
-
module Spec
module Rails
# Spec::Rails::Expectations::Matchers provides several expectation matchers
@@ -31,4 +29,4 @@ module Matchers
require 'spec/rails/matchers/include_text'
require 'spec/rails/matchers/redirect_to'
require 'spec/rails/matchers/route_to'
-require 'spec/rails/matchers/render_template'
+require 'spec/rails/matchers/render_template'
@@ -1,23 +1,27 @@
if defined?(ActiveRecord::Base)
- module Spec::Rails::Matchers
- # :call-seq:
- # response.should be_valid
- # response.should_not be_valid
- def be_valid
- ::Spec::Matchers::Matcher.new :be_valid do
- match do |actual|
- actual.valid?
- end
+ module Spec
+ module Rails
+ module Matchers
+ # :call-seq:
+ # response.should be_valid
+ # response.should_not be_valid
+ def be_valid
+ ::Spec::Matchers::Matcher.new :be_valid do
+ match do |actual|
+ actual.valid?
+ end
- failure_message_for_should do |actual|
- if actual.respond_to?(:errors) && ActiveRecord::Errors === actual.errors
- "Expected #{actual.inspect} to be valid, but it was not\nErrors: " + actual.errors.full_messages.join(", ")
- else
- "Expected #{actual.inspect} to be valid"
+ failure_message_for_should do |actual|
+ if actual.respond_to?(:errors) && ActiveRecord::Errors === actual.errors
+ "Expected #{actual.inspect} to be valid, but it was not\nErrors: " + actual.errors.full_messages.join(", ")
+ else
+ "Expected #{actual.inspect} to be valid"
+ end
+ end
end
end
+
end
end
-
end
end

0 comments on commit 9446fef

Please sign in to comment.