subroutine 0.10.0.beta4 → 0.10.0.beta5
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 +4 -4
- data/lib/subroutine/association_fields.rb +1 -1
- data/lib/subroutine/version.rb +1 -1
- data/test/subroutine/association_test.rb +23 -0
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 2102bfdb6fa4c740488105c36618121f713b22d807818b576903c272178a1a95
         | 
| 4 | 
            +
              data.tar.gz: 4217c7b112a82797ed1b79c65a8f4cc3468e601fe4833fa3eef35a6bc00a8071
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 27fcfd3a0c4f7406586d159a1ff8e7c5673802a941f156a38228be4672d4d1da15f21c487c56ee76d0246e5b0544038dd8df313c9e079e17ea327b5043a99b64
         | 
| 7 | 
            +
              data.tar.gz: 3206ed2cbd84106e99c1c7cc797a4bb71a975b8350adc31c979ef18094cab7126f2e2d3f551cea1d80768016f3dbd88b56e6ffada8c6d0a1b15b6f23c0f384b3
         | 
| @@ -108,7 +108,7 @@ module Subroutine | |
| 108 108 | 
             
                    type = send(config.foreign_type_method)
         | 
| 109 109 |  | 
| 110 110 | 
             
                    result = fetch_association_instance(type, fk, config.unscoped?)
         | 
| 111 | 
            -
                    set_field_without_association(field_name, result)
         | 
| 111 | 
            +
                    set_field_without_association(field_name, result, track_provided: false) unless result.nil?
         | 
| 112 112 | 
             
                    result
         | 
| 113 113 | 
             
                  else
         | 
| 114 114 | 
             
                    get_field_without_association(field_name)
         | 
    
        data/lib/subroutine/version.rb
    CHANGED
    
    
| @@ -154,5 +154,28 @@ module Subroutine | |
| 154 154 | 
             
                  end
         | 
| 155 155 | 
             
                end
         | 
| 156 156 |  | 
| 157 | 
            +
                def test_params_does_not_contain_association_key_if_not_provided
         | 
| 158 | 
            +
                  op = SimpleAssociationOp.new
         | 
| 159 | 
            +
                  assert_equal [], op.params.keys
         | 
| 160 | 
            +
                end
         | 
| 161 | 
            +
             | 
| 162 | 
            +
                def test_getting_does_not_set_provided
         | 
| 163 | 
            +
                  op = SimpleAssociationOp.new
         | 
| 164 | 
            +
                  op.user
         | 
| 165 | 
            +
                  assert_equal false, op.field_provided?(:user)
         | 
| 166 | 
            +
                  assert_equal false, op.field_provided?(:user_id)
         | 
| 167 | 
            +
                  assert_equal false, op.field_provided?(:user_type)
         | 
| 168 | 
            +
             | 
| 169 | 
            +
                  op.user_id
         | 
| 170 | 
            +
                  assert_equal false, op.field_provided?(:user)
         | 
| 171 | 
            +
                  assert_equal false, op.field_provided?(:user_id)
         | 
| 172 | 
            +
                  assert_equal false, op.field_provided?(:user_type)
         | 
| 173 | 
            +
             | 
| 174 | 
            +
                  op.user_type
         | 
| 175 | 
            +
                  assert_equal false, op.field_provided?(:user)
         | 
| 176 | 
            +
                  assert_equal false, op.field_provided?(:user_id)
         | 
| 177 | 
            +
                  assert_equal false, op.field_provided?(:user_type)
         | 
| 178 | 
            +
                end
         | 
| 179 | 
            +
             | 
| 157 180 | 
             
              end
         | 
| 158 181 | 
             
            end
         |