benschwarz-smoke 0.3.11 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 3
3
- :patch: 11
2
+ :minor: 4
3
+ :patch: 0
4
4
  :major: 0
data/lib/smoke/origin.rb CHANGED
@@ -22,15 +22,14 @@ module Smoke
22
22
  def output(type = :ruby)
23
23
  prepare!
24
24
  dispatch if respond_to? :dispatch
25
- output = (@items.length == 1) ? @items.first : @items
26
25
 
27
26
  case type
28
27
  when :json
29
- return ::JSON.generate(output)
28
+ return ::JSON.generate(@items)
30
29
  when :yaml
31
- return YAML.dump(output)
30
+ return YAML.dump(@items)
32
31
  else
33
- return output
32
+ return @items
34
33
  end
35
34
  end
36
35
 
@@ -24,7 +24,7 @@ describe Smoke::Origin do
24
24
  end
25
25
 
26
26
  it "should output a single hash rather than a hash in an array when there is one item" do
27
- Smoke[:test].truncate(1).output.should == {:title => "Kangaroo", :name => "Kelly"}
27
+ Smoke[:test].truncate(1).output.should == [{:title => "Kangaroo", :name => "Kelly"}]
28
28
  end
29
29
  end
30
30
 
@@ -42,7 +42,7 @@ describe Smoke::Origin do
42
42
  end
43
43
 
44
44
  it "should truncate results given a length" do
45
- Smoke[:test].truncate(1).output.should be_an_instance_of(Hash)
45
+ Smoke[:test].truncate(1).output.size.should == 1
46
46
  end
47
47
 
48
48
  describe "filtering" do
@@ -69,7 +69,7 @@ describe Smoke::Origin do
69
69
  end
70
70
 
71
71
  it "should only contain items that match" do
72
- Smoke[:keep].keep(:head, /^K/).output.should == {:head => "Kangaroo", :name => "Kelly"}
72
+ Smoke[:keep].keep(:head, /^K/).output.should == [{:head => "Kangaroo", :name => "Kelly"}]
73
73
  end
74
74
 
75
75
  it "should discard items" do
@@ -77,7 +77,7 @@ describe Smoke::Origin do
77
77
  end
78
78
 
79
79
  it "should not contain items that match" do
80
- Smoke[:discard].discard(:head, /^K/).output.should == {:head => "Platypus", :name => "Peter"}
80
+ Smoke[:discard].discard(:head, /^K/).output.should == [{:head => "Platypus", :name => "Peter"}]
81
81
  end
82
82
  end
83
83
  end
@@ -73,7 +73,7 @@ describe "YQL" do
73
73
  end
74
74
 
75
75
  it "should be a respository" do
76
- Smoke[:smoke].output.should have_key(:repository)
76
+ Smoke[:smoke].output.first.should have_key(:repository)
77
77
  end
78
78
 
79
79
  it "should respond to use" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benschwarz-smoke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Schwarz