subroutine 0.10.0.beta5 → 0.10.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2102bfdb6fa4c740488105c36618121f713b22d807818b576903c272178a1a95
4
- data.tar.gz: 4217c7b112a82797ed1b79c65a8f4cc3468e601fe4833fa3eef35a6bc00a8071
3
+ metadata.gz: c22ca4172e9f569b15bbccae7c59dc7df49dfca43f367bd1cfcf1d771d77e6ab
4
+ data.tar.gz: 84cf68b11db90711abbf87b480a36f852673e2ed7c975404b1ffc085bd3269df
5
5
  SHA512:
6
- metadata.gz: 27fcfd3a0c4f7406586d159a1ff8e7c5673802a941f156a38228be4672d4d1da15f21c487c56ee76d0246e5b0544038dd8df313c9e079e17ea327b5043a99b64
7
- data.tar.gz: 3206ed2cbd84106e99c1c7cc797a4bb71a975b8350adc31c979ef18094cab7126f2e2d3f551cea1d80768016f3dbd88b56e6ffada8c6d0a1b15b6f23c0f384b3
6
+ metadata.gz: 780e4d568a18e6e6d19a2f92bfbd3e12cb3433e0e11a1a3986a9af7552efdcf69f546d5d95639704a4e4dbcbe8e7dfb5567ee5741d6bc8c811e35058420e3d21
7
+ data.tar.gz: 3191b5dbe495a426db558b14f5ff22ce3b2bfddd87b5fa60d9606f2b107fb57f5f1830a235982aa2d1be471308b8cde278160c5747d54a266ea90f2fe7de9123
@@ -28,7 +28,7 @@ module Subroutine
28
28
  end
29
29
 
30
30
  def class_name
31
- config[:class_name]
31
+ config[:class_name]&.to_s
32
32
  end
33
33
 
34
34
  def inferred_class_name
@@ -5,7 +5,7 @@ module Subroutine
5
5
  MAJOR = 0
6
6
  MINOR = 10
7
7
  PATCH = 0
8
- PRE = "beta5"
8
+ PRE = "beta6"
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
 
@@ -177,5 +177,15 @@ module Subroutine
177
177
  assert_equal false, op.field_provided?(:user_type)
178
178
  end
179
179
 
180
+ def test_association_class_names_can_be_declared_as_classes
181
+ klass = Class.new(OpWithAssociation) do
182
+ association :user, class_name: Account
183
+ end
184
+
185
+ account = ::Account.new(id: 1)
186
+ op = klass.new(user: account)
187
+ assert_equal account, op.user
188
+ end
189
+
180
190
  end
181
191
  end
data/test/support/ops.rb CHANGED
@@ -15,6 +15,10 @@ class User
15
15
 
16
16
  validates :email_address, presence: true
17
17
 
18
+ def self.all
19
+ self
20
+ end
21
+
18
22
  def self.find(id)
19
23
  new(id: id)
20
24
  end
@@ -33,6 +37,10 @@ class Account
33
37
 
34
38
  attr_accessor :id
35
39
 
40
+ def self.all
41
+ self
42
+ end
43
+
36
44
  def self.find(id)
37
45
  new(id: id)
38
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0.beta5
4
+ version: 0.10.0.beta6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-20 00:00:00.000000000 Z
11
+ date: 2020-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel