accept_values_for 0.3.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,8 @@
1
+ h3. 0.4.0
2
+
3
+ * Migrated to ActiveRecord 3.0
4
+ * Migrated to Rspec 2.0
5
+
1
6
  h3. 0.3.0
2
7
 
3
8
  * add 'discover' matcher to test named scopes
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  source :gemcutter
2
- gem 'activerecord'
3
- gem 'rspec'
4
- group :test do
2
+ gem 'activerecord', '>=3.0.0'
3
+ gem "rspec", ">=0"
4
+
5
+ group :development do
6
+ gem 'jeweler'
5
7
  gem 'sqlite3-ruby'
6
- end # do
8
+ end
@@ -0,0 +1,44 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activemodel (3.0.3)
5
+ activesupport (= 3.0.3)
6
+ builder (~> 2.1.2)
7
+ i18n (~> 0.4)
8
+ activerecord (3.0.3)
9
+ activemodel (= 3.0.3)
10
+ activesupport (= 3.0.3)
11
+ arel (~> 2.0.2)
12
+ tzinfo (~> 0.3.23)
13
+ activesupport (3.0.3)
14
+ arel (2.0.7)
15
+ builder (2.1.2)
16
+ diff-lcs (1.1.2)
17
+ git (1.2.5)
18
+ i18n (0.5.0)
19
+ jeweler (1.5.2)
20
+ bundler (~> 1.0.0)
21
+ git (>= 1.2.5)
22
+ rake
23
+ rake (0.8.7)
24
+ rspec (2.4.0)
25
+ rspec-core (~> 2.4.0)
26
+ rspec-expectations (~> 2.4.0)
27
+ rspec-mocks (~> 2.4.0)
28
+ rspec-core (2.4.0)
29
+ rspec-expectations (2.4.0)
30
+ diff-lcs (~> 1.1.2)
31
+ rspec-mocks (2.4.0)
32
+ sqlite3 (1.3.3)
33
+ sqlite3-ruby (1.3.3)
34
+ sqlite3 (>= 1.3.3)
35
+ tzinfo (0.3.24)
36
+
37
+ PLATFORMS
38
+ ruby
39
+
40
+ DEPENDENCIES
41
+ activerecord (>= 3.0.0)
42
+ jeweler
43
+ rspec
44
+ sqlite3-ruby
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
1
  require 'rubygems'
2
+ require "bundler"
3
+ Bundler.setup
4
+
2
5
  require 'rake'
3
- require 'spec/rake/spectask'
6
+ require 'rspec/core/rake_task'
4
7
 
5
- Spec::Rake::SpecTask.new(:spec) do |spec|
6
- spec.libs << 'lib' << 'spec'
7
- spec.spec_files = FileList['spec/**/*_spec.rb']
8
+ RSpec::Core::RakeTask.new(:spec) do |spec|
8
9
  end
9
10
 
10
11
  begin
@@ -20,8 +21,8 @@ EOI
20
21
  gemspec.email = "agresso@gmail.com"
21
22
  gemspec.homepage = "http://github.com/bogdan/accept_values_for"
22
23
  gemspec.authors = ["Bogdan Gusiev"]
23
- gemspec.add_dependency "activerecord"
24
- gemspec.add_dependency "rspec"
24
+ #gemspec.add_dependency "activerecord"
25
+ #gemspec.add_dependency "rspec"
25
26
  end
26
27
  rescue LoadError
27
28
  puts "Jeweler not available. Install it with: [sudo] gem install jeweler"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.4.1
@@ -1,15 +1,15 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{accept_values_for}
8
- s.version = "0.3.1"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bogdan Gusiev"]
12
- s.date = %q{2010-09-09}
12
+ s.date = %q{2011-02-25}
13
13
  s.description = %q{Rspec: When you have a complex validation(e.g. regexp or custom method) on ActiveRecord model
14
14
  you have to write annoying easy specs on which values should be accepted by your validation method and which should not.
15
15
  accepts_values_for rspec matcher simplify the code. See example for more information.
@@ -17,42 +17,51 @@ accepts_values_for rspec matcher simplify the code. See example for more informa
17
17
  s.email = %q{agresso@gmail.com}
18
18
  s.files = [
19
19
  "Changelog.textile",
20
- "Gemfile",
21
- "Rakefile",
22
- "Readme.textile",
23
- "VERSION",
24
- "accept_values_for.gemspec",
25
- "lib/accept_values_for.rb",
26
- "lib/discover.rb",
27
- "spec/accept_values_for_spec.rb",
28
- "spec/discover_spec.rb",
29
- "spec/spec_helper.rb"
20
+ "Gemfile",
21
+ "Gemfile.lock",
22
+ "Rakefile",
23
+ "Readme.textile",
24
+ "VERSION",
25
+ "accept_values_for.gemspec",
26
+ "lib/accept_values_for.rb",
27
+ "lib/discover.rb",
28
+ "spec/accept_values_for_spec.rb",
29
+ "spec/discover_spec.rb",
30
+ "spec/spec_helper.rb"
30
31
  ]
31
32
  s.homepage = %q{http://github.com/bogdan/accept_values_for}
32
- s.rdoc_options = ["--charset=UTF-8"]
33
33
  s.require_paths = ["lib"]
34
- s.rubygems_version = %q{1.3.6}
34
+ s.rubygems_version = %q{1.3.7}
35
35
  s.summary = %q{In order to test a complex validation for ActiveRecord models Implemented accept_values_for custom rspec matcher}
36
36
  s.test_files = [
37
+ "spec/accept_values_for_spec.rb",
37
38
  "spec/discover_spec.rb",
38
- "spec/accept_values_for_spec.rb",
39
- "spec/spec_helper.rb"
39
+ "spec/spec_helper.rb",
40
+ "test/lib/test.rb",
41
+ "test/test/helper.rb",
42
+ "test/test/test_test.rb"
40
43
  ]
41
44
 
42
45
  if s.respond_to? :specification_version then
43
46
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
47
  s.specification_version = 3
45
48
 
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
- s.add_runtime_dependency(%q<activerecord>, [">= 0"])
49
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
50
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
48
51
  s.add_runtime_dependency(%q<rspec>, [">= 0"])
52
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
53
+ s.add_development_dependency(%q<sqlite3-ruby>, [">= 0"])
49
54
  else
50
- s.add_dependency(%q<activerecord>, [">= 0"])
55
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
51
56
  s.add_dependency(%q<rspec>, [">= 0"])
57
+ s.add_dependency(%q<jeweler>, [">= 0"])
58
+ s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
52
59
  end
53
60
  else
54
- s.add_dependency(%q<activerecord>, [">= 0"])
61
+ s.add_dependency(%q<activerecord>, [">= 3.0.0"])
55
62
  s.add_dependency(%q<rspec>, [">= 0"])
63
+ s.add_dependency(%q<jeweler>, [">= 0"])
64
+ s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
56
65
  end
57
66
  end
58
67
 
@@ -38,7 +38,7 @@ class AcceptValuesFor #:nodoc:
38
38
  @values.each do |value|
39
39
  model.send("#{@attribute}=", value)
40
40
  model.valid?
41
- if model.errors.on(@attribute)
41
+ unless model.errors[@attribute].to_a.empty?
42
42
  @failed_value = value
43
43
  return false
44
44
  end
@@ -52,7 +52,7 @@ class AcceptValuesFor #:nodoc:
52
52
  @values.each do |value|
53
53
  model.send("#{@attribute}=", value)
54
54
  model.valid?
55
- unless model.errors.on(@attribute)
55
+ if model.errors[@attribute].to_a.empty?
56
56
  @failed_value = value
57
57
  return false
58
58
  end
@@ -62,8 +62,9 @@ class AcceptValuesFor #:nodoc:
62
62
 
63
63
  def failure_message_for_should
64
64
  result = "expected #{@model.inspect} to accept value #{@failed_value.inspect} for #{@attribute.inspect}, but it was not\n"
65
- if @model.respond_to?(:errors) && ActiveRecord::Errors === @model.errors
66
- result += "Errors: " + Array(@model.errors.on(@attribute)).join(", ")
65
+ if @model.respond_to?(:errors) && ActiveModel::Errors === @model.errors
66
+ result += "Errors: " + @model.errors[(@attribute)].to_a.
67
+ map{|a| "#{@attribute} #{a}"}.join(", ")
67
68
  end
68
69
  result
69
70
  end
@@ -18,7 +18,7 @@ describe "AcceptValuesFor" do
18
18
  it "should return false if one of values is not accepted" do
19
19
  matcher.matches?(subject).should be_false
20
20
  matcher.failure_message_for_should.should == "expected #{subject.inspect} to accept value \"INVALID\" for :gender, but it was not\n" +
21
- "Errors: is not included in the list"
21
+ "Errors: gender is not included in the list"
22
22
  end
23
23
  end
24
24
  end
@@ -1,6 +1,6 @@
1
- require 'rubygems'
2
- require 'spec'
3
- require 'spec/autorun'
1
+ require 'sqlite3'
2
+ require 'rspec'
3
+ require 'rspec/autorun'
4
4
  require 'active_record'
5
5
  require 'lib/accept_values_for'
6
6
  require 'lib/discover'
@@ -22,12 +22,12 @@ ActiveRecord::Schema.define(:version => 1) do
22
22
  end
23
23
  end
24
24
 
25
- Spec::Runner.configure do |config|
25
+ RSpec.configure do |config|
26
26
  config.before(:each) do
27
27
  class ::Group < ActiveRecord::Base
28
28
  has_many :people
29
29
 
30
- named_scope :by_char, lambda { |char|
30
+ scope :by_char, lambda { |char|
31
31
  {
32
32
  :conditions => ["name like ?", char + "%"],
33
33
  :order => "name"
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accept_values_for
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 13
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 3
8
+ - 4
8
9
  - 1
9
- version: 0.3.1
10
+ version: 0.4.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Bogdan Gusiev
@@ -14,33 +15,67 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-09-09 00:00:00 +03:00
18
+ date: 2011-02-25 00:00:00 +02:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
22
+ prerelease: false
21
23
  name: activerecord
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
34
+ version: 3.0.0
35
+ requirement: *id001
36
+ type: :runtime
37
+ - !ruby/object:Gem::Dependency
22
38
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
39
+ name: rspec
40
+ version_requirements: &id002 !ruby/object:Gem::Requirement
41
+ none: false
24
42
  requirements:
25
43
  - - ">="
26
44
  - !ruby/object:Gem::Version
45
+ hash: 3
27
46
  segments:
28
47
  - 0
29
48
  version: "0"
49
+ requirement: *id002
30
50
  type: :runtime
31
- version_requirements: *id001
32
51
  - !ruby/object:Gem::Dependency
33
- name: rspec
34
52
  prerelease: false
35
- requirement: &id002 !ruby/object:Gem::Requirement
53
+ name: jeweler
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
+ none: false
36
56
  requirements:
37
57
  - - ">="
38
58
  - !ruby/object:Gem::Version
59
+ hash: 3
39
60
  segments:
40
61
  - 0
41
62
  version: "0"
42
- type: :runtime
43
- version_requirements: *id002
63
+ requirement: *id003
64
+ type: :development
65
+ - !ruby/object:Gem::Dependency
66
+ prerelease: false
67
+ name: sqlite3-ruby
68
+ version_requirements: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirement: *id004
78
+ type: :development
44
79
  description: |
45
80
  Rspec: When you have a complex validation(e.g. regexp or custom method) on ActiveRecord model
46
81
  you have to write annoying easy specs on which values should be accepted by your validation method and which should not.
@@ -56,6 +91,7 @@ extra_rdoc_files: []
56
91
  files:
57
92
  - Changelog.textile
58
93
  - Gemfile
94
+ - Gemfile.lock
59
95
  - Rakefile
60
96
  - Readme.textile
61
97
  - VERSION
@@ -70,32 +106,36 @@ homepage: http://github.com/bogdan/accept_values_for
70
106
  licenses: []
71
107
 
72
108
  post_install_message:
73
- rdoc_options:
74
- - --charset=UTF-8
109
+ rdoc_options: []
110
+
75
111
  require_paths:
76
112
  - lib
77
113
  required_ruby_version: !ruby/object:Gem::Requirement
114
+ none: false
78
115
  requirements:
79
116
  - - ">="
80
117
  - !ruby/object:Gem::Version
118
+ hash: 3
81
119
  segments:
82
120
  - 0
83
121
  version: "0"
84
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
+ none: false
85
124
  requirements:
86
125
  - - ">="
87
126
  - !ruby/object:Gem::Version
127
+ hash: 3
88
128
  segments:
89
129
  - 0
90
130
  version: "0"
91
131
  requirements: []
92
132
 
93
133
  rubyforge_project:
94
- rubygems_version: 1.3.6
134
+ rubygems_version: 1.3.7
95
135
  signing_key:
96
136
  specification_version: 3
97
137
  summary: In order to test a complex validation for ActiveRecord models Implemented accept_values_for custom rspec matcher
98
138
  test_files:
99
- - spec/discover_spec.rb
100
139
  - spec/accept_values_for_spec.rb
140
+ - spec/discover_spec.rb
101
141
  - spec/spec_helper.rb