representable_matchers 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.travis.yml +3 -0
- data/README.md +2 -4
- data/lib/matchers/version.rb +4 -2
- data/lib/representable_matchers.rb +1 -7
- data/representable_matchers.gemspec +3 -3
- data/{lib/matchers → spec}/integrations/rspec.rb +0 -0
- data/{lib/matchers → spec}/integrations/test_unit.rb +0 -0
- data/spec/matchers/class_name_matcher_spec.rb +37 -0
- data/spec/matchers/representable_attribute_matcher_spec.rb +34 -0
- data/spec/spec_helper.rb +4 -0
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODljOTYyZDljNDE4ZWZjNzJkN2FkYzQ1MzYyMTJkY2VkN2JlYzM0NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NTljNmZmMzMzMDhhMTdiNTRmYWQwMDc1OGM1YTU3MzJmNWExOGFhZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDk4ZTViOTEzNzNmNjY4ZjVkMjEwOWYyZDExYWIwMTExMDBmMmQ4ZjU1MTNj
|
10
|
+
YTkxNGI4OTBlZTFhOWEyMTUzNzhkOGY1ZjliYjBmMjA1MzNkMzQ4YWM1NDA4
|
11
|
+
YTljYWE3OTc3MzQxMDc0M2Y5NjVhYmZhYzdmMDNjNzRhNWMyOTA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTQzMzM0OWUyN2RkM2E2ZTYwOTAxYTliYWRjZjQwZWJiNjYxOThjMTdjMWRk
|
14
|
+
OTRiYzIwZWNiMDdlZjEzZDQ4YmM4NjMwNjI1Nzk1MDUzZTk1OTEwMWNlMDMy
|
15
|
+
YzFkNDYxNzRkMmMwMTA1YWM1NDJhNWQwMGRmYjViZThlNmUwNjg=
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -21,12 +21,10 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
it { should have_representable_property(:name) }
|
24
|
-
it { should have_representable_collection(:children) }
|
25
|
-
it { should have_representable_hash(:preferences) }
|
26
24
|
|
27
|
-
With submatchers
|
25
|
+
With submatchers
|
28
26
|
|
29
|
-
it { should have_representable_property(:
|
27
|
+
it { should have_representable_property(:name).class_name("String") }
|
30
28
|
|
31
29
|
## Contributing
|
32
30
|
|
data/lib/matchers/version.rb
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
require "matchers/version"
|
2
1
|
require "matchers/class_name_matcher"
|
3
|
-
require "matchers/extension_of_matcher"
|
4
2
|
require "matchers/representable_property_matcher"
|
5
|
-
require "matchers/have_representable_property_matcher"
|
6
|
-
|
7
|
-
# bind the matchers to the test mech
|
8
|
-
require 'matchers/integrations/rspec' if defined?(RSpec)
|
9
|
-
require 'matchers/integrations/test_unit'
|
3
|
+
require "matchers/have_representable_property_matcher"
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
|
3
|
-
require '
|
3
|
+
require 'matchers/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "representable_matchers"
|
7
|
-
spec.version =
|
7
|
+
spec.version = Representable::Matchers::VERSION
|
8
8
|
spec.authors = ["Coding Zeal", "Adam Cuppy"]
|
9
9
|
spec.email = ["info@codingzeal.com"]
|
10
10
|
spec.description = %q{Shoulda-style RSpec/Test Unit matchers for the Representable Gem}
|
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
21
|
spec.add_development_dependency "rake"
|
22
|
-
spec.add_development_dependency "rspec", "~> 2.
|
22
|
+
spec.add_development_dependency "rspec", "~> 2.14.1"
|
23
23
|
spec.add_development_dependency "representable", "~> 1.7.3"
|
24
24
|
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Representable::Matchers::ClassNameMatcher do
|
4
|
+
let(:property) { :foo }
|
5
|
+
let(:class_name) { "Person" }
|
6
|
+
|
7
|
+
subject { Representable::Matchers::ClassNameMatcher.new(property, class_name) }
|
8
|
+
|
9
|
+
describe "#matches?" do
|
10
|
+
let(:subject_object) { double("subject_object") }
|
11
|
+
|
12
|
+
context "when it matches" do
|
13
|
+
before do
|
14
|
+
subject_object.stub_chain(:send, :[], :options, :[], :to_s).and_return(class_name)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "calls on the representable object for it's attributes" do
|
18
|
+
expect( subject.matches?(subject_object) ).to be_true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when it doesn't match" do
|
23
|
+
before do
|
24
|
+
subject_object.stub_chain(:send, :[], :options, :[], :to_s).and_return("Dog")
|
25
|
+
end
|
26
|
+
|
27
|
+
it "calls on the representable object for it's attributes" do
|
28
|
+
expect( subject.matches?(subject_object) ).to be_false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
its(:description) { should be_a_kind_of String }
|
35
|
+
its(:failure_message_for_should) { should be_a_kind_of String }
|
36
|
+
its(:failure_message_for_should_not) { should be_a_kind_of String }
|
37
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Representable::Matchers::RepresentablePropertyMatcher do
|
4
|
+
let(:property) { :foo }
|
5
|
+
subject { Representable::Matchers::RepresentablePropertyMatcher.new(property) }
|
6
|
+
|
7
|
+
describe "#matches?" do
|
8
|
+
let(:subject_object) { double("subject_object") }
|
9
|
+
|
10
|
+
before do
|
11
|
+
subject_object.stub_chain(:send, :[]).and_return(representable_property)
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when present" do
|
15
|
+
let(:representable_property) { double("representable_property") }
|
16
|
+
|
17
|
+
it "asserts the existance of the property" do
|
18
|
+
expect( subject.matches?(subject_object) ).to be_true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context "when nil" do
|
23
|
+
let(:representable_property) { nil }
|
24
|
+
|
25
|
+
it "asserts the existance of the property" do
|
26
|
+
expect( subject.matches?(subject_object) ).to be_false
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
its(:description) { should be_a_kind_of String }
|
32
|
+
its(:failure_message_for_should) { should be_a_kind_of String }
|
33
|
+
its(:failure_message_for_should_not) { should be_a_kind_of String }
|
34
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -7,6 +7,10 @@ require 'representable_matchers'
|
|
7
7
|
PROJECT_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')).freeze
|
8
8
|
Dir[File.join(PROJECT_ROOT, 'spec/support/**/*.rb')].each { |file| require(file) }
|
9
9
|
|
10
|
+
# bind the matchers to the test mech
|
11
|
+
require 'integrations/rspec' if defined?(RSpec)
|
12
|
+
require 'integrations/test_unit'
|
13
|
+
|
10
14
|
RSpec.configure do |c|
|
11
15
|
c.filter_run_excluding :skip_on_windows => !(RbConfig::CONFIG['host_os'] =~ /mingw32/).nil?
|
12
16
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: representable_matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coding Zeal
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 2.
|
48
|
+
version: 2.14.1
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
55
|
+
version: 2.14.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: representable
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,13 +82,15 @@ files:
|
|
82
82
|
- Rakefile
|
83
83
|
- lib/matchers/class_name_matcher.rb
|
84
84
|
- lib/matchers/have_representable_property_matcher.rb
|
85
|
-
- lib/matchers/integrations/rspec.rb
|
86
|
-
- lib/matchers/integrations/test_unit.rb
|
87
85
|
- lib/matchers/representable_property_matcher.rb
|
88
86
|
- lib/matchers/version.rb
|
89
87
|
- lib/representable_matchers.rb
|
90
88
|
- representable_matchers.gemspec
|
89
|
+
- spec/integrations/rspec.rb
|
90
|
+
- spec/integrations/test_unit.rb
|
91
|
+
- spec/matchers/class_name_matcher_spec.rb
|
91
92
|
- spec/matchers/have_representable_property_matcher_spec.rb
|
93
|
+
- spec/matchers/representable_attribute_matcher_spec.rb
|
92
94
|
- spec/spec_helper.rb
|
93
95
|
- spec/support/fake_representable.rb
|
94
96
|
homepage: https://github.com/CodingZeal/representable_matchers
|
@@ -116,6 +118,10 @@ signing_key:
|
|
116
118
|
specification_version: 4
|
117
119
|
summary: Shoulda-style RSpec/Test Unit matchers for the Representable Gem
|
118
120
|
test_files:
|
121
|
+
- spec/integrations/rspec.rb
|
122
|
+
- spec/integrations/test_unit.rb
|
123
|
+
- spec/matchers/class_name_matcher_spec.rb
|
119
124
|
- spec/matchers/have_representable_property_matcher_spec.rb
|
125
|
+
- spec/matchers/representable_attribute_matcher_spec.rb
|
120
126
|
- spec/spec_helper.rb
|
121
127
|
- spec/support/fake_representable.rb
|