dm-rspec 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1ff4e2329c1b538cb3ac029d4c20296db78cd6a1
4
+ data.tar.gz: f29ac09e597531c33da8a477c45cbdb962d82c07
5
+ SHA512:
6
+ metadata.gz: 2c8b450a4e00d1b1ef1e9cd4c4160c801aee83814de31a2c21e5a338aa5316d3e16c0dd57630afb4ce99baaef17dc1e14b271959b3ec7262755ceedc3837c684
7
+ data.tar.gz: 1431bf8c35b9655e1119747373f5369df2c6028779ba8dfd33922adbdd3c3b555f17a2ee00cdec5cba29069a3157c4470b300c7b06219fe7f8c609add1e04968
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
1
  --color
2
2
  --backtrace
3
- --format nested
3
+ --format documentation
@@ -1,3 +1,6 @@
1
+ ### version 0.3.0 / 2014-08-16
2
+ * Move to RSpec 3 (chip, duduribeiro)
3
+
1
4
  ### version 0.2.4 / 2013-02-07
2
5
  * New matcher: validate\_length\_of (GavinJoyce)
3
6
 
data/Gemfile CHANGED
@@ -8,14 +8,12 @@ gem 'dm-validations'
8
8
  # Add dependencies to develop your gem here.
9
9
  # Include everything needed to run rake, tests, features, etc.
10
10
  group :development do
11
- gem "rspec"
11
+ gem "rspec", "~> 3.0.0"
12
12
  gem "bundler"
13
13
  gem "jeweler"
14
14
  gem "reek"
15
15
  gem 'guard-rspec', :require => false
16
16
  gem 'libnotify' if RUBY_PLATFORM =~ /linux/
17
- gem 'ruby-debug19' if RUBY_VERSION =~ /^1\.9/
18
- gem 'ruby-debug' if RUBY_VERSION =~ /^1\.8/
19
17
 
20
18
  gem 'dm-migrations'
21
19
  gem 'dm-sqlite-adapter'
@@ -1,14 +1,18 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.2.7)
5
- archive-tar-minitar (0.5.2)
6
- columnize (0.3.6)
7
- data_objects (0.10.8)
4
+ addressable (2.3.6)
5
+ builder (3.2.2)
6
+ celluloid (0.15.2)
7
+ timers (~> 1.1.0)
8
+ coderay (1.1.0)
9
+ data_objects (0.10.14)
8
10
  addressable (~> 2.1)
9
- diff-lcs (1.1.3)
10
- dm-core (1.2.0)
11
- addressable (~> 2.2.6)
11
+ descendants_tracker (0.0.4)
12
+ thread_safe (~> 0.3, >= 0.3.1)
13
+ diff-lcs (1.2.5)
14
+ dm-core (1.2.1)
15
+ addressable (~> 2.3)
12
16
  dm-do-adapter (1.2.0)
13
17
  data_objects (~> 0.10.6)
14
18
  dm-core (~> 1.2.0)
@@ -19,56 +23,102 @@ GEM
19
23
  do_sqlite3 (~> 0.10.6)
20
24
  dm-validations (1.2.0)
21
25
  dm-core (~> 1.2.0)
22
- do_sqlite3 (0.10.8)
23
- data_objects (= 0.10.8)
24
- ffi (1.0.11)
25
- git (1.2.5)
26
- guard (1.0.0)
27
- ffi (>= 0.5.0)
28
- thor (~> 0.14.6)
29
- guard-rspec (0.6.0)
30
- guard (>= 0.10.0)
31
- jeweler (1.8.3)
32
- bundler (~> 1.0)
26
+ do_sqlite3 (0.10.14)
27
+ data_objects (= 0.10.14)
28
+ faraday (0.9.0)
29
+ multipart-post (>= 1.2, < 3)
30
+ ffi (1.9.3)
31
+ formatador (0.2.5)
32
+ git (1.2.8)
33
+ github_api (0.12.0)
34
+ addressable (~> 2.3)
35
+ descendants_tracker (~> 0.0.4)
36
+ faraday (~> 0.8, < 0.10)
37
+ hashie (>= 3.2)
38
+ multi_json (>= 1.7.5, < 2.0)
39
+ nokogiri (~> 1.6.3)
40
+ oauth2
41
+ guard (2.6.1)
42
+ formatador (>= 0.2.4)
43
+ listen (~> 2.7)
44
+ lumberjack (~> 1.0)
45
+ pry (>= 0.9.12)
46
+ thor (>= 0.18.1)
47
+ guard-rspec (4.3.1)
48
+ guard (~> 2.1)
49
+ rspec (>= 2.14, < 4.0)
50
+ hashie (3.2.0)
51
+ highline (1.6.21)
52
+ jeweler (2.0.1)
53
+ builder
54
+ bundler (>= 1.0)
33
55
  git (>= 1.2.5)
56
+ github_api
57
+ highline (>= 1.6.15)
58
+ nokogiri (>= 1.5.10)
34
59
  rake
35
60
  rdoc
36
- json (1.6.5)
37
- libnotify (0.7.2)
38
- linecache19 (0.5.12)
39
- ruby_core_source (>= 0.1.4)
40
- rake (0.9.2.2)
41
- rdoc (3.12)
61
+ json (1.8.1)
62
+ jwt (1.0.0)
63
+ libnotify (0.8.3)
64
+ ffi (>= 1.0.11)
65
+ listen (2.7.9)
66
+ celluloid (>= 0.15.2)
67
+ rb-fsevent (>= 0.9.3)
68
+ rb-inotify (>= 0.9)
69
+ lumberjack (1.0.9)
70
+ method_source (0.8.2)
71
+ mini_portile (0.6.0)
72
+ multi_json (1.10.1)
73
+ multi_xml (0.5.5)
74
+ multipart-post (2.0.0)
75
+ nokogiri (1.6.3.1)
76
+ mini_portile (= 0.6.0)
77
+ oauth2 (1.0.0)
78
+ faraday (>= 0.8, < 0.10)
79
+ jwt (~> 1.0)
80
+ multi_json (~> 1.3)
81
+ multi_xml (~> 0.5)
82
+ rack (~> 1.2)
83
+ pry (0.10.0)
84
+ coderay (~> 1.1.0)
85
+ method_source (~> 0.8.1)
86
+ slop (~> 3.4)
87
+ rack (1.5.2)
88
+ rainbow (2.0.0)
89
+ rake (10.3.2)
90
+ rb-fsevent (0.9.4)
91
+ rb-inotify (0.9.5)
92
+ ffi (>= 0.5.0)
93
+ rdoc (4.1.1)
42
94
  json (~> 1.4)
43
- reek (1.2.8)
44
- ruby2ruby (~> 1.2)
45
- ruby_parser (~> 2.0)
46
- sexp_processor (~> 3.0)
47
- rspec (2.8.0)
48
- rspec-core (~> 2.8.0)
49
- rspec-expectations (~> 2.8.0)
50
- rspec-mocks (~> 2.8.0)
51
- rspec-core (2.8.0)
52
- rspec-expectations (2.8.0)
53
- diff-lcs (~> 1.1.2)
54
- rspec-mocks (2.8.0)
55
- ruby-debug-base19 (0.11.25)
56
- columnize (>= 0.3.1)
57
- linecache19 (>= 0.5.11)
58
- ruby_core_source (>= 0.1.4)
59
- ruby-debug19 (0.11.6)
60
- columnize (>= 0.3.1)
61
- linecache19 (>= 0.5.11)
62
- ruby-debug-base19 (>= 0.11.19)
63
- ruby2ruby (1.3.1)
64
- ruby_parser (~> 2.0)
65
- sexp_processor (~> 3.0)
66
- ruby_core_source (0.1.5)
67
- archive-tar-minitar (>= 0.5.2)
68
- ruby_parser (2.3.1)
69
- sexp_processor (~> 3.0)
70
- sexp_processor (3.0.10)
71
- thor (0.14.6)
95
+ reek (1.3.8)
96
+ rainbow (>= 1.99, < 3.0)
97
+ ruby2ruby (>= 2.0.8, < 3.0)
98
+ ruby_parser (~> 3.3)
99
+ sexp_processor
100
+ rspec (3.0.0)
101
+ rspec-core (~> 3.0.0)
102
+ rspec-expectations (~> 3.0.0)
103
+ rspec-mocks (~> 3.0.0)
104
+ rspec-core (3.0.3)
105
+ rspec-support (~> 3.0.0)
106
+ rspec-expectations (3.0.3)
107
+ diff-lcs (>= 1.2.0, < 2.0)
108
+ rspec-support (~> 3.0.0)
109
+ rspec-mocks (3.0.3)
110
+ rspec-support (~> 3.0.0)
111
+ rspec-support (3.0.3)
112
+ ruby2ruby (2.1.1)
113
+ ruby_parser (~> 3.1)
114
+ sexp_processor (~> 4.0)
115
+ ruby_parser (3.6.2)
116
+ sexp_processor (~> 4.1)
117
+ sexp_processor (4.4.3)
118
+ slop (3.6.0)
119
+ thor (0.19.1)
120
+ thread_safe (0.3.4)
121
+ timers (1.1.0)
72
122
 
73
123
  PLATFORMS
74
124
  ruby
@@ -83,5 +133,4 @@ DEPENDENCIES
83
133
  jeweler
84
134
  libnotify
85
135
  reek
86
- rspec
87
- ruby-debug19
136
+ rspec (~> 3.0.0)
data/Rakefile CHANGED
@@ -44,13 +44,3 @@ Reek::Rake::Task.new do |t|
44
44
  end
45
45
 
46
46
  task :default => :spec
47
-
48
- require 'rake/rdoctask'
49
- Rake::RDocTask.new do |rdoc|
50
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
-
52
- rdoc.rdoc_dir = 'rdoc'
53
- rdoc.title = "dm-rspec #{version}"
54
- rdoc.rdoc_files.include('README*')
55
- rdoc.rdoc_files.include('lib/**/*.rb')
56
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.3.0
@@ -19,7 +19,7 @@ module DataMapper
19
19
  "expected to belong to #{@parent}"
20
20
  end
21
21
 
22
- def negative_failure_message
22
+ def failure_message_when_negated
23
23
  "expected to not belong to #{@parent}"
24
24
  end
25
25
 
@@ -25,7 +25,7 @@ module DataMapper
25
25
  "expected to have many #{@children}"
26
26
  end
27
27
 
28
- def negative_failure_message
28
+ def failure_message_when_negated
29
29
  "expected to not have many #{@children}"
30
30
  end
31
31
 
@@ -16,7 +16,7 @@ module DataMapper
16
16
  "expected to have many and belong to #{@name}"
17
17
  end
18
18
 
19
- def negative_failure_message
19
+ def failure_message_when_negated
20
20
  "expected to not have many and belong to #{@name}"
21
21
  end
22
22
 
@@ -19,7 +19,7 @@ module DataMapper
19
19
  "expected to have many #{@children} through #{@broker}"
20
20
  end
21
21
 
22
- def negative_failure_message
22
+ def failure_message_when_negated
23
23
  "expected to not have many #{@children} through #{@broker}"
24
24
  end
25
25
 
@@ -18,7 +18,7 @@ module DataMapper
18
18
  "expected to have one #{@child}"
19
19
  end
20
20
 
21
- def negative_failure_message
21
+ def failure_message_when_negated
22
22
  "expected not to have one #{@child}"
23
23
  end
24
24
 
@@ -15,7 +15,7 @@ module DataMapper
15
15
  "expected to have property #{@property}"
16
16
  end
17
17
 
18
- def negative_failure_message
18
+ def failure_message_when_negated
19
19
  "expected to not have property #{@property}"
20
20
  end
21
21
 
@@ -30,7 +30,7 @@ module DataMapper
30
30
  msg
31
31
  end
32
32
 
33
- def negative_failure_message
33
+ def failure_message_when_negated
34
34
  msg = "expected to not validate #{@validation_subject} of #{@property} with #{@format.inspect}"
35
35
  msg = %Q'#{msg} and message "#{@msg}"' if @msg
36
36
  msg
@@ -19,7 +19,17 @@ module DataMapper
19
19
  true
20
20
  end
21
21
 
22
- end
22
+ def failure_message_for_presence
23
+ "expected to validate presence of #{@property}#{with_msg}"
24
+ end
25
+
26
+ def negative_failure_message
27
+ "expected to not validate presence of #{@property}#{with_msg}"
28
+ end
23
29
 
30
+ def with_msg
31
+ " with message \"#{@msg}\"" if @msg
32
+ end
33
+ end
24
34
  end
25
35
  end
@@ -32,7 +32,7 @@ module DataMapper
32
32
  msg
33
33
  end
34
34
 
35
- def negative_failure_message
35
+ def failure_message_when_negated
36
36
  msg = "expected to not validate #{@validation_subject} of #{@property}"
37
37
  msg = %Q'#{msg} with message "#{@msg}"' if @msg
38
38
  msg
@@ -4,23 +4,23 @@ require 'spec_helper'
4
4
  describe DataMapper::Matchers::BelongTo do
5
5
  context '#should' do
6
6
  it 'passes if association exists' do
7
- lambda { Book.should belong_to :author }.should_pass
7
+ lambda { expect(Book).to belong_to :author }.should_pass
8
8
  end
9
9
 
10
10
  it 'fails if association does not exist' do
11
- lambda { Book.should belong_to :bad_relation}.should fail_with "expected to belong to bad_relation"
11
+ expect { expect(Book).to belong_to :bad_relation}.to fail_with "expected to belong to bad_relation"
12
12
  end
13
13
  end
14
14
 
15
15
  context '#should_not' do
16
16
  it 'fails if association exists' do
17
- lambda { Book.should_not belong_to :author }.should fail_with "expected to not belong to author"
17
+ expect { expect(Book).not_to belong_to :author }.to fail_with "expected to not belong to author"
18
18
  end
19
19
  end
20
20
 
21
21
  context 'instance of model' do
22
22
  it "should pass" do
23
- lambda{ Book.new.should belong_to :author}.should_pass
23
+ lambda{ expect(Book.new).to belong_to :author}.should_pass
24
24
  end
25
25
  end
26
26
 
@@ -11,20 +11,20 @@ describe 'have errors_on' do
11
11
 
12
12
  context '#should' do
13
13
  it 'passes' do
14
- lambda {@one_err.should have(1).error_on :name}.should_pass
15
- lambda {@two_errs.should have(2).errors_on :name}.should_pass
16
- lambda {@valid.should have(0).errors_on :name}.should_pass
14
+ lambda {expect((@one_err.error_on :name).size).to eq(1)}.should_pass
15
+ lambda {expect((@two_errs.errors_on :name).size).to eq(2)}.should_pass
16
+ lambda {expect((@valid.errors_on :name).size).to eq(0)}.should_pass
17
17
  end
18
18
 
19
19
  it 'fails for valid mode' do
20
- lambda {@valid.should have(1).errors_on :name}.should fail
20
+ expect {expect(@valid.errors_on :name.size).to eq(1)}.to fail
21
21
  end
22
22
  end
23
23
 
24
24
  context '#should_not' do
25
25
  it 'fails for invalid model' do
26
- lambda {@one_err.should_not have(1).error_on :name}.should fail
27
- lambda {@two_errs.should_not have(2).errors_on :name}.should fail
26
+ expect {expect((@one_err.error_on :name).size).not_to eq(1)}.to fail
27
+ expect {expect((@two_errs.errors_on :name).size).not_to eq(2)}.to fail
28
28
  end
29
29
  end
30
30
  end
@@ -4,25 +4,25 @@ require 'spec_helper'
4
4
  describe DataMapper::Matchers::HaveManyAndBelongTo do
5
5
  context '#should' do
6
6
  it 'passes if association exists' do
7
- lambda { Book.should have_many_and_belong_to :genres}.should_pass
7
+ lambda { expect(Book).to have_many_and_belong_to :genres}.should_pass
8
8
  end
9
9
 
10
10
  it 'fails if association does not exist' do
11
- lambda { Book.should have_many_and_belong_to :authors}.
12
- should fail_with "expected to have many and belong to authors"
11
+ expect { expect(Book).to have_many_and_belong_to :authors}.
12
+ to fail_with "expected to have many and belong to authors"
13
13
  end
14
14
  end
15
15
 
16
16
  context '#should_not' do
17
17
  it 'fails if association exists' do
18
- lambda { Genre.should_not have_many_and_belong_to :books}.
19
- should fail_with "expected to not have many and belong to books"
18
+ expect { expect(Genre).not_to have_many_and_belong_to :books}.
19
+ to fail_with "expected to not have many and belong to books"
20
20
  end
21
21
  end
22
22
 
23
23
  context 'instance of model' do
24
24
  it "should pass" do
25
- lambda{ Book.new.should have_many_and_belong_to :genres}.should_pass
25
+ lambda{ expect(Book.new).to have_many_and_belong_to :genres}.should_pass
26
26
  end
27
27
  end
28
28
  end
@@ -4,23 +4,23 @@ require 'spec_helper'
4
4
  describe DataMapper::Matchers::HaveMany do
5
5
  context '#should' do
6
6
  it 'passes if association exists' do
7
- lambda { Author.should have_many :books}.should_pass
7
+ lambda { expect(Author).to have_many :books}.should_pass
8
8
  end
9
9
 
10
10
  it 'fails if association does not exist' do
11
- lambda { Author.should have_many :bad_relations}.should fail_with "expected to have many bad_relations"
11
+ expect { expect(Author).to have_many :bad_relations}.to fail_with "expected to have many bad_relations"
12
12
  end
13
13
  end
14
14
 
15
15
  context '#should_not' do
16
16
  it 'fails if association exists' do
17
- lambda { Author.should_not have_many :books}.should fail_with "expected to not have many books"
17
+ expect { expect(Author).not_to have_many :books}.to fail_with "expected to not have many books"
18
18
  end
19
19
  end
20
20
 
21
21
  context 'instance of model' do
22
22
  it "should pass" do
23
- lambda { Author.new.should have_many :books }.should_pass
23
+ lambda { expect(Author.new).to have_many :books }.should_pass
24
24
  end
25
25
  end
26
26
  end
@@ -4,24 +4,24 @@ require 'spec_helper'
4
4
  describe DataMapper::Matchers::HaveManyThrough do
5
5
  context '#should' do
6
6
  it 'passes if association exists' do
7
- lambda { Book.should have_many(:tags).through(:taggings) }.should_pass
7
+ lambda { expect(Book).to have_many(:tags).through(:taggings) }.should_pass
8
8
  end
9
9
 
10
10
  it 'fails if association does not exist' do
11
- lambda { Author.should have_many(:books).through(:something) }.should fail_with "expected to have many books through something"
12
- lambda { Book.should have_many(:tags).through(:author) }.should fail_with "expected to have many tags through author"
11
+ expect { expect(Author).to have_many(:books).through(:something) }.to fail_with "expected to have many books through something"
12
+ expect { expect(Book).to have_many(:tags).through(:author) }.to fail_with "expected to have many tags through author"
13
13
  end
14
14
  end
15
15
 
16
16
  context '#should_not' do
17
17
  it 'fails if association exists' do
18
- lambda { Book.should_not have_many(:tags).through(:taggings) }.should fail_with "expected to not have many tags through taggings"
18
+ expect { expect(Book).not_to have_many(:tags).through(:taggings) }.to fail_with "expected to not have many tags through taggings"
19
19
  end
20
20
  end
21
21
 
22
22
  context 'instance of model' do
23
23
  it "should pass" do
24
- lambda{ Book.new.should have_many(:tags).through(:taggings)}.should_pass
24
+ lambda{ expect(Book.new).to have_many(:tags).through(:taggings)}.should_pass
25
25
  end
26
26
  end
27
27
  end
@@ -3,23 +3,23 @@ require 'spec_helper'
3
3
  describe DataMapper::Matchers::HaveOne do
4
4
  context '#should' do
5
5
  it 'passes if association exists' do
6
- lambda { Book.should have_one :foreword}.should_pass
6
+ lambda { expect(Book).to have_one :foreword}.should_pass
7
7
  end
8
8
 
9
9
  it 'fails if association does not exist' do
10
- lambda { Author.should have_one :book}.should fail_with "expected to have one book"
10
+ expect { expect(Author).to have_one :book}.to fail_with "expected to have one book"
11
11
  end
12
12
  end
13
13
 
14
14
  context '#should_not' do
15
15
  it 'fails if association exists' do
16
- lambda { Book.should_not have_one :foreword}.should fail_with "expected not to have one foreword"
16
+ expect { expect(Book).not_to have_one :foreword}.to fail_with "expected not to have one foreword"
17
17
  end
18
18
  end
19
19
 
20
20
  context 'instance of model' do
21
21
  it 'should pass' do
22
- lambda { Book.new.should have_one :foreword}.should_pass
22
+ lambda { expect(Book.new).to have_one :foreword}.should_pass
23
23
  end
24
24
  end
25
25
  end
@@ -4,23 +4,23 @@ require 'spec_helper'
4
4
  describe DataMapper::Matchers::HaveProperty do
5
5
  context '#should' do
6
6
  it 'passes if property exists' do
7
- lambda {Book.should have_property :name}.should_pass
7
+ lambda {expect(Book).to have_property :name}.should_pass
8
8
  end
9
9
 
10
10
  it 'fails if property does not exist' do
11
- lambda {Book.should have_property :bad_property}.should fail_with "expected to have property bad_property"
11
+ expect {expect(Book).to have_property :bad_property}.to fail_with "expected to have property bad_property"
12
12
  end
13
13
  end
14
14
 
15
15
  context '#should_not' do
16
16
  it 'fails if property exists' do
17
- lambda {Book.should_not have_property :name}.should fail_with "expected to not have property name"
17
+ expect {expect(Book).not_to have_property :name}.to fail_with "expected to not have property name"
18
18
  end
19
19
  end
20
20
 
21
21
  context 'instance of model' do
22
22
  it "should pass" do
23
- lambda{ Book.new.should have_property :name}.should_pass
23
+ lambda{ expect(Book.new).to have_property :name}.should_pass
24
24
  end
25
25
  end
26
26
  end
@@ -5,19 +5,19 @@ describe 'validate_format_of' do
5
5
  context 'without message' do
6
6
  context '#should 'do
7
7
  it 'passes if validatation exists' do
8
- lambda { Tag.should validate_format_of(:name).with(/\w+/) }.should_pass
8
+ lambda { expect(Tag).to validate_format_of(:name).with(/\w+/) }.should_pass
9
9
  end
10
10
 
11
11
  it 'fails if validation does not exist' do
12
- lambda { Tag.should validate_format_of(:id).with(/\w+/) }.
13
- should fail_with 'expected to validate format of id with /\w+/'
12
+ expect { expect(Tag).to validate_format_of(:id).with(/\w+/) }.
13
+ to fail_with 'expected to validate format of id with /\w+/'
14
14
  end
15
15
  end
16
16
 
17
17
  context '#should_not' do
18
18
  it 'fails if validation exists' do
19
- lambda { Tag.should_not validate_format_of(:name).with(/\w+/) }.
20
- should fail_with 'expected to not validate format of name with /\w+/'
19
+ expect { expect(Tag).not_to validate_format_of(:name).with(/\w+/) }.
20
+ to fail_with 'expected to not validate format of name with /\w+/'
21
21
  end
22
22
  end
23
23
  end
@@ -27,30 +27,30 @@ describe 'validate_format_of' do
27
27
  context 'with message' do
28
28
  context '#should' do
29
29
  it 'passes if messages are the same' do
30
- lambda{ Genre.should validate_format_of(:name).with(/\w+/).
30
+ lambda{ expect(Genre).to validate_format_of(:name).with(/\w+/).
31
31
  with_message('Bad format of genre')
32
32
  }.should_pass
33
33
  end
34
34
 
35
35
  it 'fails if messages are different' do
36
- lambda{ Genre.should validate_format_of(:name).with(/\w+/).
36
+ expect{ expect(Genre).to validate_format_of(:name).with(/\w+/).
37
37
  with_message('Different message')
38
- }.should fail_with 'expected to validate format of name with /\w+/ and message "Different message"'
38
+ }.to fail_with 'expected to validate format of name with /\w+/ and message "Different message"'
39
39
  end
40
40
  end
41
41
 
42
42
  context '#should_not' do
43
43
  it 'fails if validation message exists and it is the same' do
44
- lambda{ Genre.should_not validate_format_of(:name).with(/\w+/).
44
+ expect{ expect(Genre).not_to validate_format_of(:name).with(/\w+/).
45
45
  with_message('Bad format of genre')
46
- }.should fail_with 'expected to not validate format of name with /\w+/ and message "Bad format of genre"'
46
+ }.to fail_with 'expected to not validate format of name with /\w+/ and message "Bad format of genre"'
47
47
  end
48
48
  end
49
49
  end
50
50
 
51
51
  context 'instance of model' do
52
52
  it 'should pass' do
53
- lambda { Tag.new.should validate_format_of(:name).with(/\w+/) }.should_pass
53
+ lambda { expect(Tag.new).to validate_format_of(:name).with(/\w+/) }.should_pass
54
54
  end
55
55
  end
56
56
  end
@@ -3,48 +3,48 @@ require 'spec_helper'
3
3
  describe 'validate_length_of' do
4
4
  context '#should' do
5
5
  it 'validates length' do
6
- lambda { Publisher.should validate_length_of(:name).length(128) }.should_pass
7
- lambda { Publisher.should validate_length_of(:name).length(129) }.should_fail
6
+ lambda { expect(Publisher).to validate_length_of(:name).length(128) }.should_pass
7
+ lambda { expect(Publisher).to validate_length_of(:name).length(129) }.should_fail
8
8
  end
9
9
  it 'validates maximum' do
10
- lambda { Publisher.should validate_length_of(:name).maximum(128) }.should_pass
11
- lambda { Publisher.should validate_length_of(:name).maximum(129) }.should_fail
10
+ lambda { expect(Publisher).to validate_length_of(:name).maximum(128) }.should_pass
11
+ lambda { expect(Publisher).to validate_length_of(:name).maximum(129) }.should_fail
12
12
 
13
- lambda { Publisher.should validate_length_of(:address).maximum(2000) }.should_pass
14
- lambda { Publisher.should validate_length_of(:address).maximum(1024) }.should_fail
13
+ lambda { expect(Publisher).to validate_length_of(:address).maximum(2000) }.should_pass
14
+ lambda { expect(Publisher).to validate_length_of(:address).maximum(1024) }.should_fail
15
15
  end
16
16
  it 'validates max' do
17
- lambda { Publisher.should validate_length_of(:name).max(128) }.should_pass
18
- lambda { Publisher.should validate_length_of(:name).max(129) }.should_fail
17
+ lambda { expect(Publisher).to validate_length_of(:name).max(128) }.should_pass
18
+ lambda { expect(Publisher).to validate_length_of(:name).max(129) }.should_fail
19
19
  end
20
20
 
21
21
  it 'validates minimum' do
22
- lambda { Publisher.should validate_length_of(:city).minimum(2) }.should_pass
23
- lambda { Publisher.should validate_length_of(:city).minimum(3) }.should_fail
22
+ lambda { expect(Publisher).to validate_length_of(:city).minimum(2) }.should_pass
23
+ lambda { expect(Publisher).to validate_length_of(:city).minimum(3) }.should_fail
24
24
  end
25
25
  it 'validates min' do
26
- lambda { Publisher.should validate_length_of(:city).min(2) }.should_pass
27
- lambda { Publisher.should validate_length_of(:city).min(1) }.should_fail
26
+ lambda { expect(Publisher).to validate_length_of(:city).min(2) }.should_pass
27
+ lambda { expect(Publisher).to validate_length_of(:city).min(1) }.should_fail
28
28
  end
29
29
 
30
30
  it 'validates within' do
31
- lambda { Publisher.should validate_length_of(:phone).within(5..15) }.should_pass
32
- lambda { Publisher.should validate_length_of(:phone).within(4..15) }.should_fail
33
- lambda { Publisher.should validate_length_of(:phone).within(5..14) }.should_fail
34
- lambda { Publisher.should validate_length_of(:phone).within(5) }.should_fail
31
+ lambda { expect(Publisher).to validate_length_of(:phone).within(5..15) }.should_pass
32
+ lambda { expect(Publisher).to validate_length_of(:phone).within(4..15) }.should_fail
33
+ lambda { expect(Publisher).to validate_length_of(:phone).within(5..14) }.should_fail
34
+ lambda { expect(Publisher).to validate_length_of(:phone).within(5) }.should_fail
35
35
  end
36
36
  it 'validates in' do
37
- lambda { Publisher.should validate_length_of(:phone).in(5..15) }.should_pass
38
- lambda { Publisher.should validate_length_of(:phone).in(4..16) }.should_fail
37
+ lambda { expect(Publisher).to validate_length_of(:phone).in(5..15) }.should_pass
38
+ lambda { expect(Publisher).to validate_length_of(:phone).in(4..16) }.should_fail
39
39
  end
40
40
 
41
41
  it 'validates equals' do
42
- lambda { Publisher.should validate_length_of(:zip).equals(6) }.should_pass
43
- lambda { Publisher.should validate_length_of(:zip).equals(7) }.should_fail
42
+ lambda { expect(Publisher).to validate_length_of(:zip).equals(6) }.should_pass
43
+ lambda { expect(Publisher).to validate_length_of(:zip).equals(7) }.should_fail
44
44
  end
45
45
  it 'validates is' do
46
- lambda { Publisher.should validate_length_of(:zip).is(6) }.should_pass
47
- lambda { Publisher.should validate_length_of(:zip).is(7) }.should_fail
46
+ lambda { expect(Publisher).to validate_length_of(:zip).is(6) }.should_pass
47
+ lambda { expect(Publisher).to validate_length_of(:zip).is(7) }.should_fail
48
48
  end
49
49
  end
50
50
  end
@@ -5,19 +5,19 @@ describe 'validate_presence_of' do
5
5
  context "without message" do
6
6
  context '#should' do
7
7
  it 'passes if validation exists' do
8
- lambda{ Person.should validate_presence_of :last_name}.should_pass
8
+ lambda{ expect(Person).to validate_presence_of :last_name}.should_pass
9
9
  end
10
10
 
11
11
  it 'fails if validation does not exist' do
12
- lambda{ Person.should validate_presence_of :age}.
13
- should fail_with "expected to validate presence of age"
12
+ expect{ expect(Person).to validate_presence_of :age}.
13
+ to fail_with "expected to validate presence of age"
14
14
  end
15
15
  end
16
16
 
17
17
  context '#should_not' do
18
18
  it 'fails if validation exists' do
19
- lambda{ Person.should_not validate_presence_of :last_name}.
20
- should fail_with "expected to not validate presence of last_name"
19
+ expect{ expect(Person).not_to validate_presence_of :last_name}.
20
+ to fail_with "expected to not validate presence of last_name"
21
21
  end
22
22
  end
23
23
  end
@@ -26,30 +26,30 @@ describe 'validate_presence_of' do
26
26
  context 'with message' do
27
27
  context '#should' do
28
28
  it 'passes if messages are the same' do
29
- lambda{ Person.should validate_presence_of(:first_name).
29
+ lambda{ expect(Person).to validate_presence_of(:first_name).
30
30
  with_message('Where is the first name?')
31
31
  }.should_pass
32
32
  end
33
33
 
34
34
  it 'fails if messages are different' do
35
- lambda{ Person.should validate_presence_of(:first_name).
35
+ expect{ expect(Person).to validate_presence_of(:first_name).
36
36
  with_message('Different message')
37
- }.should fail_with 'expected to validate presence of first_name with message "Different message"'
37
+ }.to fail_with 'expected to validate presence of first_name with message "Different message"'
38
38
  end
39
39
  end
40
40
 
41
41
  context '#should_not' do
42
42
  it 'fails if validation message exists' do
43
- lambda{ Person.should_not validate_presence_of(:first_name).
43
+ expect{ expect(Person).not_to validate_presence_of(:first_name).
44
44
  with_message('Where is the first name?')
45
- }.should fail_with 'expected to not validate presence of first_name with message "Where is the first name?"'
45
+ }.to fail_with 'expected to not validate presence of first_name with message "Where is the first name?"'
46
46
  end
47
47
  end
48
48
  end
49
49
 
50
50
  context 'instance of model' do
51
51
  it "should pass" do
52
- lambda{ Person.new.should validate_presence_of :last_name}.should_pass
52
+ lambda{ expect(Person.new).to validate_presence_of :last_name}.should_pass
53
53
  end
54
54
  end
55
55
  end
@@ -5,19 +5,19 @@ describe 'validate_uniqueness_of' do
5
5
  context 'without message' do
6
6
  context '#should 'do
7
7
  it 'passes if validatation exists' do
8
- lambda { Author.should validate_uniqueness_of :last_name}.should_pass
8
+ lambda { expect(Author).to validate_uniqueness_of :last_name}.should_pass
9
9
  end
10
10
 
11
11
  it 'fails if validation does not exist' do
12
- lambda { Author.should validate_uniqueness_of :first_name}.
13
- should fail_with "expected to validate uniqueness of first_name"
12
+ expect { expect(Author).to validate_uniqueness_of :first_name}.
13
+ to fail_with "expected to validate uniqueness of first_name"
14
14
  end
15
15
  end
16
16
 
17
17
  context '#should_not' do
18
18
  it 'fails if validation exists' do
19
- lambda { Author.should_not validate_uniqueness_of :last_name}.
20
- should fail_with "expected to not validate uniqueness of last_name"
19
+ expect { expect(Author).not_to validate_uniqueness_of :last_name}.
20
+ to fail_with "expected to not validate uniqueness of last_name"
21
21
  end
22
22
  end
23
23
  end
@@ -27,23 +27,23 @@ describe 'validate_uniqueness_of' do
27
27
  context 'with message' do
28
28
  context '#should' do
29
29
  it 'passes if messages are the same' do
30
- lambda{ Genre.should validate_uniqueness_of(:name).
30
+ lambda{ expect(Genre).to validate_uniqueness_of(:name).
31
31
  with_message('Genre name must be unique!')
32
32
  }.should_pass
33
33
  end
34
34
 
35
35
  it 'fails if messages are different' do
36
- lambda{ Genre.should validate_uniqueness_of(:name).
36
+ expect{ expect(Genre).to validate_uniqueness_of(:name).
37
37
  with_message('Different message')
38
- }.should fail_with 'expected to validate uniqueness of name with message "Different message"'
38
+ }.to fail_with 'expected to validate uniqueness of name with message "Different message"'
39
39
  end
40
40
  end
41
41
 
42
42
  context '#should_not' do
43
43
  it 'fails if validation message exists and it is the same' do
44
- lambda{ Genre.should_not validate_uniqueness_of(:name).
44
+ expect{ expect(Genre).not_to validate_uniqueness_of(:name).
45
45
  with_message('Genre name must be unique!')
46
- }.should fail_with 'expected to not validate uniqueness of name with message "Genre name must be unique!"'
46
+ }.to fail_with 'expected to not validate uniqueness of name with message "Genre name must be unique!"'
47
47
  end
48
48
  end
49
49
  end
@@ -51,7 +51,7 @@ describe 'validate_uniqueness_of' do
51
51
 
52
52
  context 'instance of model' do
53
53
  it "should pass" do
54
- lambda { Author.new.should validate_uniqueness_of :last_name}.should_pass
54
+ lambda { expect(Author.new).to validate_uniqueness_of :last_name}.should_pass
55
55
  end
56
56
  end
57
57
  end
@@ -7,6 +7,7 @@ require 'dm-migrations'
7
7
  require 'dm-sqlite-adapter'
8
8
 
9
9
  require 'dm-rspec'
10
+ require 'pry'
10
11
 
11
12
 
12
13
  DataMapper.setup(:default, "sqlite3::memory:")
@@ -34,10 +35,12 @@ end
34
35
  class Proc
35
36
  include ::RSpec::Matchers
36
37
  def should_pass
37
- lambda { self.call }.should_not raise_error
38
+ expect{ self.call }.to_not raise_error
39
+ #lambda { self.call }.should_not raise_error
38
40
  end
39
41
  def should_fail
40
- lambda { self.call }.should raise_error
42
+ expect{self.call}.to raise_error
43
+ #lambda { self.call }.should raise_error
41
44
  end
42
45
  end
43
46
 
metadata CHANGED
@@ -1,190 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Potapov Sergey
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-06 00:00:00.000000000 Z
11
+ date: 2014-08-16 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: dm-core
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: dm-validations
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
47
+ version: 3.0.0
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: '0'
54
+ version: 3.0.0
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: bundler
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: jeweler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: reek
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: guard-rspec
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - ">="
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: libnotify
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
- - !ruby/object:Gem::Dependency
143
- name: ruby-debug19
144
- requirement: !ruby/object:Gem::Requirement
145
- none: false
146
114
  requirements:
147
- - - ! '>='
115
+ - - ">="
148
116
  - !ruby/object:Gem::Version
149
117
  version: '0'
150
118
  type: :development
151
119
  prerelease: false
152
120
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
121
  requirements:
155
- - - ! '>='
122
+ - - ">="
156
123
  - !ruby/object:Gem::Version
157
124
  version: '0'
158
125
  - !ruby/object:Gem::Dependency
159
126
  name: dm-migrations
160
127
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
128
  requirements:
163
- - - ! '>='
129
+ - - ">="
164
130
  - !ruby/object:Gem::Version
165
131
  version: '0'
166
132
  type: :development
167
133
  prerelease: false
168
134
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
135
  requirements:
171
- - - ! '>='
136
+ - - ">="
172
137
  - !ruby/object:Gem::Version
173
138
  version: '0'
174
139
  - !ruby/object:Gem::Dependency
175
140
  name: dm-sqlite-adapter
176
141
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
142
  requirements:
179
- - - ! '>='
143
+ - - ">="
180
144
  - !ruby/object:Gem::Version
181
145
  version: '0'
182
146
  type: :development
183
147
  prerelease: false
184
148
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
149
  requirements:
187
- - - ! '>='
150
+ - - ">="
188
151
  - !ruby/object:Gem::Version
189
152
  version: '0'
190
153
  description: RSpec matchers for DataMapper
@@ -194,7 +157,7 @@ extensions: []
194
157
  extra_rdoc_files:
195
158
  - README.markdown
196
159
  files:
197
- - .rspec
160
+ - ".rspec"
198
161
  - CHANGELOG.markdown
199
162
  - Gemfile
200
163
  - Gemfile.lock
@@ -232,26 +195,26 @@ files:
232
195
  homepage: http://github.com/greyblake/dm-rspec
233
196
  licenses:
234
197
  - MIT
198
+ metadata: {}
235
199
  post_install_message:
236
200
  rdoc_options: []
237
201
  require_paths:
238
202
  - lib
239
203
  required_ruby_version: !ruby/object:Gem::Requirement
240
- none: false
241
204
  requirements:
242
- - - ! '>='
205
+ - - ">="
243
206
  - !ruby/object:Gem::Version
244
207
  version: '0'
245
208
  required_rubygems_version: !ruby/object:Gem::Requirement
246
- none: false
247
209
  requirements:
248
- - - ! '>='
210
+ - - ">="
249
211
  - !ruby/object:Gem::Version
250
212
  version: '0'
251
213
  requirements: []
252
214
  rubyforge_project:
253
- rubygems_version: 1.8.24
215
+ rubygems_version: 2.2.2
254
216
  signing_key:
255
- specification_version: 3
217
+ specification_version: 4
256
218
  summary: It's a set of matchers for DataMapper. Something similar to rspec-rails gem.
257
219
  test_files: []
220
+ has_rdoc: