valid_attribute 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.2.1
2
+ Better value quoting using #inspect
3
+
1
4
  == 0.2.0
2
5
  Test::Unit::TestCase support. You should use shoulda-context
3
6
  Fixed logic bug with #does_not_match?
@@ -64,7 +64,7 @@ module ValidAttribute
64
64
  end
65
65
 
66
66
  def quote_values(values)
67
- values.map { |value| value.is_a?(String) ? "'#{value}'" : value }.join(', ')
67
+ values.map { |value| value.inspect }.join(', ')
68
68
  end
69
69
 
70
70
  end
@@ -1,3 +1,3 @@
1
1
  module ValidAttribute
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -31,7 +31,7 @@ describe 'ValidAttribute' do
31
31
  describe 'messages' do
32
32
  it '#negative_failue_message' do
33
33
  @matcher.matches?(@user)
34
- @matcher.negative_failure_message.should == " expected User#name to not accept the values: 'abc', 123"
34
+ @matcher.negative_failure_message.should == " expected User#name to not accept the values: \"abc\", 123"
35
35
  end
36
36
  end
37
37
  end
@@ -40,7 +40,7 @@ describe 'ValidAttribute' do
40
40
  before do
41
41
  @user.stubs(:valid?).returns(false)
42
42
  @user.stubs(:errors).returns({:name => []})
43
- @matcher = @should.have_valid(:name).when('abc', 123)
43
+ @matcher = @should.have_valid(:name).when(:abc, nil)
44
44
  end
45
45
 
46
46
  it 'matches? returns false' do
@@ -54,7 +54,7 @@ describe 'ValidAttribute' do
54
54
  describe 'messages' do
55
55
  it '#failue_message' do
56
56
  @matcher.matches?(@user)
57
- @matcher.failure_message.should == " expected User#name to accept the values: 'abc', 123"
57
+ @matcher.failure_message.should == " expected User#name to accept the values: :abc, nil"
58
58
  end
59
59
  end
60
60
  end
@@ -82,11 +82,11 @@ describe 'ValidAttribute' do
82
82
 
83
83
  it '#negative_failure_message' do
84
84
  @matcher.matches?(@user)
85
- @matcher.negative_failure_message.should == " expected User#name to not accept the value: 'abc'"
85
+ @matcher.negative_failure_message.should == " expected User#name to not accept the value: \"abc\""
86
86
  end
87
87
 
88
88
  it '#description' do
89
- @matcher.description.should == "be valid when: 'abc', 123"
89
+ @matcher.description.should == "be valid when: \"abc\", 123"
90
90
  end
91
91
  end
92
92
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: valid_attribute
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brian Cardarella