Sha256: 70cb4d1e9d8e40cf43654ed521930174eb87ee6db7e184b62743c60b969e890e
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
include MinterStateHelper describe MinterState, type: :model do before(:each) { reset_minter_state_table } after( :all ) { reset_minter_state_table } let(:state) { described_class.new } let(:first) { described_class.first } it 'db is seeded with first row' do expect{ first }.not_to raise_error expect(first.namespace).to eq 'default' expect(first.template).to eq '.reeddeeddk' expect(first.seq).to eq 0 expect(described_class.group(:namespace).count).to eq('default' => 1) end describe 'validation' do it 'blocks invalid template' do expect{ state.save! }.to raise_error(ActiveRecord::RecordInvalid) # empty state.template = 'bad_template' expect{ state.save! }.to raise_error(ActiveRecord::RecordInvalid) state.template = 'reeddddk' # close, but missing '.' expect{ state.save! }.to raise_error(ActiveRecord::RecordInvalid) end it 'allows valid template (edit)' do first.template = '.reeddddk' expect{ first.save! }.not_to raise_error # OK! end it 'blocks new record in same namespace' do state.template = '.reeddddk' expect{ state.save! }.to raise_error(ActiveRecord::RecordInvalid) end it 'allows new record in distinct namespace' do state.template = '.reeddddk' state.namespace = 'foobar' expect{ state.save! }.not_to raise_error # OK! expect(described_class.group(:namespace).count).to eq('default' => 1, 'foobar' => 1) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_fedora-noid-2.0.0.beta5 | spec/models/minter_state_spec.rb |
active_fedora-noid-2.0.0.beta4 | spec/models/minter_state_spec.rb |