On 08/22/2012 09:36 AM, Crag Wolfe wrote:
As stated by Martin, all of our collection endpoints should include id and href attributes only, any other information should be found in a detail endpoint (in this case, the name is available in the detail for a given pool). --- src/app/views/pools/_list.xml.haml | 2 +- src/features/step_definitions/pool_api_steps.rb | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-)diff --git a/src/app/views/pools/_list.xml.haml b/src/app/views/pools/_list.xml.haml index 57cb421..c9c3982 100644 --- a/src/app/views/pools/_list.xml.haml +++ b/src/app/views/pools/_list.xml.haml @@ -1,4 +1,4 @@ !!! XML %pools - @pools.each do |pool| - %pool{:id => pool.id, :name => pool.name, :href => api_pool_url(pool)} + %pool{:id => pool.id, :href => api_pool_url(pool)} diff --git a/src/features/step_definitions/pool_api_steps.rb b/src/features/step_definitions/pool_api_steps.rb index 2ffab0e..1f26b47 100644 --- a/src/features/step_definitions/pool_api_steps.rb +++ b/src/features/step_definitions/pool_api_steps.rb @@ -11,17 +11,10 @@ Then /^I should receive list of (\d+) pools as XML$/ do |number| pool_node_set = xml_body.xpath('//pools/pool') pool_node_set.size.should be_eql(number.to_i) ids = [] - names = [] pool_node_set.each() do |ns| ids << ns.get_attribute('id') - names << ns.get_attribute('name') end - ids.uniq! - names.sort! # verify unique id's + ids.uniq! ids.size.should be_eql(number.to_i) - if number == 3 - # verify pool names match those given in the scenario - names.should be_eql(["Default", "bar", "foo"]) - end end
Ack and pushed.
