spec/supernova/solr_indexer_spec.rb in supernova-0.3.3 vs spec/supernova/solr_indexer_spec.rb in supernova-0.3.4

- old
+ new

@@ -23,10 +23,11 @@ indexer_clazz.has(:created_at, :type => :date) end before(:each) do File.stub!(:open).and_return file_stub + Kernel.stub!(:`).and_return true end describe "initialize" do it "sets all options" do options = { :database => { :database => "dynasty", :username => "dynasty_user" } } @@ -236,18 +237,18 @@ }.should raise_error("solr not configured") end it "calls the correct curl command" do indexer.index_file_path = "/tmp/some_path.json" - indexer.should_receive(:system).with("curl -s 'http://solr.xx:9333/solr/update/json?commit=true\\&stream.file=/tmp/some_path.json'") + Kernel.should_receive(:`).with("curl -s 'http://solr.xx:9333/solr/update/json?commit=true\\&stream.file=/tmp/some_path.json'") indexer.do_index_file(:local => true) end it "executes the correct curl call when not local" do # curl 'http://localhost:8983/solr/update/json?commit=true' --data-binary @books.json -H 'Content-type:application/json' indexer.index_file_path = "/tmp/some_path.json" - indexer.should_receive(:system).with("cd /tmp && curl -s 'http://solr.xx:9333/solr/update/json?commit=true' --data-binary @some_path.json -H 'Content-type:application/json'") + Kernel.should_receive(:`).with("cd /tmp && curl -s 'http://solr.xx:9333/solr/update/json?commit=true' --data-binary @some_path.json -H 'Content-type:application/json'") indexer.do_index_file end end describe "define mappings" do @@ -258,9 +259,14 @@ end it "has adds filters to the field_definitions" do blank_indexer_clazz.has(:artist_id, :type => :integer, :sortable => true) blank_indexer_clazz.field_definitions.should == { :artist_id => { :type => :integer, :sortable => true } } + end + + it "has can also be called with a symbol as argument and sets that to the type" do + blank_indexer_clazz.has(:artist_id, :integer) + blank_indexer_clazz.field_definitions.should == { :artist_id => { :type => :integer } } end it "clazz sets indexed class" do blank_indexer_clazz.clazz(Integer) blank_indexer_clazz.instance_variable_get("@clazz").should == Integer