Skip to content
This repository
Browse code

Update history

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

0 comments on commit 9446fef

Please sign in to comment.
Something went wrong with that request. Please try again.