minitest_rails_tools 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. data/lib/validation_matchers.rb +3 -1
  2. metadata +1 -1
@@ -1,4 +1,6 @@
1
1
  # Allows for some automagic association tests.
2
+ # Expects 'subject' to be defined. E.g.
3
+ # subject { FactoryGirl.create :foo }
2
4
 
3
5
  def must_validate_presence_of(attribute_name)
4
6
  it "validates_presence_of :#{attribute_name.to_s.parameterize.underscore}" do
@@ -10,7 +12,7 @@ end
10
12
 
11
13
  def must_validate_uniqueness_of(attribute_name)
12
14
  it "validates_uniqueness_of :#{attribute_name.to_s.parameterize.underscore}" do
13
- other = FactoryGirl.create subject.class.to_s.parameterize.underscore.to_sym
15
+ other = subject.class.new
14
16
  subject.send "#{attribute_name}=".to_sym, other.send(attribute_name)
15
17
  subject.valid?.must_equal false
16
18
  subject.errors.messages[attribute_name.to_sym].must_include "has already been taken"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest_rails_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: