lucy-goosey 0.0.2 → 0.0.3

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/lib/lucy-goosey.rb CHANGED
@@ -16,6 +16,9 @@ module Lucy
16
16
  args = _args.dup
17
17
  config = {}
18
18
 
19
+ raise ArgumentError, 'must be an array' unless _args.is_a? Array
20
+ return config if _args.empty?
21
+
19
22
  args = args[1..-1] while leading_word?(args.first)
20
23
 
21
24
  args.size.times do
@@ -1,5 +1,5 @@
1
1
  module Lucy
2
2
  module Goosey
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -5,6 +5,11 @@ describe Lucy::Goosey do
5
5
  describe "::parse_options" do
6
6
 
7
7
  describe "simple cases" do
8
+ it "returns empty hash with empty array" do
9
+ result = Lucy::Goosey.parse_options([])
10
+ result.must_equal({})
11
+ end
12
+
8
13
  it "understands -n" do
9
14
  result = Lucy::Goosey.parse_options(%w(-n))
10
15
  result.must_equal({'n' => true})
@@ -99,6 +104,14 @@ describe Lucy::Goosey do
99
104
  end
100
105
  end
101
106
 
107
+ describe "bad input" do
108
+ it "expects an array" do
109
+ assert_raises ArgumentError do
110
+ Lucy::Goosey.parse_options('')
111
+ end
112
+ end
113
+ end
114
+
102
115
  describe "edge cases" do
103
116
  it "ignores leading words" do
104
117
  result = Lucy::Goosey.parse_options(%w(wtf bbq --bar foo=baz --baz=bar -n 1 --bap))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucy-goosey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  segments:
76
76
  - 0
77
- hash: -3205257808649039205
77
+ hash: -3049025354752944402
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  none: false
80
80
  requirements:
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  segments:
85
85
  - 0
86
- hash: -3205257808649039205
86
+ hash: -3049025354752944402
87
87
  requirements: []
88
88
  rubyforge_project:
89
89
  rubygems_version: 1.8.23