Sha256: 1ddf50bf32ce78156cb7696a4ffe785ff69a3421b37c2fe593081b41f56097fa

Contents?: true

Size: 1.06 KB

Versions: 5

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe Settings do
  it 'not raises error on create new instance of Settings' do
    expect{ Settings.new }.to_not raise_error
  end
  it 'not raises error on create new element' do
    expect{ Settings.hello = Faker::Lorem.word }.to_not raise_error
  end
  it 'returns same value' do
    word = Faker::Lorem.word
    Settings.hello = word
    expect( Settings.hello ).to eq(word)
  end
  it 'returns same value for composit (1)' do
    word = Faker::Lorem.word
    Settings.hello.hello = word
    expect( Settings.hello.hello ).to eq(word)
  end
  it 'returns same value for composit (2)' do
    word = Faker::Lorem.word
    Settings.i.hello = word
    expect( Settings.i.hello ).to eq(word)
  end

  it 'destroys record with nil value (1)' do
    word = Faker::Lorem.word
    Settings.some = word
    expect{ Settings.some = nil }.to change{ Settings.count }.by(-1)
  end

  it 'destroys record with nil value (2)' do
    word = Faker::Lorem.word
    Settings.some.hello = word
    expect{ Settings.some.hello = nil }.to change{ Settings.count }.by(-1)
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
settingson-1.3.2 spec/models/settings_spec.rb
settingson-1.3.1 spec/models/settings_spec.rb
settingson-1.3.0 spec/models/settings_spec.rb
settingson-1.2.22 spec/models/settings_spec.rb
settingson-1.2.21 spec/models/settings_spec.rb