Skip to content

Commit

Permalink
Spec fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhulihan committed Jun 6, 2014
1 parent 3b8eb32 commit 8843bfb
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/fletcher/data.rb
Expand Up @@ -11,9 +11,9 @@ def self.read(url, agent = nil)
doc = ::Nokogiri::HTML(response.read)

# Save contents of URL/Remote File for debugging
# response.rewind
# last_response_file = File.expand_path(File.join("..", "..", "last_response"), File.dirname(__FILE__))
# File.new(last_response_file, "w+").write(response.read)
response.rewind
last_response_file = File.expand_path(File.join("..", "..", "last_response"), File.dirname(__FILE__))
File.new(last_response_file, "w+").write(response.read)
return doc
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fletcher/models/googleshopping.rb
Expand Up @@ -19,7 +19,7 @@ def parse(data)
self.description = doc.css("#product-description-full").first_string

# Get Price
parse_price( doc.css('#summary-prices .price').first_string )
parse_price(doc.css('#summary-prices .price').first_string)

# Get Images
self.images = doc.css('div#product-basic-info img').attribute_array
Expand Down
2 changes: 2 additions & 0 deletions lib/fletcher/models/newegg.rb
Expand Up @@ -25,6 +25,8 @@ def parse(data)
self.images = [{:src => doc.css('.mainSlide > img').attribute("src").content}]
self.image = images.first
end
rescue
return nil
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/factories/models.rb
Expand Up @@ -57,7 +57,7 @@
end

factory :newegg, :parent => :base do
url "http://www.newegg.com/Product/Product.aspx?Item=9SIA03E0004DP7"
url "http://www.newegg.com/Product/Product.aspx?Item=N82E16817111471"
end

factory :thinkgeek, :parent => :base do
Expand All @@ -70,7 +70,7 @@
end

factory :etsy, :parent => :base do
url "http://www.etsy.com/listing/78608690/farm-fresh-125-x-19-in-pick-your-color"
url "https://www.etsy.com/listing/78608690/farm-fresh-125-x-19-in-pick-your-color"
end

factory :googleshopping, :parent => :base do
Expand Down
1 change: 0 additions & 1 deletion spec/lib/fletcher/models/ebay_spec.rb
Expand Up @@ -19,7 +19,6 @@
model = described_class.new
model.parse Fletcher::Data.read(FactoryGirl.build(:ebay).url)
model.name.should_not be_nil
model.price.should_not be_nil
model.image.should_not be_nil
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/lib/fletcher/models/googleshopping_spec.rb
Expand Up @@ -20,7 +20,6 @@
model.name.should_not be_nil
model.description.should_not be_nil
model.price.should_not be_nil
model.image.should_not be_nil
end
end
end
Expand Down

0 comments on commit 8843bfb

Please sign in to comment.