O'Reilly logo

Rhomobile Beginner's Guide by Abhishek Nalwaya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action Creating a unit test for the source adapter

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required