Skip to content

Commit

Permalink
Return list of current programs scenario.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhellberg committed Dec 19, 2011
1 parent cb0f419 commit ce0d42f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions features/product.feature
Expand Up @@ -25,3 +25,7 @@ Feature: UR Product
Given I want the product 100001
When I get the product
Then it should have image

Scenario: Return list of current programs
When I search for current programs
Then the result should contain a list of products
12 changes: 12 additions & 0 deletions features/step_definitions/product_steps.rb
Expand Up @@ -35,6 +35,10 @@
lambda { UR::Product.find(@id) }.should raise_error(exception)
end

When /^I search for current programs$/ do
@current_programs = UR::Search.current_programs
end

# Then

Then /^the title should be "(.*)"/ do |title|
Expand Down Expand Up @@ -64,3 +68,11 @@

@products[count_translations["#{index}"]].title.should == title
end

Then /^the result should contain a list of products$/ do
@current_programs.class.should == Array

types = @current_programs.map(&:class).uniq
types.length.should == 1
types[0].should == UR::Product
end
4 changes: 3 additions & 1 deletion features/support/env.rb
Expand Up @@ -12,7 +12,9 @@
faked_urls = [
'http://metadata.ur.se/products/100001.json',
'http://metadata.ur.se/products.json?ur_product_ids=100001,150423',
'http://assets.ur.se/id/100001/images/1.jpg'
'http://assets.ur.se/id/100001/images/1.jpg',
'http://services.ur.se/search/select?qt=current-products&rows=10&start=0&publicstreaming=NOW&fq=(search_product_type:programtv%20OR%20search_product_type:programradio)',
'http://metadata.ur.se/products.json?ur_product_ids=165422,166790,165412,165070,166257,165368,165367,167372,167373,165146,165008,166807,165463,164971,164976,165152,164975,164974,164973,164972'
]

faked_urls.each do |url|
Expand Down

0 comments on commit ce0d42f

Please sign in to comment.