grocery_list 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c08af85be634afbb4f912332746152da9d682304
4
- data.tar.gz: f3603ba95a08980c9c901a50b5d276b6cf7af355
3
+ metadata.gz: add3e51c389bbc5029f42a2997b241b5745e15e0
4
+ data.tar.gz: 727c52882b5ea3207198db2afbce386567fa7865
5
5
  SHA512:
6
- metadata.gz: 9fac06fe431c682442997a80b4a726777c90525cabba030070717f13261fcc7d52423820b068105a084911cc4f2c92c1a58015f11c3e1b1a236a3e620e77a1cc
7
- data.tar.gz: 38c6fe94ca1c7900ebf7c2c905b94505a5bab775cb35567303e5d769222e1c8f9a93831e5d6a58e05af454f03649fc1dd28d443af59ac3f8f8ec9eba3c6459c0
6
+ metadata.gz: dbb9bb8536209bd2f22c3adf251ae057e90babfcffce95425411d2b170d030cc4035f182415020ac25b337f34fb890834d42a68f1a8a71b89842bb6099fea098
7
+ data.tar.gz: 57134b07f56fff4d89b5f5057052aadc4574c2333a726a8dcdba3b3ab8f2b7feff459aedb6ca5db13fd172fdf264502ac4f627e54c8e762eeff0edfb678c1f6c
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - "2.0.0"
4
+ - "1.9.2"
5
+ - "1.9.3"
6
+ - jruby-19mode # JRuby in 1.9 mode
7
+ - rbx
8
+ # uncomment this line if your project needs to run something other than `rake`:
9
+ script: bundle exec rspec spec
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # Grocery-list
2
+ ![Build Status](https://travis-ci.org/charlespwd/grocery-list.svg?branch=master)
3
+ [![Coverage
4
+ Status](https://coveralls.io/repos/charlespwd/grocery-list/badge.png)](https://coveralls.io/r/charlespwd/grocery-list)
5
+
2
6
  Turn your json, csv, md, or strings into grocery lists that you can
3
7
  then search for.
4
8
 
data/grocery_list.gemspec CHANGED
@@ -20,4 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency "launchy", "~> 2.4"
22
22
  spec.add_development_dependency "bundler", "~> 1.5"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "simplecov"
25
+ spec.add_development_dependency "coveralls"
23
26
  end
@@ -20,15 +20,14 @@ module GroceryList
20
20
  Launchy.open url(item.item_name)
21
21
  end
22
22
 
23
+ def search_options
24
+ @search_options
25
+ end
23
26
  def search_options=(option = :priceAsc)
24
27
  raise ArgumentError, "#{option} is an invalid option" unless @@valid_options.include? option
25
28
  @search_options = option
26
29
  end
27
30
 
28
- def search_options
29
- @search_options
30
- end
31
-
32
31
  private
33
32
  def url(item_name)
34
33
  "#{@@search_url}#{url_encode(item_name)}#{encoded_options}"
@@ -39,7 +38,7 @@ module GroceryList
39
38
  end
40
39
 
41
40
  def encoded_options
42
- @search_options ? "&sort=#{@search_options.to_s}" : ""
41
+ search_options ? "&sort=#{search_options.to_s}" : ""
43
42
  end
44
43
  end
45
44
  end
@@ -1,3 +1,3 @@
1
1
  module GroceryList
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/grocery_list.rb CHANGED
@@ -25,7 +25,7 @@ module GroceryList
25
25
  private
26
26
  def validate_input(items_source, searcher)
27
27
  raise ArgumentError, "isn't a valid source" unless is_valid_source? items_source
28
- raise ArgumentError, "searcher isn't a AbstractSearcher" unless searcher.is_a? AbstractSearcher
28
+ raise ArgumentError, "searcher isn't a AbstractSearcher" unless searcher.kind_of? AbstractSearcher
29
29
  @items = items_from_source(items_source)
30
30
  @searcher = searcher
31
31
  end
@@ -1,9 +1,6 @@
1
- require 'grocery_list'
1
+ require 'spec_helper'
2
2
  require './spec/stubs/IGASearcherStub'
3
3
 
4
- ITEMS_AS_STRING = "bread, philadelphia, bagel all dressed"
5
- ITEMS_AS_JSON = '["bread", "philadelphia", "bagel all dressed"]'
6
-
7
4
  describe GroceryList do
8
5
  it "should accept a list as a string and a searcher" do
9
6
  expect { GroceryList.search_all(ITEMS_AS_STRING, IGASearcherStub.new) }.to_not raise_error
@@ -1,13 +1,10 @@
1
- require 'grocery_list'
2
-
3
- ITEMS_AS_STRING = "bread, philadelphia, bagel all dressed"
4
- ITEMS_AS_JSON = '["bread", "philadelphia", "bagel all dressed"]'
1
+ require 'spec_helper'
5
2
 
6
3
  describe GroceryList::AbstractItemParser do
7
4
  let(:reader) { GroceryList::AbstractItemParser }
8
5
 
9
6
  it "should have an unimplemented read method" do
10
- expect{ reader.read }.to raise_error
7
+ expect{ reader.read('tostitos') }.to raise_error
11
8
  end
12
9
  end
13
10
 
@@ -25,7 +22,7 @@ describe GroceryList::FileItemParser do
25
22
 
26
23
  it "should raise an error if no files are found" do
27
24
  expect{ reader.read('null') }.to raise_error
28
- expect{ reader.read('./spec/lib/searcher_spec.rb') }.to_not raise_error
25
+ expect{ reader.read('./spec/spec_helper.rb') }.to_not raise_error
29
26
  end
30
27
 
31
28
  it "should only read lines prefixed by a star" do
@@ -1,4 +1,5 @@
1
- require "grocery_list"
1
+ require "spec_helper"
2
+
2
3
  require "./spec/stubs/IGASearcherStub"
3
4
 
4
5
  describe GroceryList::AbstractSearcher do
@@ -16,11 +17,12 @@ describe GroceryList::IGASearcher do
16
17
  end
17
18
 
18
19
  it "should throw an error if trying to set an invalid option" do
19
- searcher = IGASearcherStub.new
20
+ searcher = GroceryList::IGASearcher.new
20
21
  expect { searcher.search_options = :invalid }.to raise_error
21
22
  expect { searcher.search_options = :priceAsc }.to_not raise_error
22
23
  expect { searcher.search_options = :priceDesc }.to_not raise_error
23
24
  expect { searcher.search_options = :DisplayNameAsc }.to_not raise_error
24
25
  expect { searcher.search_options = :DisplayNameDesc }.to_not raise_error
26
+ expect { searcher.search(GroceryList::Item.new('tostitos')) }.to_not raise_error
25
27
  end
26
28
  end
@@ -0,0 +1,7 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+ Coveralls.wear!
4
+
5
+ ITEMS_AS_STRING = "bread, philadelphia, bagel all dressed"
6
+ ITEMS_AS_JSON = '["bread", "philadelphia", "bagel all dressed"]'
7
+ require 'grocery_list'
@@ -3,6 +3,5 @@ require "grocery_list"
3
3
  class IGASearcherStub < GroceryList::IGASearcher
4
4
  def search(item)
5
5
  raise ArgumentError, "#{item} isn't an Item" unless item.is_a? GroceryList::Item
6
- puts url(item.item_name)
7
6
  end
8
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grocery_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles-P. Clermont
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  description:
42
84
  email:
43
85
  - charles.pclermont@gmail.com
@@ -46,6 +88,7 @@ extensions: []
46
88
  extra_rdoc_files: []
47
89
  files:
48
90
  - .gitignore
91
+ - .travis.yml
49
92
  - Gemfile
50
93
  - LICENSE.txt
51
94
  - README.md
@@ -61,9 +104,10 @@ files:
61
104
  - lib/grocery_list/item_searchers/iga_item_searcher.rb
62
105
  - lib/grocery_list/version.rb
63
106
  - spec/fixtures/list_test.md
64
- - spec/lib/groceries_spec.rb
65
- - spec/lib/item_reader_spec.rb
66
- - spec/lib/searcher_spec.rb
107
+ - spec/groceries_spec.rb
108
+ - spec/item_parsers_spec.rb
109
+ - spec/item_searchers_spec.rb
110
+ - spec/spec_helper.rb
67
111
  - spec/stubs/IGASearcherStub.rb
68
112
  homepage: https://github.com/charlespwd/grocery-list
69
113
  licenses:
@@ -92,7 +136,8 @@ summary: Turn your json, csv, md, or strings into grocery lists that you can the
92
136
  search for.
93
137
  test_files:
94
138
  - spec/fixtures/list_test.md
95
- - spec/lib/groceries_spec.rb
96
- - spec/lib/item_reader_spec.rb
97
- - spec/lib/searcher_spec.rb
139
+ - spec/groceries_spec.rb
140
+ - spec/item_parsers_spec.rb
141
+ - spec/item_searchers_spec.rb
142
+ - spec/spec_helper.rb
98
143
  - spec/stubs/IGASearcherStub.rb