Now, we will write a unit test for the source adapter product.rb
. There are four actions defined in the source adapter: query
, create
, delete
, and update
. We will write a unit test for each action.
Open the product_spec.rb
file and write the following code:
require File.join(File.dirname(__FILE__),'..','spec_helper') describe "Employee" do it_should_behave_like "SpecHelper" before(:each) do setup_test_for Employee,'testuser' @employee = { 'name' => 'John', 'company'=>'1' , 'age' => '23', 'gender' => 'male', 'salary'=>'20000' } end it "should process Employee query" do test_create(@employee) test_query.size.should > 0 query_errors.should == {} end it "should process Employee create" do new_employee_id = test_create(@employee) new_employee_id.should_not be_nil create_errors.should == {} md[new_employee_id].should == @employee end...