notu 0.1.1 → 0.1.2
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/VERSION +1 -1
 - data/lib/notu/track.rb +8 -0
 - data/spec/notu/track_spec.rb +43 -0
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ed2de8a8fab31c1e52e36cf5ab2c676424eb2792
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0bf70c0cb868859a2407bf882843177dc977d272
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a267e1b9e9c632eb107eee9ddaf8b0aa80d6d45dc4845b0770c76ab3a90c073a1806490a06b3b06b5b338d20edf76f35e83402bc096e0392559aa971fb019e66
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 38ef1a361b9e50760fa1286d3cc396c508d4caa14573c58c1c778a375d93c7a819810a306356d3bb5ad4113fa6ca7c944c96fb81298db777563a0f5aa9579a3e
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.1. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.1.2
         
     | 
    
        data/lib/notu/track.rb
    CHANGED
    
    | 
         @@ -11,6 +11,14 @@ module Notu 
     | 
|
| 
       11 
11 
     | 
    
         
             
                  self.title = attributes['title']
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
      
 14 
     | 
    
         
            +
                def ==(other)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  other.is_a?(self.class) && artist == other.artist && title == other.title
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def eql?(other)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  super || self == other
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       14 
22 
     | 
    
         
             
                private
         
     | 
| 
       15 
23 
     | 
    
         | 
| 
       16 
24 
     | 
    
         
             
                def artist=(value)
         
     | 
    
        data/spec/notu/track_spec.rb
    CHANGED
    
    | 
         @@ -4,6 +4,49 @@ describe Notu::Track do 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              let(:track) { Notu::Track.new(artist: 'Serial Killaz', title: 'Good Enough') }
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
      
 7 
     | 
    
         
            +
              describe '#==' do
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                let(:other) { track.dup }
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                it 'is false if not a track' do
         
     | 
| 
      
 12 
     | 
    
         
            +
                  expect(track == 'foo').to be(false)
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                it 'is false if artist differs' do
         
     | 
| 
      
 16 
     | 
    
         
            +
                  expect {
         
     | 
| 
      
 17 
     | 
    
         
            +
                    allow(other).to receive(:artist).and_return('Foo')
         
     | 
| 
      
 18 
     | 
    
         
            +
                  }.to change { track == other }.from(true).to(false)
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                it 'is false if title differs' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                  expect {
         
     | 
| 
      
 23 
     | 
    
         
            +
                    allow(other).to receive(:title).and_return('Bar')
         
     | 
| 
      
 24 
     | 
    
         
            +
                  }.to change { track == other }.from(true).to(false)
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                it 'is true if plays_count differs' do
         
     | 
| 
      
 28 
     | 
    
         
            +
                  expect {
         
     | 
| 
      
 29 
     | 
    
         
            +
                    allow(other).to receive(:plays_count).and_return(102)
         
     | 
| 
      
 30 
     | 
    
         
            +
                  }.not_to change { track == other }
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              describe '#eql?' do
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                it 'is true for same object' do
         
     | 
| 
      
 38 
     | 
    
         
            +
                  expect(track.eql?(track)).to be(true)
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                it 'is true if == returns true' do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  other = track.dup
         
     | 
| 
      
 43 
     | 
    
         
            +
                  expect {
         
     | 
| 
      
 44 
     | 
    
         
            +
                    allow(track).to receive(:==).and_return(false)
         
     | 
| 
      
 45 
     | 
    
         
            +
                  }.to change { track.eql?(other) }.from(true).to(false)
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       7 
50 
     | 
    
         
             
              describe '#artist' do
         
     | 
| 
       8 
51 
     | 
    
         | 
| 
       9 
52 
     | 
    
         
             
                it 'is value set at initialization' do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: notu
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Alexis Toulotte
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014-08- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-08-29 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     |