soulless 0.5.0.rc5 → 0.5.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/.rspec +2 -0
 - data/.travis.yml +5 -2
 - data/Gemfile +1 -8
 - data/lib/soulless/version.rb +1 -1
 - data/spec/associated_validator_spec.rb +8 -8
 - data/spec/dirty_spec.rb +21 -23
 - data/spec/dummy/db/test.sqlite3 +0 -0
 - data/spec/inheritance_spec.rb +10 -10
 - data/spec/soulless_spec.rb +21 -21
 - data/spec/spec_helper.rb +14 -3
 - data/spec/support/dummy_soulless_inheritance.rb +19 -3
 - data/spec/uniqueness_validator_spec.rb +4 -4
 - metadata +6 -5
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 615a453828093d6ce2cbcab5b32fc65440e0a42a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: f1c6bf566a4ddb0e76a10eb37ff494970feba49c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c7e467d9ad1ab576025944da5cefc86ef864b42e12801bb492429026a957907d41af6239cdf461d17c22dc816e2a2df736efba6da568bff2d87a66e07aebaff7
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4533c9bea37d3786bf700922315d749e12228de08bd3ad4ffbd9c8ab91a93616aee63d72bec4c1068418ea2ca25af48faeff110d5dc4655584cedf4e2c7d6cec
         
     | 
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    CHANGED
    
    | 
         @@ -6,13 +6,16 @@ rvm: 
     | 
|
| 
       6 
6 
     | 
    
         
             
              - ruby-head
         
     | 
| 
       7 
7 
     | 
    
         
             
              - jruby-19mode
         
     | 
| 
       8 
8 
     | 
    
         
             
              - jruby-head
         
     | 
| 
       9 
     | 
    
         
            -
              - rbx
         
     | 
| 
      
 9 
     | 
    
         
            +
              - rbx-2
         
     | 
| 
       10 
10 
     | 
    
         
             
            env:
         
     | 
| 
       11 
11 
     | 
    
         
             
              - "RAILS_VERSION=3.2.0"
         
     | 
| 
       12 
12 
     | 
    
         
             
              - "RAILS_VERSION=4.0.0"
         
     | 
| 
       13 
13 
     | 
    
         
             
              - "RAILS_VERSION=master"
         
     | 
| 
      
 14 
     | 
    
         
            +
            script:
         
     | 
| 
      
 15 
     | 
    
         
            +
              - cd spec/dummy; bundle exec rake db:migrate
         
     | 
| 
      
 16 
     | 
    
         
            +
              - cd ../../; bundle exec rake spec
         
     | 
| 
       14 
17 
     | 
    
         
             
            matrix:
         
     | 
| 
       15 
18 
     | 
    
         
             
              allow_failures:
         
     | 
| 
       16 
19 
     | 
    
         
             
                - env: "RAILS_VERSION=master"
         
     | 
| 
       17 
20 
     | 
    
         
             
                - rvm: ruby-head
         
     | 
| 
       18 
     | 
    
         
            -
                - rvm: jruby-head
         
     | 
| 
      
 21 
     | 
    
         
            +
                - rvm: jruby-head
         
     | 
    
        data/Gemfile
    CHANGED
    
    | 
         @@ -22,13 +22,6 @@ platforms :jruby do 
     | 
|
| 
       22 
22 
     | 
    
         
             
              gem "activerecord-jdbcsqlite3-adapter"
         
     | 
| 
       23 
23 
     | 
    
         
             
            end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
            platforms :rbx do
         
     | 
| 
       26 
     | 
    
         
            -
              gem 'psych'
         
     | 
| 
       27 
     | 
    
         
            -
              gem 'racc'
         
     | 
| 
       28 
     | 
    
         
            -
              gem 'rubysl'
         
     | 
| 
       29 
     | 
    
         
            -
              gem 'rubinius-coverage'
         
     | 
| 
       30 
     | 
    
         
            -
            end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
25 
     | 
    
         
             
            group :development do
         
     | 
| 
       33 
26 
     | 
    
         
             
              gem 'coveralls', require: false
         
     | 
| 
       34 
     | 
    
         
            -
            end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/soulless/version.rb
    CHANGED
    
    
| 
         @@ -4,28 +4,28 @@ describe Soulless::Validations::AssociatedValidator do 
     | 
|
| 
       4 
4 
     | 
    
         
             
              it 'should not be valid if has_one associations are invalid' do
         
     | 
| 
       5 
5 
     | 
    
         
             
                dummy_association = DummyAssociation.new
         
     | 
| 
       6 
6 
     | 
    
         
             
                dummy_association.spouse = { name: nil }
         
     | 
| 
       7 
     | 
    
         
            -
                dummy_association.valid 
     | 
| 
      
 7 
     | 
    
         
            +
                expect(dummy_association.valid?).to eq(false)
         
     | 
| 
       8 
8 
     | 
    
         
             
                dummy_association.errors[:spouse].should include('is invalid')
         
     | 
| 
       9 
9 
     | 
    
         
             
                dummy_association.spouse.errors[:name].should include("can't be blank")
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
       12 
12 
     | 
    
         
             
              it 'should be valid if has_one associations are valid' do
         
     | 
| 
       13 
13 
     | 
    
         
             
                dummy_association = DummyAssociation.new
         
     | 
| 
       14 
14 
     | 
    
         
             
                dummy_association.spouse = { name: 'Megan' }
         
     | 
| 
       15 
     | 
    
         
            -
                dummy_association.valid 
     | 
| 
      
 15 
     | 
    
         
            +
                expect(dummy_association.valid?).to eq(true)
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       18 
18 
     | 
    
         
             
              it 'should not be valid if has_many associations are invalid' do
         
     | 
| 
       19 
19 
     | 
    
         
             
                dummy_association = DummyAssociation.new
         
     | 
| 
       20 
20 
     | 
    
         
             
                dummy_association.friends = [{ name: nil }, { name: nil }]
         
     | 
| 
       21 
     | 
    
         
            -
                dummy_association.valid 
     | 
| 
      
 21 
     | 
    
         
            +
                expect(dummy_association.valid?).to eq(false)
         
     | 
| 
       22 
22 
     | 
    
         
             
                dummy_association.errors[:friends].should include('is invalid')
         
     | 
| 
       23 
23 
     | 
    
         
             
                dummy_association.friends[0].errors[:name].should include("can't be blank")
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       26 
26 
     | 
    
         
             
              it 'should be valid if has_many associations are valid' do
         
     | 
| 
       27 
27 
     | 
    
         
             
                dummy_association = DummyAssociation.new
         
     | 
| 
       28 
28 
     | 
    
         
             
                dummy_association.friends = [{ name: 'Yaw' }, { name: 'Biff' }]
         
     | 
| 
       29 
     | 
    
         
            -
                dummy_association.valid 
     | 
| 
      
 29 
     | 
    
         
            +
                expect(dummy_association.valid?).to eq(true)
         
     | 
| 
       30 
30 
     | 
    
         
             
              end
         
     | 
| 
       31 
     | 
    
         
            -
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/dirty_spec.rb
    CHANGED
    
    | 
         @@ -1,56 +1,54 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
1 
     | 
    
         
             
            describe Soulless::Dirty do
         
     | 
| 
       4 
2 
     | 
    
         
             
              before(:each) do
         
     | 
| 
       5 
3 
     | 
    
         
             
                @dummy_class = DummyClass.new
         
     | 
| 
       6 
4 
     | 
    
         
             
              end
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       8 
6 
     | 
    
         
             
              it 'should support dirty attributes' do
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
      
 7 
     | 
    
         
            +
                expect(@dummy_class.respond_to?(:changed?)).to eq(true)
         
     | 
| 
       10 
8 
     | 
    
         
             
              end
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       12 
10 
     | 
    
         
             
              it 'should record attribute changes' do
         
     | 
| 
       13 
     | 
    
         
            -
                @dummy_class.name_changed 
     | 
| 
      
 11 
     | 
    
         
            +
                expect(@dummy_class.name_changed?).to eq(false)
         
     | 
| 
       14 
12 
     | 
    
         
             
                @dummy_class.name = 'Yaw'
         
     | 
| 
       15 
     | 
    
         
            -
                @dummy_class.name_changed 
     | 
| 
      
 13 
     | 
    
         
            +
                expect(@dummy_class.name_changed?).to eq(true)
         
     | 
| 
       16 
14 
     | 
    
         
             
              end
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       18 
16 
     | 
    
         
             
              it 'should correctly record changes to objects with initialized values' do
         
     | 
| 
       19 
17 
     | 
    
         
             
                @dummy_class = DummyClass.new(name: 'Biff')
         
     | 
| 
       20 
     | 
    
         
            -
                @dummy_class.name_changed 
     | 
| 
      
 18 
     | 
    
         
            +
                expect(@dummy_class.name_changed?).to eq(false)
         
     | 
| 
       21 
19 
     | 
    
         
             
                @dummy_class.name = 'Anthony'
         
     | 
| 
       22 
     | 
    
         
            -
                @dummy_class.name_changed 
     | 
| 
      
 20 
     | 
    
         
            +
                expect(@dummy_class.name_changed?).to eq(true)
         
     | 
| 
       23 
21 
     | 
    
         
             
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       25 
23 
     | 
    
         
             
              it 'should record changes in a has_one association' do
         
     | 
| 
       26 
24 
     | 
    
         
             
                @dummy_association = DummyAssociation.new(spouse: { name: 'Megan' })
         
     | 
| 
       27 
     | 
    
         
            -
                @dummy_association.spouse.name_changed 
     | 
| 
      
 25 
     | 
    
         
            +
                expect(@dummy_association.spouse.name_changed?).to eq(false)
         
     | 
| 
       28 
26 
     | 
    
         
             
                @dummy_association.spouse.name = 'Megan Jr'
         
     | 
| 
       29 
     | 
    
         
            -
                @dummy_association.spouse.name_changed 
     | 
| 
      
 27 
     | 
    
         
            +
                expect(@dummy_association.spouse.name_changed?).to eq(true)
         
     | 
| 
       30 
28 
     | 
    
         
             
              end
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       32 
30 
     | 
    
         
             
              it 'should record changes in a has_many association' do
         
     | 
| 
       33 
31 
     | 
    
         
             
                @dummy_association = DummyAssociation.new(friends: [{ name: 'Yaw' }])
         
     | 
| 
       34 
     | 
    
         
            -
                @dummy_association.friends[0].name_changed 
     | 
| 
      
 32 
     | 
    
         
            +
                expect(@dummy_association.friends[0].name_changed?).to eq(false)
         
     | 
| 
       35 
33 
     | 
    
         
             
                @dummy_association.friends[0].name = 'Biff'
         
     | 
| 
       36 
     | 
    
         
            -
                @dummy_association.friends[0].name_changed 
     | 
| 
      
 34 
     | 
    
         
            +
                expect(@dummy_association.friends[0].name_changed?).to eq(true)
         
     | 
| 
       37 
35 
     | 
    
         
             
              end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
       39 
37 
     | 
    
         
             
              it 'should reset its dirty state when saved' do
         
     | 
| 
       40 
38 
     | 
    
         
             
                @dummy_class.name = 'Biff'
         
     | 
| 
       41 
39 
     | 
    
         
             
                @dummy_class.save
         
     | 
| 
       42 
     | 
    
         
            -
                @dummy_class.changed 
     | 
| 
      
 40 
     | 
    
         
            +
                expect(@dummy_class.changed?).to eq(false)
         
     | 
| 
       43 
41 
     | 
    
         
             
              end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       45 
43 
     | 
    
         
             
              it 'should not reset its dirty state if validations fail' do
         
     | 
| 
       46 
44 
     | 
    
         
             
                @dummy_class.name = nil
         
     | 
| 
       47 
45 
     | 
    
         
             
                @dummy_class.save
         
     | 
| 
       48 
     | 
    
         
            -
                @dummy_class.changed 
     | 
| 
      
 46 
     | 
    
         
            +
                expect(@dummy_class.changed?).to eq(true)
         
     | 
| 
       49 
47 
     | 
    
         
             
              end
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
       51 
49 
     | 
    
         
             
              it 'should record changed made before #save was called in previous_changes' do
         
     | 
| 
       52 
50 
     | 
    
         
             
                @dummy_class.name = 'Biff'
         
     | 
| 
       53 
51 
     | 
    
         
             
                @dummy_class.save
         
     | 
| 
       54 
     | 
    
         
            -
                @dummy_class.previous_changes. 
     | 
| 
      
 52 
     | 
    
         
            +
                expect(@dummy_class.previous_changes).to_not be_empty
         
     | 
| 
       55 
53 
     | 
    
         
             
              end
         
     | 
| 
       56 
     | 
    
         
            -
            end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/dummy/db/test.sqlite3
    CHANGED
    
    | 
         Binary file 
     | 
    
        data/spec/inheritance_spec.rb
    CHANGED
    
    | 
         @@ -5,47 +5,47 @@ describe Soulless::Inheritance do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                before(:each) do
         
     | 
| 
       6 
6 
     | 
    
         
             
                  @dummy_inheritance = DummyModelInheritance.new
         
     | 
| 
       7 
7 
     | 
    
         
             
                end
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       9 
9 
     | 
    
         
             
                it 'should inherit the name attribute' do
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @dummy_inheritance.attributes.keys.should include(:name)
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       13 
13 
     | 
    
         
             
                it 'should inherit the default value for the name attribute' do
         
     | 
| 
       14 
14 
     | 
    
         
             
                  @dummy_inheritance.attributes[:name].should == 'Anthony'
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       17 
17 
     | 
    
         
             
                it 'should not inhert the email attribute when added as exclude option' do
         
     | 
| 
       18 
18 
     | 
    
         
             
                  @dummy_inheritance.attributes.keys.should_not include(:email)
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       21 
21 
     | 
    
         
             
                it 'should validate presence of name' do
         
     | 
| 
       22 
22 
     | 
    
         
             
                  @dummy_inheritance.name = nil
         
     | 
| 
       23 
23 
     | 
    
         
             
                  @dummy_inheritance.valid?
         
     | 
| 
       24 
24 
     | 
    
         
             
                  @dummy_inheritance.errors[:name].should include("can't be blank")
         
     | 
| 
       25 
25 
     | 
    
         
             
                end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       27 
27 
     | 
    
         
             
                it 'should not validate email' do
         
     | 
| 
       28 
28 
     | 
    
         
             
                  @dummy_inheritance.class.validators.each do |validator|
         
     | 
| 
       29 
29 
     | 
    
         
             
                    validator.attributes.should_not include(:email)
         
     | 
| 
       30 
30 
     | 
    
         
             
                  end
         
     | 
| 
       31 
31 
     | 
    
         
             
                end
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       34 
34 
     | 
    
         
             
              describe DummySoullessInheritance do
         
     | 
| 
       35 
35 
     | 
    
         
             
                before(:each) do
         
     | 
| 
       36 
36 
     | 
    
         
             
                  @dummy_inheritance = DummySoullessInheritance.new
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       39 
39 
     | 
    
         
             
                it 'should inherit the name attribute' do
         
     | 
| 
       40 
40 
     | 
    
         
             
                  @dummy_inheritance.attributes.keys.should include(:name)
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
       43 
43 
     | 
    
         
             
                it 'should inherit the default value for the name attribute' do
         
     | 
| 
       44 
44 
     | 
    
         
             
                  @dummy_inheritance.attributes[:name].should == 'Anthony'
         
     | 
| 
       45 
45 
     | 
    
         
             
                end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       47 
47 
     | 
    
         
             
                it 'should not inhert the email attribute when added as exclude option' do
         
     | 
| 
       48 
48 
     | 
    
         
             
                  @dummy_inheritance.attributes.keys.should_not include(:email)
         
     | 
| 
       49 
49 
     | 
    
         
             
                end
         
     | 
| 
       50 
50 
     | 
    
         
             
              end
         
     | 
| 
       51 
     | 
    
         
            -
            end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/soulless_spec.rb
    CHANGED
    
    | 
         @@ -4,53 +4,53 @@ describe Soulless do 
     | 
|
| 
       4 
4 
     | 
    
         
             
              before(:each) do
         
     | 
| 
       5 
5 
     | 
    
         
             
                @dummy_class = DummyClass.new
         
     | 
| 
       6 
6 
     | 
    
         
             
              end
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
       8 
8 
     | 
    
         
             
              it 'should validate name' do
         
     | 
| 
       9 
9 
     | 
    
         
             
                @dummy_class.name = nil
         
     | 
| 
       10 
10 
     | 
    
         
             
                @dummy_class.valid?.should == false
         
     | 
| 
       11 
     | 
    
         
            -
                @dummy_class.errors[:name]. 
     | 
| 
      
 11 
     | 
    
         
            +
                expect(@dummy_class.errors[:name]).to_not be_empty
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       14 
14 
     | 
    
         
             
              it 'should call #persist! when #save is called' do
         
     | 
| 
       15 
15 
     | 
    
         
             
                @dummy_class.save
         
     | 
| 
       16 
     | 
    
         
            -
                @dummy_class.saved. 
     | 
| 
      
 16 
     | 
    
         
            +
                expect(@dummy_class.saved).to eq(true)
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
       19 
19 
     | 
    
         
             
              it 'should call #persist! when #update_attributes is called' do
         
     | 
| 
       20 
20 
     | 
    
         
             
                @dummy_class.update_attributes(name: 'Biff')
         
     | 
| 
       21 
     | 
    
         
            -
                @dummy_class.saved. 
     | 
| 
      
 21 
     | 
    
         
            +
                expect(@dummy_class.saved).to eq(true)
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       24 
24 
     | 
    
         
             
              it 'should not call #persist! if attributes are invalid' do
         
     | 
| 
       25 
25 
     | 
    
         
             
                @dummy_class.name = nil
         
     | 
| 
       26 
     | 
    
         
            -
                @dummy_class.save. 
     | 
| 
       27 
     | 
    
         
            -
                @dummy_class.saved. 
     | 
| 
      
 26 
     | 
    
         
            +
                expect(@dummy_class.save).to eq(false)
         
     | 
| 
      
 27 
     | 
    
         
            +
                expect(@dummy_class.saved).to eq(false)
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       30 
30 
     | 
    
         
             
              it '#update_attributes should not save' do
         
     | 
| 
       31 
31 
     | 
    
         
             
                @dummy_class.assign_attributes(name: 'Yaw', email: 'yokoono@thebeatles.com')
         
     | 
| 
       32 
     | 
    
         
            -
                @dummy_class.saved 
     | 
| 
      
 32 
     | 
    
         
            +
                expect(@dummy_class.saved?).to eq(false)
         
     | 
| 
       33 
33 
     | 
    
         
             
              end
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
       35 
35 
     | 
    
         
             
              it '#assign_attributes should merge new values' do
         
     | 
| 
       36 
36 
     | 
    
         
             
                @dummy_class.email = 'yokoono@thebeatles.com'
         
     | 
| 
       37 
37 
     | 
    
         
             
                @dummy_class.assign_attributes(name: 'Yaw')
         
     | 
| 
       38 
     | 
    
         
            -
                @dummy_class.name. 
     | 
| 
       39 
     | 
    
         
            -
                @dummy_class.email. 
     | 
| 
      
 38 
     | 
    
         
            +
                expect(@dummy_class.name).to eq('Yaw')
         
     | 
| 
      
 39 
     | 
    
         
            +
                expect(@dummy_class.email).to eq('yokoono@thebeatles.com')
         
     | 
| 
       40 
40 
     | 
    
         
             
              end
         
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       42 
42 
     | 
    
         
             
              it '#assign_attributes should deep merge new values' do
         
     | 
| 
       43 
43 
     | 
    
         
             
                @dummy_class = DummyAssociation.new(spouse: { name: 'Megan' })
         
     | 
| 
       44 
44 
     | 
    
         
             
                @dummy_class.assign_attributes(spouse: { name: 'Mary Jane Watson' })
         
     | 
| 
       45 
     | 
    
         
            -
                @dummy_class.spouse.name. 
     | 
| 
      
 45 
     | 
    
         
            +
                expect(@dummy_class.spouse.name).to eq('Mary Jane Watson')
         
     | 
| 
       46 
46 
     | 
    
         
             
              end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
       48 
48 
     | 
    
         
             
              it '#update_attributes should save' do
         
     | 
| 
       49 
49 
     | 
    
         
             
                @dummy_class.update_attributes(name: 'Yaw', email: 'yokoono@thebeatles.com')
         
     | 
| 
       50 
     | 
    
         
            -
                @dummy_class.saved 
     | 
| 
      
 50 
     | 
    
         
            +
                expect(@dummy_class.saved?).to eq(true)
         
     | 
| 
       51 
51 
     | 
    
         
             
              end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
       53 
53 
     | 
    
         
             
              it '#persisted? should be false' do
         
     | 
| 
       54 
     | 
    
         
            -
                @dummy_class.persisted 
     | 
| 
      
 54 
     | 
    
         
            +
                expect(@dummy_class.persisted?).to eq(false)
         
     | 
| 
       55 
55 
     | 
    
         
             
              end
         
     | 
| 
       56 
     | 
    
         
            -
            end
         
     | 
| 
      
 56 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -11,12 +11,23 @@ require 'database_cleaner' 
     | 
|
| 
       11 
11 
     | 
    
         
             
            Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            RSpec.configure do |config|
         
     | 
| 
      
 14 
     | 
    
         
            +
              config.mock_with :rspec do |mocks|
         
     | 
| 
      
 15 
     | 
    
         
            +
                # Enable only the newer, non-monkey-patching expect syntax.
         
     | 
| 
      
 16 
     | 
    
         
            +
                # For more details, see:
         
     | 
| 
      
 17 
     | 
    
         
            +
                #   - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
         
     | 
| 
      
 18 
     | 
    
         
            +
                mocks.syntax = :should
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                # Prevents you from mocking or stubbing a method that does not exist on
         
     | 
| 
      
 21 
     | 
    
         
            +
                # a real object. This is generally recommended.
         
     | 
| 
      
 22 
     | 
    
         
            +
                mocks.verify_partial_doubles = true
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       14 
25 
     | 
    
         
             
              DatabaseCleaner.strategy = :transaction
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       16 
27 
     | 
    
         
             
              config.before :suite do
         
     | 
| 
       17 
28 
     | 
    
         
             
                DatabaseCleaner.clean_with :truncation
         
     | 
| 
       18 
29 
     | 
    
         
             
              end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       20 
31 
     | 
    
         
             
              config.before :each do
         
     | 
| 
       21 
32 
     | 
    
         
             
                DatabaseCleaner.start
         
     | 
| 
       22 
33 
     | 
    
         
             
              end
         
     | 
| 
         @@ -24,4 +35,4 @@ RSpec.configure do |config| 
     | 
|
| 
       24 
35 
     | 
    
         
             
              config.after :each do
         
     | 
| 
       25 
36 
     | 
    
         
             
                DatabaseCleaner.clean
         
     | 
| 
       26 
37 
     | 
    
         
             
              end
         
     | 
| 
       27 
     | 
    
         
            -
            end
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -1,10 +1,26 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class DummySoullessInheritance
         
     | 
| 
       2 
2 
     | 
    
         
             
              include Soulless.model
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
       4 
4 
     | 
    
         
             
              inherit_from(::DummyClass, { exclude: :email })
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       6 
6 
     | 
    
         
             
              private
         
     | 
| 
       7 
7 
     | 
    
         
             
              def persist!
         
     | 
| 
       8 
8 
     | 
    
         
             
                self.saved = true
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
     | 
    
         
            -
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            # This is a hack for now. For some reason Travis can't see dummy_class.rb.
         
     | 
| 
      
 13 
     | 
    
         
            +
            class DummyClass
         
     | 
| 
      
 14 
     | 
    
         
            +
              include Soulless.model
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              attribute :name, String, default: 'Anthony'
         
     | 
| 
      
 17 
     | 
    
         
            +
              attribute :email, String
         
     | 
| 
      
 18 
     | 
    
         
            +
              attribute :saved, Boolean, default: false
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              validates :name, presence: true
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              private
         
     | 
| 
      
 23 
     | 
    
         
            +
              def persist!
         
     | 
| 
      
 24 
     | 
    
         
            +
                self.saved = true
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -4,14 +4,14 @@ describe Soulless::Validations::UniquenessValidator do 
     | 
|
| 
       4 
4 
     | 
    
         
             
              it 'should validate uniqueness on model' do
         
     | 
| 
       5 
5 
     | 
    
         
             
                DummyModel.create!(name: 'Anthony')
         
     | 
| 
       6 
6 
     | 
    
         
             
                model = DummyModel.new(name: 'Anthony')
         
     | 
| 
       7 
     | 
    
         
            -
                model.valid 
     | 
| 
      
 7 
     | 
    
         
            +
                expect(model.valid?).to eq(false)
         
     | 
| 
       8 
8 
     | 
    
         
             
                model.errors[:name].should include('has already been taken')
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       11 
11 
     | 
    
         
             
              it 'should validate uniqueness on form' do
         
     | 
| 
       12 
12 
     | 
    
         
             
                DummyModel.create!(name: 'Anthony')
         
     | 
| 
       13 
13 
     | 
    
         
             
                form = DummyForm.new(name: 'Anthony')
         
     | 
| 
       14 
     | 
    
         
            -
                form.valid 
     | 
| 
      
 14 
     | 
    
         
            +
                expect(form.valid?).to eq(false)
         
     | 
| 
       15 
15 
     | 
    
         
             
                form.errors[:name].should include('has already been taken')
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
     | 
    
         
            -
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: soulless
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.5.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Anthony Smith
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-07-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -116,6 +116,7 @@ extensions: [] 
     | 
|
| 
       116 
116 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       117 
117 
     | 
    
         
             
            files:
         
     | 
| 
       118 
118 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
      
 119 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
       119 
120 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
       120 
121 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       121 
122 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
         @@ -210,12 +211,12 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       210 
211 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       211 
212 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       212 
213 
     | 
    
         
             
              requirements:
         
     | 
| 
       213 
     | 
    
         
            -
              - - " 
     | 
| 
      
 214 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       214 
215 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       215 
     | 
    
         
            -
                  version:  
     | 
| 
      
 216 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       216 
217 
     | 
    
         
             
            requirements: []
         
     | 
| 
       217 
218 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       218 
     | 
    
         
            -
            rubygems_version: 2.2. 
     | 
| 
      
 219 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       219 
220 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       220 
221 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       221 
222 
     | 
    
         
             
            summary: Create Rails style models without the database.
         
     |