Sha256: ee76d2d1e52aa0fd8b5c06bdf10a9b9dd43a247bbefbea63595d58610810299d
Contents?: true
Size: 1.42 KB
Versions: 4
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' module Admino module Query describe Dsl do let(:config) { TestQuery.config } let(:instance) { TestQuery.new } it 'allows #search_field declaration' do search_field = config.search_fields.last expect(search_field.name).to eq :starting_from expect(search_field.coerce_to).to eq :to_date end it 'allows #filter_by declaration' do filter_group = config.filter_groups.first expect(filter_group.name).to eq :bar expect(filter_group.scopes).to eq [:one, :two] end it 'allows #sortings declaration' do sorting = config.sorting expect(sorting.scopes).to eq [:by_title, :by_date] expect(sorting.default_scope).to eq :by_title expect(sorting.default_direction).to eq :desc end it 'allows #starting_scope block declaration' do expect(config.starting_scope_callable.call).to eq 'start' end it 'allows #ending_scope block declaration' do expect(config.ending_scope_callable.call).to eq 'end' end context 'with a search_field' do let(:search_field) { double('SearchField', value: 'value') } before do instance.stub(:search_field_by_name). with(:foo). and_return(search_field) end it 'it generates a getter' do expect(instance.foo).to eq 'value' end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
admino-0.0.8 | spec/admino/query/dsl_spec.rb |
admino-0.0.7 | spec/admino/query/dsl_spec.rb |
admino-0.0.6 | spec/admino/query/dsl_spec.rb |
admino-0.0.5 | spec/admino/query/dsl_spec.rb |