stator 0.3.4 → 0.4.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 +4 -4
 - data/lib/stator/machine.rb +1 -1
 - data/lib/stator/version.rb +2 -2
 - data/spec/model_spec.rb +6 -6
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: bd6df35f26ca3ad5d575a7ca144abf6bd17ab7eb24b5ada82fb46e499998ce99
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5e67fc30ac3a46248afee90f68781afb1628a8145ec6da935573a1ee4e29d573
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d1d45f5f4797c75bc8b124041cab91b0e85bec9e936ec76fdfc15b53a5f3c88db2cd733546f20f50fdf2ec3edb7f5b3cffeb93996053afc0a2784de6fd9d17e5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 779f3a8c8b04b04acb5abdf84722a7418a0c5a8c35f859d02d8c35419ac6398bd5b64b9a80cadf329f4ae9fde4f666664da2075d500187ea1ba144557c240f47
         
     | 
    
        data/lib/stator/machine.rb
    CHANGED
    
    | 
         @@ -118,7 +118,7 @@ module Stator 
     | 
|
| 
       118 
118 
     | 
    
         
             
                        integration.state == #{state.to_s.inspect}
         
     | 
| 
       119 
119 
     | 
    
         
             
                      end
         
     | 
| 
       120 
120 
     | 
    
         | 
| 
       121 
     | 
    
         
            -
                      def #{method_name} 
     | 
| 
      
 121 
     | 
    
         
            +
                      def #{method_name}_state_by?(time)
         
     | 
| 
       122 
122 
     | 
    
         
             
                        integration = self._stator(#{@namespace.inspect}).integration(self)
         
     | 
| 
       123 
123 
     | 
    
         
             
                        integration.state_by?(#{state.to_s.inspect}, time)
         
     | 
| 
       124 
124 
     | 
    
         
             
                      end
         
     | 
    
        data/lib/stator/version.rb
    CHANGED
    
    
    
        data/spec/model_spec.rb
    CHANGED
    
    | 
         @@ -311,40 +311,40 @@ describe Stator::Model do 
     | 
|
| 
       311 
311 
     | 
    
         
             
                    t = Time.now
         
     | 
| 
       312 
312 
     | 
    
         
             
                    u = User.create!( email: "doug@example.com", activated_state_at: t)
         
     | 
| 
       313 
313 
     | 
    
         
             
                    u.state_by?(:activated, Time.at(t.to_i + 1)).should be true
         
     | 
| 
       314 
     | 
    
         
            -
                    u. 
     | 
| 
      
 314 
     | 
    
         
            +
                    u.activated_state_by?(Time.at(t.to_i + 1)).should be true
         
     | 
| 
       315 
315 
     | 
    
         
             
                  end
         
     | 
| 
       316 
316 
     | 
    
         | 
| 
       317 
317 
     | 
    
         
             
                  it "should be true when the transition is at the same time" do
         
     | 
| 
       318 
318 
     | 
    
         
             
                    t = Time.now
         
     | 
| 
       319 
319 
     | 
    
         
             
                    u = User.create!( email: "doug@example.com", activated_state_at: t)
         
     | 
| 
       320 
320 
     | 
    
         
             
                    u.state_by?(:activated, t).should be true
         
     | 
| 
       321 
     | 
    
         
            -
                    u. 
     | 
| 
      
 321 
     | 
    
         
            +
                    u.activated_state_by?(t).should be true
         
     | 
| 
       322 
322 
     | 
    
         
             
                  end
         
     | 
| 
       323 
323 
     | 
    
         | 
| 
       324 
324 
     | 
    
         
             
                  it "should be false when the transition is later" do
         
     | 
| 
       325 
325 
     | 
    
         
             
                    t = Time.now
         
     | 
| 
       326 
326 
     | 
    
         
             
                    u = User.create!( email: "doug@example.com", activated_state_at: t)
         
     | 
| 
       327 
327 
     | 
    
         
             
                    u.state_by?(:activated, Time.at(t.to_i - 1)).should be false
         
     | 
| 
       328 
     | 
    
         
            -
                    u. 
     | 
| 
      
 328 
     | 
    
         
            +
                    u.activated_state_by?(Time.at(t.to_i - 1)).should be false
         
     | 
| 
       329 
329 
     | 
    
         
             
                  end
         
     | 
| 
       330 
330 
     | 
    
         | 
| 
       331 
331 
     | 
    
         
             
                  it "should be false when the transition is nil" do
         
     | 
| 
       332 
332 
     | 
    
         
             
                    t = Time.now
         
     | 
| 
       333 
333 
     | 
    
         
             
                    u = User.create!( email: "doug@example.com", activated_state_at: nil)
         
     | 
| 
       334 
334 
     | 
    
         
             
                    u.state_by?(:activated, t).should be false
         
     | 
| 
       335 
     | 
    
         
            -
                    u. 
     | 
| 
      
 335 
     | 
    
         
            +
                    u.activated_state_by?(t).should be false
         
     | 
| 
       336 
336 
     | 
    
         
             
                  end
         
     | 
| 
       337 
337 
     | 
    
         | 
| 
       338 
338 
     | 
    
         
             
                  it "should be true when the transition is not nil and the time is nil" do
         
     | 
| 
       339 
339 
     | 
    
         
             
                    u = User.create!( email: "doug@example.com", activated_state_at: Time.now)
         
     | 
| 
       340 
340 
     | 
    
         
             
                    u.state_by?(:activated, nil).should be true
         
     | 
| 
       341 
     | 
    
         
            -
                    u. 
     | 
| 
      
 341 
     | 
    
         
            +
                    u.activated_state_by?(nil).should be true
         
     | 
| 
       342 
342 
     | 
    
         
             
                  end
         
     | 
| 
       343 
343 
     | 
    
         | 
| 
       344 
344 
     | 
    
         
             
                  it "should be false when both are nil" do
         
     | 
| 
       345 
345 
     | 
    
         
             
                    u = User.create!(email: "doug@example.com", activated_state_at: nil)
         
     | 
| 
       346 
346 
     | 
    
         
             
                    u.state_by?(:activated, nil).should be false
         
     | 
| 
       347 
     | 
    
         
            -
                    u. 
     | 
| 
      
 347 
     | 
    
         
            +
                    u.activated_state_by?(nil).should be false
         
     | 
| 
       348 
348 
     | 
    
         
             
                  end
         
     | 
| 
       349 
349 
     | 
    
         
             
                end
         
     | 
| 
       350 
350 
     | 
    
         
             
              end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: stator
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Mike Nelson
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2021-07- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-07-07 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activerecord
         
     |