rspec-virtus 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +6 -1
- data/lib/rspec-virtus/matcher.rb +5 -1
- data/lib/rspec-virtus/version.rb +1 -1
- data/spec/acceptance/rspec-virtus_spec.rb +16 -0
- data/spec/lib/rspec-virtus/matcher_spec.rb +12 -4
- metadata +16 -14
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MjljYmQzOWMyNDJiZGIyYTJjMTRjMDVmODUyNWNmZmNjMzYxZTI2Zg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 883f1137a0ec996f85b2f5ccdcf4e8c3ef3049cf
|
4
|
+
data.tar.gz: db63efb1338e2c7fd57bfffca7e87d207c3817a2
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
N2FlMTZhNzI0ZGM0MjI0ODMwY2FjYTI5NmY3NmUxYTAyYzRlMzc3ZmRkODM0
|
11
|
-
NDhkN2NjNWE0N2E5MWE5MjE2ZDNjMGU2MGMzZWQ0YzY4MTNmMmE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YmRjNzlhMzA5NjA2NzczNjQ1ZjU3Zjk0OTYzMmMyYjU0MDBmMzM1YjRkMThh
|
14
|
-
MmY0MmMzYjMyYWI5NWM1ZTUyOTA5NzU1NGM1MTYwNDY4ZTY4MDA2NDMyMjQz
|
15
|
-
OWMzMmQ0YjhmZDI1NmFlMDdkNWJkNjk1MTYxY2RlNDA1YjI1ZjI=
|
6
|
+
metadata.gz: 1c88e44c008f628eada53f059eaeb1c30e3de9e8d55e78254826ced3f075a9947f6366ea53c41cb3a867466bfdd9199b89c257d3657d203fc6938e2e7dc66215
|
7
|
+
data.tar.gz: eb76dcfbb990072ba90afc2b35cc0431de1ddae58e456a99216fbc6c8e59cf9df9fc6068bd01aa99b2a18f0a25e42bdf303c991dfb2d52202ff072baafd32ee5
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
|
|
21
21
|
Here is a sample Virtus object
|
22
22
|
|
23
23
|
class Post
|
24
|
-
include Virtus
|
24
|
+
include Virtus.model
|
25
25
|
attribute :title, String
|
26
26
|
attribute :body, String
|
27
27
|
attribute :comments, Array[String]
|
@@ -57,5 +57,10 @@ And with `rspec-virtus` we can now make simple assertions about these models
|
|
57
57
|
|
58
58
|
## Changelog
|
59
59
|
|
60
|
+
- Version 1.0.1
|
61
|
+
- Remove deprecation notices about legacy matcher syntax
|
62
|
+
- Add description to match RSpec 3 matchers
|
60
63
|
- Version 1.0.0
|
61
64
|
- Upgrade syntax to work with Virtus 1.0.x
|
65
|
+
- Version 0.2.0
|
66
|
+
- Upgrade to RSpec 3.0
|
data/lib/rspec-virtus/matcher.rb
CHANGED
@@ -6,6 +6,10 @@ module RSpec
|
|
6
6
|
@options = {}
|
7
7
|
end
|
8
8
|
|
9
|
+
def description
|
10
|
+
"have #{@attribute_name} defined"
|
11
|
+
end
|
12
|
+
|
9
13
|
def of_type(type, options={})
|
10
14
|
@options[:type] = type
|
11
15
|
@options[:member_type] = options.delete(:member_type)
|
@@ -21,7 +25,7 @@ module RSpec
|
|
21
25
|
"expected #{@attribute_name} to be defined"
|
22
26
|
end
|
23
27
|
|
24
|
-
def
|
28
|
+
def failure_message_when_negated
|
25
29
|
"expected #{@attribute_name} not to be defined"
|
26
30
|
end
|
27
31
|
|
data/lib/rspec-virtus/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "virtus"
|
3
|
+
|
4
|
+
class DummyPost
|
5
|
+
include Virtus.model
|
6
|
+
|
7
|
+
attribute :title, String
|
8
|
+
attribute :body, String
|
9
|
+
attribute :comments, Array[String]
|
10
|
+
end
|
11
|
+
|
12
|
+
describe DummyPost do
|
13
|
+
it { expect(described_class).to have_attribute(:title) }
|
14
|
+
it { expect(described_class).to have_attribute(:body).of_type(String) }
|
15
|
+
it { expect(described_class).to have_attribute(:comments).of_type(Array, member_type: String) }
|
16
|
+
end
|
@@ -6,7 +6,7 @@ describe RSpec::Virtus::Matcher do
|
|
6
6
|
let(:attribute_name) { :the_attribute }
|
7
7
|
|
8
8
|
class DummyVirtus
|
9
|
-
include Virtus
|
9
|
+
include Virtus.model
|
10
10
|
|
11
11
|
attribute :the_attribute, String
|
12
12
|
attribute :the_array_attribute, Array[String]
|
@@ -94,16 +94,24 @@ describe RSpec::Virtus::Matcher do
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
+
describe '#description' do
|
98
|
+
subject { instance.description }
|
99
|
+
|
100
|
+
it 'tells you which attribute we are testing' do
|
101
|
+
expect(subject).to include(attribute_name.to_s)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
97
105
|
describe '#failure_message' do
|
98
|
-
subject { instance.
|
106
|
+
subject { instance.failure_message }
|
99
107
|
|
100
108
|
it 'tells you which attribute failed' do
|
101
109
|
expect(subject).to include(attribute_name.to_s)
|
102
110
|
end
|
103
111
|
end
|
104
112
|
|
105
|
-
describe '#
|
106
|
-
subject { instance.
|
113
|
+
describe '#failure_message_when_negated' do
|
114
|
+
subject { instance.failure_message_when_negated }
|
107
115
|
|
108
116
|
it 'tells you which attribute failed' do
|
109
117
|
expect(subject).to include(attribute_name.to_s)
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-virtus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: virtus
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 10.0.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 10.0.0
|
55
55
|
description: Simple RSpec matchers for Virtus objects
|
@@ -59,10 +59,10 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .rspec
|
64
|
-
- .ruby-version
|
65
|
-
- .travis.yml
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".ruby-version"
|
65
|
+
- ".travis.yml"
|
66
66
|
- Gemfile
|
67
67
|
- LICENSE.txt
|
68
68
|
- README.md
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/rspec-virtus/matcher.rb
|
72
72
|
- lib/rspec-virtus/version.rb
|
73
73
|
- rspec-virtus.gemspec
|
74
|
+
- spec/acceptance/rspec-virtus_spec.rb
|
74
75
|
- spec/lib/rspec-virtus/matcher_spec.rb
|
75
76
|
- spec/lib/rspec-virtus_spec.rb
|
76
77
|
- spec/spec_helper.rb
|
@@ -83,12 +84,12 @@ require_paths:
|
|
83
84
|
- lib
|
84
85
|
required_ruby_version: !ruby/object:Gem::Requirement
|
85
86
|
requirements:
|
86
|
-
- -
|
87
|
+
- - ">="
|
87
88
|
- !ruby/object:Gem::Version
|
88
89
|
version: '0'
|
89
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
91
|
requirements:
|
91
|
-
- -
|
92
|
+
- - ">="
|
92
93
|
- !ruby/object:Gem::Version
|
93
94
|
version: '0'
|
94
95
|
requirements: []
|
@@ -98,6 +99,7 @@ signing_key:
|
|
98
99
|
specification_version: 4
|
99
100
|
summary: Simple RSpec matchers for Virtus objects
|
100
101
|
test_files:
|
102
|
+
- spec/acceptance/rspec-virtus_spec.rb
|
101
103
|
- spec/lib/rspec-virtus/matcher_spec.rb
|
102
104
|
- spec/lib/rspec-virtus_spec.rb
|
103
105
|
- spec/spec_helper.rb
|