Sha256: 5cb00cf0091fac89ce2dd1246097e984087126ed3fb23feb0037a2c8a37b7ebb
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
RSpec.describe Query do class TestQuery include Query string :term validates :term, presence: true integer :times end subject(:query) { TestQuery.new term: 'puppy', times: '100' } describe '#attributes' do it 'should return a hash of attributes' do expect(query.attributes).to be_a Hash expect(query.attributes[:term]).to eq 'puppy' end end describe '#serialized_attributes' do it 'should return a hash of attributes run through the transforms' do expect(query.serialized_attributes).to be_a Hash expect(query.serialized_attributes[:times]).to eq 100 end end describe '#to_details' do it 'should return a hash containing the query name and arguments' do details = query.to_details expect(details).to be_a Hash expect(details[:name]).to eq 'TestQuery' expect(details[:args][:term]).to eq 'puppy' expect(details[:args][:times]).to eq 100 end end describe '#valid?' do it 'should return true if query is valid' do expect(query.valid?).to be_truthy end it 'should return false if query is not valid' do expect(TestQuery.new.valid?).to be_falsey end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aggro-0.0.4 | spec/lib/aggro/query_spec.rb |
aggro-0.0.3 | spec/lib/aggro/query_spec.rb |
aggro-0.0.2 | spec/lib/aggro/query_spec.rb |