poly_belongs_to 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/test/pbt_test.rb CHANGED
@@ -43,36 +43,40 @@ class PbtTest < ActiveSupport::TestCase
43
43
 
44
44
  it "SingularOrPlural responds for child relations" do
45
45
  profile = profiles(:susan_prof)
46
- PolyBelongsTo::Pbt::SingularOrPlural[profile,Phone].must_equal :plural
47
- PolyBelongsTo::Pbt::SingularOrPlural[profile,Photo].must_equal :singular
48
- PolyBelongsTo::Pbt::SingularOrPlural[profile, User].must_be_nil
49
- PolyBelongsTo::Pbt::SingularOrPlural[nil, User].must_be_nil
50
- PolyBelongsTo::Pbt::SingularOrPlural[profile, nil].must_be_nil
46
+ PolyBelongsTo::Pbt::SingularOrPlural[profile, Phone].must_equal :plural
47
+ PolyBelongsTo::Pbt::SingularOrPlural[Alpha.new, Beta].must_equal :plural
48
+ PolyBelongsTo::Pbt::SingularOrPlural[profile, Photo].must_equal :singular
49
+ PolyBelongsTo::Pbt::SingularOrPlural[profile, User].must_be_nil
50
+ PolyBelongsTo::Pbt::SingularOrPlural[nil, User].must_be_nil
51
+ PolyBelongsTo::Pbt::SingularOrPlural[profile, nil].must_be_nil
51
52
  end
52
53
 
53
54
  it "IsSingular tells child singleness" do
54
55
  profile = profiles(:steve_prof)
55
- PolyBelongsTo::Pbt::IsSingular[profile,Phone].must_be_same_as false
56
- PolyBelongsTo::Pbt::IsSingular[nil, Phone].must_be_same_as false
57
- PolyBelongsTo::Pbt::IsSingular[profile, nil].must_be_same_as false
58
- PolyBelongsTo::Pbt::IsSingular[profile,Photo].must_be_same_as true
56
+ PolyBelongsTo::Pbt::IsSingular[profile, Phone].must_be_same_as false
57
+ PolyBelongsTo::Pbt::IsSingular[nil, Phone].must_be_same_as false
58
+ PolyBelongsTo::Pbt::IsSingular[profile, nil].must_be_same_as false
59
+ PolyBelongsTo::Pbt::IsSingular[Alpha.new, Beta].must_be_same_as false
60
+ PolyBelongsTo::Pbt::IsSingular[profile, Photo].must_be_same_as true
59
61
  end
60
62
 
61
63
  it "IsPlural tells child pluralness" do
62
64
  profile = profiles(:bob_prof)
63
- PolyBelongsTo::Pbt::IsPlural[profile,Phone].must_be_same_as true
64
- PolyBelongsTo::Pbt::IsPlural[profile,Photo].must_be_same_as false
65
- PolyBelongsTo::Pbt::IsPlural[nil, Photo].must_be_same_as false
66
- PolyBelongsTo::Pbt::IsPlural[profile, nil].must_be_same_as false
65
+ PolyBelongsTo::Pbt::IsPlural[profile, Phone].must_be_same_as true
66
+ PolyBelongsTo::Pbt::IsPlural[Alpha.new, Beta].must_be_same_as true
67
+ PolyBelongsTo::Pbt::IsPlural[profile, Photo].must_be_same_as false
68
+ PolyBelongsTo::Pbt::IsPlural[nil, Photo].must_be_same_as false
69
+ PolyBelongsTo::Pbt::IsPlural[profile, nil].must_be_same_as false
67
70
  end
68
71
 
69
72
  it "CollectionProxy singular or plural proxy name" do
70
73
  profile = profiles(:steve_prof)
71
- PolyBelongsTo::Pbt::CollectionProxy[profile,Phone].must_equal :phones
72
- PolyBelongsTo::Pbt::CollectionProxy[profile,Photo].must_equal :photo
73
- PolyBelongsTo::Pbt::CollectionProxy[profile, User].must_be_nil
74
- PolyBelongsTo::Pbt::CollectionProxy[nil, User].must_be_nil
75
- PolyBelongsTo::Pbt::CollectionProxy[profile, nil].must_be_nil
74
+ PolyBelongsTo::Pbt::CollectionProxy[profile, Phone].must_equal :phones
75
+ PolyBelongsTo::Pbt::CollectionProxy[profile, Photo].must_equal :photo
76
+ PolyBelongsTo::Pbt::CollectionProxy[Alpha.new, Beta].must_equal :betas
77
+ PolyBelongsTo::Pbt::CollectionProxy[profile, User].must_be_nil
78
+ PolyBelongsTo::Pbt::CollectionProxy[nil, User].must_be_nil
79
+ PolyBelongsTo::Pbt::CollectionProxy[profile, nil].must_be_nil
76
80
  end
77
81
 
78
82
  it "AsCollectionProxy has_one emulated collectionproxy" do
@@ -16,11 +16,11 @@ class DupTest < ActiveSupport::TestCase
16
16
  the_set.add?(example)
17
17
  the_set.to_a.must_equal ["#{example.class.name}-#{example.id}"]
18
18
  end
19
- it "adds with :add" do
19
+ it "adds with :add :: DEPRECATED (reverting behavior in 0.2.0)" do
20
20
  the_set.add(example)
21
21
  the_set.to_a.must_equal ["#{example.class.name}-#{example.id}"]
22
22
  end
23
- it "adds with :<<" do
23
+ it "adds with :<< :: DEPRECATED (reverting behavior in 0.2.0)" do
24
24
  the_set.<<(example)
25
25
  the_set.to_a.must_equal ["#{example.class.name}-#{example.id}"]
26
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poly_belongs_to
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel P. Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails