spec/care_provider_spec.rb in caren-api-0.4.4 vs spec/care_provider_spec.rb in caren-api-0.4.5

- old
+ new

@@ -68,21 +68,23 @@ end describe "CareProvider", "REST methods" do before do + care_provider = File.read("spec/fixtures/caren_care_provider.xml") care_providers = File.read("spec/fixtures/caren_care_providers.xml") care_providers_search = File.read("spec/fixtures/caren_care_providers_search.xml") care_provider_url = Caren::Api.session.url_for( Caren::CareProvider.resource_url(1) ) care_providers_url = Caren::Api.session.url_for( Caren::CareProvider.resource_url ) search_url = Caren::Api.session.url_for( "#{Caren::CareProvider.resource_url}?key=url-shortcut&value=pantein" ) timestamp = DateTime.now.to_i FakeWeb.register_uri(:put, care_provider_url, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp) ) - FakeWeb.register_uri(:get, care_providers_url, :body => care_providers, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,care_providers) ) + FakeWeb.register_uri(:get, care_provider_url, :body => care_provider, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,care_provider) ) + FakeWeb.register_uri(:get, care_providers_url, :body => care_providers, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,care_providers) ) FakeWeb.register_uri(:get, search_url, :body => care_providers_search, :timestamp => timestamp, :signature => Caren::Api.session.sign(timestamp,care_providers_search) ) end it "should be able to update a care provider" do lambda{ Caren::CareProvider.new( :id => 1, :name => "Test" ).update( Caren::Api.session ) }.should_not raise_error @@ -102,8 +104,13 @@ it "should be able to find all care providers" do care_providers = Caren::CareProvider.all Caren::Api.session care_providers.should have(2).things care_providers.first.name.should == "Demo" care_providers.first.url_shortcut.should == "demo" + end + + it "should be able to find one care providers" do + care_provider = Caren::CareProvider.find 1, Caren::Api.session + care_provider.name.should == "Demo" end end \ No newline at end of file