briandunn-a2ws 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/a2ws.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{a2ws}
5
- s.version = "0.1.10"
5
+ s.version = "0.1.11"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andy Shen", "Josh Owens"]
@@ -8,7 +8,7 @@ module A2WS
8
8
 
9
9
  items = result["ItemSearchResponse"]["Items"]
10
10
  if items['Request']['IsValid'] == 'True'
11
- [ items['Item'] ].flatten.collect do |i|
11
+ [ items['Item'] ].flatten.compact.collect do |i|
12
12
  Item.new downcase_keys(i)
13
13
  end
14
14
  else
data/spec/a2ws_spec.rb CHANGED
@@ -7,10 +7,15 @@ describe "A2WS Operations" do
7
7
  describe ItemSearch do
8
8
 
9
9
  it "should survive a search that returns a single result" do
10
- ItemSearch.should_receive(:get).and_return(YAML.load(File.open(File.expand_path(File.dirname(__FILE__) + '/fixtures/single_item_response.yml'))))
10
+ ItemSearch.should_receive(:get).and_return(fixture :single_item_response)
11
11
  ItemSearch.find('not used')
12
12
  end
13
13
 
14
+ it "should return an empty array when there aint no results" do
15
+ ItemSearch.should_receive(:get).and_return(fixture :empty_response)
16
+ ItemSearch.find( "not used" ).should == []
17
+ end
18
+
14
19
  end
15
20
 
16
21
  end
data/spec/spec_helper.rb CHANGED
@@ -7,5 +7,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
7
  require 'a2ws'
8
8
 
9
9
  Spec::Runner.configure do |config|
10
-
10
+ def fixture file_name
11
+ YAML.load(File.open(File.expand_path(File.dirname(__FILE__) + "/fixtures/#{file_name}.yml")))
12
+ end
11
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: briandunn-a2ws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Shen