spec/libgss/actions/master_spec.rb in libgss-0.7.6 vs spec/libgss/actions/master_spec.rb in libgss-0.8.0
- old
+ new
@@ -8,54 +8,56 @@
let(:request) do
network.login
network.new_action_request
end
- describe "#find_all" do
- it "basic call" do
- callback_called = false
- request.find_all("Item")
- request.send_request do |outputs|
- callback_called = true
- outputs.length.should == 1
- items = outputs.first["result"]
- items.length.should == 12
- items.each do |item|
- item["item_cd"].should_not == nil
- item["name"].should_not == nil
+ [:all, :find_all].each do |action|
+ describe "##{action}" do
+ it "basic call" do
+ callback_called = false
+ request.send(action, "Item")
+ request.send_request do |outputs|
+ callback_called = true
+ outputs.length.should == 1
+ items = outputs.first["result"]
+ items.length.should == 12
+ items.each do |item|
+ item["item_cd"].should_not == nil
+ item["name"].should_not == nil
+ end
end
+ callback_called.should == true
end
- callback_called.should == true
- end
- it "with conditions" do
- callback_called = false
- request.find_all("Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008})
- request.send_request do |outputs|
- callback_called = true
- outputs.length.should == 1
- items = outputs.first["result"]
- items.length.should == 4
- items.each do |item|
- item["item_cd"].should_not == nil
- item["name"].should_not == nil
+ it "with conditions" do
+ callback_called = false
+ request.send(action, "Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008})
+ request.send_request do |outputs|
+ callback_called = true
+ outputs.length.should == 1
+ items = outputs.first["result"]
+ items.length.should == 4
+ items.each do |item|
+ item["item_cd"].should_not == nil
+ item["name"].should_not == nil
+ end
end
+ callback_called.should == true
end
- callback_called.should == true
- end
- it "with order and conditions" do
- callback_called = false
- request.find_all("Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008}, [["item_cd", "desc"]])
- request.send_request do |outputs|
- callback_called = true
- outputs.length.should == 1
- items = outputs.first["result"]
- items.length.should == 4
- items.map{|item| item["item_cd"]}.should == [20008, 20007, 20006, 20005]
+ it "with order and conditions" do
+ callback_called = false
+ request.send(action, "Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008}, [["item_cd", "desc"]])
+ request.send_request do |outputs|
+ callback_called = true
+ outputs.length.should == 1
+ items = outputs.first["result"]
+ items.length.should == 4
+ items.map{|item| item["item_cd"]}.should == [20008, 20007, 20006, 20005]
+ end
+ callback_called.should == true
end
- callback_called.should == true
end
end
describe "#paginate" do
it "with pagination" do
@@ -94,44 +96,46 @@
end
callback_called.should == true
end
end
- describe "#find_first" do
- it "basic call" do
- callback_called = false
- request.find_first("Item")
- request.send_request do |outputs|
- callback_called = true
- outputs.length.should == 1
- item = outputs.first["result"]
- item["item_cd"].should == 20001
+ [:first, :find_first].each do |action|
+ describe "##{action}" do
+ it "basic call" do
+ callback_called = false
+ request.send(action, "Item")
+ request.send_request do |outputs|
+ callback_called = true
+ outputs.length.should == 1
+ item = outputs.first["result"]
+ item["item_cd"].should == 20001
+ end
+ callback_called.should == true
end
- callback_called.should == true
- end
- it "with conditions" do
- callback_called = false
- request.find_first("Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008})
- request.send_request do |outputs|
- callback_called = true
- outputs.length.should == 1
- item = outputs.first["result"]
- item["item_cd"].should == 20005
+ it "with conditions" do
+ callback_called = false
+ request.send(action, "Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008})
+ request.send_request do |outputs|
+ callback_called = true
+ outputs.length.should == 1
+ item = outputs.first["result"]
+ item["item_cd"].should == 20005
+ end
+ callback_called.should == true
end
- callback_called.should == true
- end
- it "with order and conditions" do
- callback_called = false
- request.find_first("Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008}, [["item_cd", "desc"]])
- request.send_request do |outputs|
- callback_called = true
- outputs.length.should == 1
- item = outputs.first["result"]
- item["item_cd"].should == 20008
+ it "with order and conditions" do
+ callback_called = false
+ request.send(action, "Item", {"item_cd$gte" => 20005, "item_cd$lte" => 20008}, [["item_cd", "desc"]])
+ request.send_request do |outputs|
+ callback_called = true
+ outputs.length.should == 1
+ item = outputs.first["result"]
+ item["item_cd"].should == 20008
+ end
+ callback_called.should == true
end
- callback_called.should == true
end
end
end