accept_values_for 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b466c18c67ea0704eacf2be73b449ac00a73c02
4
- data.tar.gz: 707d2eb9c3d91c587eee0a50ae81730b01769b4e
3
+ metadata.gz: 0c68c769aa81b7f8995dc3bb5282cfff8e4d5b79
4
+ data.tar.gz: 9bf7fecfab2e384eb90cfb4e854f0d299a5cddc0
5
5
  SHA512:
6
- metadata.gz: 233db06ae71d2d69994af4af2be46760dd463becdb0655353c3e5f77fb338435054def203e61325d18c768266402a773dd5661a2d01b44309407190337450410
7
- data.tar.gz: 805f71fc9be9b172d9e0b8e85c68962860b6e47e65a6487de0340e880bbeec186dd783ec4778e4c63f9623a05baed383b70e140b82a2e33f93b7b7e86b713d0b
6
+ metadata.gz: aa35e5b1984292b2e140898be8f6d58fa31865b464f55524540725b8c43b5b54cae758cb7f4f1b0865c542ddad7344d4895e9523ef3e99fe05f65bd9208cafa5
7
+ data.tar.gz: 6b4388802f4b11514414c83cddab4676a66251cc714e7047196d7ea6fe830d2b8acc4a5ac08d3613062ecd2deb67c0ad6316ee13081c544930054a490fc0be79
data/Gemfile CHANGED
@@ -4,6 +4,6 @@ gemspec
4
4
 
5
5
  group :test do
6
6
  gem "activerecord", "~> 4.0", :require => "active_record"
7
- gem "rspec", "~> 2.14"
7
+ gem "rspec", "~> 3.0"
8
8
  gem "sqlite3", "~> 1.3"
9
9
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "accept_values_for"
5
- spec.version = "0.7.0"
5
+ spec.version = "0.7.1"
6
6
 
7
7
  spec.author = "Bogdan Gusiev"
8
8
  spec.email = "agresso@gmail.com"
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(/^spec/)
20
20
 
21
21
  spec.add_dependency "activemodel", ">= 3", "< 5"
22
- spec.add_dependency "rspec", "~> 2.0"
22
+ spec.add_dependency "rspec", ">= 2.0", "< 4.0"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.5"
25
25
  spec.add_development_dependency "rake", "~> 10.1"
@@ -24,7 +24,7 @@ module AcceptValuesFor
24
24
  end
25
25
  end
26
26
 
27
- def failure_message_for_should
27
+ def failure_message
28
28
  result = "expected #{@model.inspect} to accept values #{formatted_failed_values} for #{@attribute.inspect}, but it was not\n"
29
29
  @failed_values.keys.sort.each do |key|
30
30
  result << "\nValue: #{key}\tErrors: #{@attribute} #{@failed_values[key]}"
@@ -32,10 +32,13 @@ module AcceptValuesFor
32
32
  result
33
33
  end
34
34
 
35
- def failure_message_for_should_not
35
+ def failure_message_when_negated
36
36
  "expected #{@model.inspect} to not accept values #{formatted_failed_values} for #{@attribute.inspect} attribute, but was"
37
37
  end
38
38
 
39
+ alias :failure_message_for_should :failure_message
40
+ alias :failure_message_for_should_not :failure_message_when_negated
41
+
39
42
  def description
40
43
  "accept values #{@values.map(&:inspect).join(', ')} for #{@attribute.inspect} attribute"
41
44
  end
@@ -8,11 +8,11 @@ describe "AcceptValuesFor" do
8
8
  subject { accept_values_for_object.matches?(person) }
9
9
  context "when value is accepted" do
10
10
  let(:values) { ['MALE'] }
11
- it { should be_true }
11
+ it { should eq(true) }
12
12
  end
13
13
  context "when value is not accepted" do
14
14
  let(:values) { ['INVALID'] }
15
- it { should be_false }
15
+ it { should eq(false) }
16
16
  it "should have correct failure message for should" do
17
17
  accept_values_for_object.matches?(person)
18
18
  accept_values_for_object.failure_message_for_should.should == "expected #{person.inspect} to accept values \"INVALID\" for :gender, but it was not\n\nValue: INVALID\tErrors: gender is not included in the list"
@@ -24,7 +24,7 @@ describe "AcceptValuesFor" do
24
24
  end
25
25
  context "when 2 values are not accepted" do
26
26
  let(:values) { ["INVALID", "WRONG"] }
27
- it { should be_false }
27
+ it { should eq(false) }
28
28
  it "should have correct failure message for should" do
29
29
  accept_values_for_object.matches?(person)
30
30
  accept_values_for_object.failure_message_for_should.should == "expected #{person.inspect} to accept values \"INVALID\", \"WRONG\" for :gender, but it was not\n\nValue: INVALID\tErrors: gender is not included in the list\nValue: WRONG\tErrors: gender is not included in the list"
@@ -32,7 +32,7 @@ describe "AcceptValuesFor" do
32
32
  end
33
33
  context "when one value is accept and other is not" do
34
34
  let(:values) { ['MALE', 'INVALID'] }
35
- it { should be_false }
35
+ it { should eq(false) }
36
36
  end
37
37
  end
38
38
 
@@ -40,11 +40,11 @@ describe "AcceptValuesFor" do
40
40
  subject { accept_values_for_object.does_not_match?(person) }
41
41
  context "when value is not accepted" do
42
42
  let(:values) { ['INVALID'] }
43
- it { should be_true }
43
+ it { should eq(true) }
44
44
  end
45
45
  context "when value is accepted" do
46
46
  let(:values) { ['FEMALE'] }
47
- it { should be_false }
47
+ it { should eq(false) }
48
48
  it "should have correct failure message for should" do
49
49
  accept_values_for_object.does_not_match?(person)
50
50
  accept_values_for_object.failure_message_for_should_not.should == "expected #{person.inspect} to not accept values \"FEMALE\" for :gender attribute, but was"
@@ -56,7 +56,7 @@ describe "AcceptValuesFor" do
56
56
  end
57
57
  context "when 2 values are accepted" do
58
58
  let(:values) { ["FEMALE", "MALE"] }
59
- it { should be_false }
59
+ it { should eq(false) }
60
60
  it "should have correct failure message for should" do
61
61
  accept_values_for_object.does_not_match?(person)
62
62
  accept_values_for_object.failure_message_for_should_not.should == "expected #{person.inspect} to not accept values \"FEMALE\", \"MALE\" for :gender attribute, but was"
@@ -64,7 +64,7 @@ describe "AcceptValuesFor" do
64
64
  end
65
65
  context "when one value is accept and other is not" do
66
66
  let(:values) { ['MALE', 'INVALID'] }
67
- it { should be_false }
67
+ it { should eq(false) }
68
68
  end
69
69
  end
70
70
 
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ require "accept_values_for"
2
2
 
3
3
  require "bundler"
4
4
  Bundler.require(:test)
5
+ I18n.enforce_available_locales = false
5
6
 
6
7
  RSpec.configure do |config|
7
8
  config.before(:suite) do
@@ -41,4 +42,8 @@ RSpec.configure do |config|
41
42
  Object.send(:remove_const, :Person)
42
43
  Object.send(:remove_const, :Group)
43
44
  end
45
+
46
+ config.expect_with(:rspec) do |c|
47
+ c.syntax = [:should, :expect]
48
+ end
44
49
  end
metadata CHANGED
@@ -1,75 +1,81 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accept_values_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bogdan Gusiev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-22 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3'
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3'
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rspec
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ~>
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '4.0'
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - ~>
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: '2.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '4.0'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: bundler
49
55
  requirement: !ruby/object:Gem::Requirement
50
56
  requirements:
51
- - - ~>
57
+ - - "~>"
52
58
  - !ruby/object:Gem::Version
53
59
  version: '1.5'
54
60
  type: :development
55
61
  prerelease: false
56
62
  version_requirements: !ruby/object:Gem::Requirement
57
63
  requirements:
58
- - - ~>
64
+ - - "~>"
59
65
  - !ruby/object:Gem::Version
60
66
  version: '1.5'
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: rake
63
69
  requirement: !ruby/object:Gem::Requirement
64
70
  requirements:
65
- - - ~>
71
+ - - "~>"
66
72
  - !ruby/object:Gem::Version
67
73
  version: '10.1'
68
74
  type: :development
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
71
77
  requirements:
72
- - - ~>
78
+ - - "~>"
73
79
  - !ruby/object:Gem::Version
74
80
  version: '10.1'
75
81
  description: Writing specs for complex validations is annoying. AcceptValuesFor makes
@@ -80,8 +86,8 @@ executables: []
80
86
  extensions: []
81
87
  extra_rdoc_files: []
82
88
  files:
83
- - .gitignore
84
- - .travis.yml
89
+ - ".gitignore"
90
+ - ".travis.yml"
85
91
  - CHANGELOG.md
86
92
  - Gemfile
87
93
  - LICENSE.txt
@@ -107,12 +113,12 @@ require_paths:
107
113
  - lib
108
114
  required_ruby_version: !ruby/object:Gem::Requirement
109
115
  requirements:
110
- - - '>='
116
+ - - ">="
111
117
  - !ruby/object:Gem::Version
112
118
  version: '0'
113
119
  required_rubygems_version: !ruby/object:Gem::Requirement
114
120
  requirements:
115
- - - '>='
121
+ - - ">="
116
122
  - !ruby/object:Gem::Version
117
123
  version: '0'
118
124
  requirements: []