Sha256: 8e2c8ebc39b01d466dfdccd8683217875777627615b79b8c4d7707ecccdc50da
Contents?: true
Size: 1.09 KB
Versions: 5
Compression:
Stored size: 1.09 KB
Contents
require "spec_helper" describe ScopedSearch::Definition do before(:each) do @klass = mock_activerecord_class @definition = ScopedSearch::Definition.new(@klass) @definition.stub(:setup_adapter) end describe ScopedSearch::Definition::Field do describe '#column' do it "should raise an exception when using an unknown field" do lambda { @definition.define(:on => 'nonexisting').column }.should raise_error(ActiveRecord::UnknownAttributeError) end it "should not raise an exception when using an unknown field" do lambda { @definition.define(:on => 'existing').column }.should_not raise_error end end end describe '#initialize' do it "should create the named scope when" do @klass.should_receive(:scope).with(:search_for, instance_of(Proc)) ScopedSearch::Definition.new(@klass) end it "should not create the named scope if it already exists" do @klass.stub(:search_for) @klass.should_not_receive(:scope) ScopedSearch::Definition.new(@klass) end end end
Version data entries
5 entries across 5 versions & 1 rubygems