spec/reg_spec.rb in Active-0.0.11 vs spec/reg_spec.rb in Active-0.0.12
- old
+ new
@@ -6,48 +6,60 @@
require File.join(File.dirname(__FILE__), %w[ .. lib services reg_center])
include Active::Services
describe RegCenter do
before(:each) do
- @valid_id = "D9A22F33-8A14-4175-8D5B-D11578212A98"
+ @valid_id = "1802851"
+# @valid_id = "1889826"
+# @valid_id = "1847738"
end
it "should set find by id" do
a = RegCenter.find_by_id(@valid_id)
- a.asset_id.should == @valid_id
+ a.data["id"].should == @valid_id
end
- it "should get the asset_type_id" do
- RegCenter.find_by_id(@valid_id).asset_id_type.should_not be_nil
+ it "should set the asset_type_id" do
+ RegCenter.find_by_id(@valid_id).asset_type_id.should_not be_nil
end
it "should thorw an RegCenterError if no record is found" do
lambda { RegCenter.find_by_id( "666" ) }.should raise_error(RegCenterError)
end
it "should get the API metadata" do
a = RegCenter.find_by_id(@valid_id)
a.data["event"].should_not be_nil
end
- it "should have more details than ATS" do
- a = ATS.find_by_id(@valid_id)
- b = RegCenter.find_by_id(@valid_id)
- a.address[:address].should be_nil
- b.address[:address].should_not be_nil
- end
- it "should only load API metadata once" do
- a = RegCenter.find_by_id(@valid_id)
- puts a.url
- puts a.address
- RegCenter.should_receive(:get_app_api).once
- end
it "should have an address Hash" do
a = RegCenter.find_by_id(@valid_id)
a.address.should be_an_instance_of(Hash)
end
+ it "should have a desc String" do
+ a = RegCenter.find_by_id(@valid_id)
+ a.desc.should be_an_instance_of(String)
+ end
it "should cleanup title" do
- a = ATS.find_by_id(@valid_id)
- a.title.should_not_contain("\r")
+ a = RegCenter.find_by_id(@valid_id)
+ a.title.should_not include("\r")
end
+ it "should have a primary category" do
+ a = RegCenter.find_by_id(@valid_id)
+ puts a.primary_category
+ a.primary_category.should_not be_nil
+ end
it "should have a title String" do
- a = ATS.find_by_id(@valid_id)
+ a = RegCenter.find_by_id(@valid_id)
a.title.should be_an_instance_of(String)
+ end
+ it "should have a categories array" do
+ a = RegCenter.find_by_id(@valid_id)
+ a.categories.should be_an_instance_of(Array)
+ end
+ it "should have a start_date DateTime" do
+ a = RegCenter.find_by_id(@valid_id)
+ puts a.start_date
+ a.start_date.should be_an_instance_of(DateTime)
+ end
+ it "should have a start_time DateTime" do
+ a = RegCenter.find_by_id(@valid_id)
+ a.start_time.should be_an_instance_of(DateTime)
end
end