spec/unit/definition_spec.rb in scoped_search-2.3.7 vs spec/unit/definition_spec.rb in scoped_search-2.4.0

- old
+ new

@@ -1,14 +1,29 @@ -require "#{File.dirname(__FILE__)}/../spec_helper" +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(ActiveRecord::UnknownAttributeError) + end + end + end describe '#initialize' do if ActiveRecord::VERSION::MAJOR == 2