stock-gains 0.1.7 → 0.1.8

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: de4cfd6bbe80a4fc548c7273064d4043a95e9729
4
- data.tar.gz: 23854415f07f0b24a6f1f2ff3afa5d9b804f43cc
3
+ metadata.gz: c3c1ac60d21ba67fdc8bb677b811af4bc10c75c7
4
+ data.tar.gz: df81a7f2c2b052d9ac9f657ba6d9aa2d5a59bba4
5
5
  SHA512:
6
- metadata.gz: 6cae7f2741f332e72115e9f6025bd1ecc5e1884ff06e6d5e29b768b8e6cbff5c0242f3b0b3334d60b4fadce5e6498be765c000c4c1d20a5c5525e0bd3db4a2f3
7
- data.tar.gz: 11873a9384ad186e6e30ad20fce11544e3ac2d69fa737e3b0c993d216b2b9eea9aeec944cdbed90607c336bf644dd213a671768b11dfb9d91d42db47a52a389b
6
+ metadata.gz: 93eb159d973c6c8c9db3dd982eef1e0332ddf621dff3d610701bba22de4bdc54db23e22137574f25be7974c889cafc4130215735df31d4139ead1c915e605140
7
+ data.tar.gz: 29c21177de1e04c58d51587f8c593e684cf0e3cf58cba78e618a654a25c58a06f0d5a4631189439c329970ac11346ff79df203efa06b5b3afc585dd8d21cafd0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stock-gains (0.1.6)
4
+ stock-gains (0.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,15 +2,22 @@ module StockGains
2
2
  class StockGains::CLI
3
3
 
4
4
  def call
5
- StockGains::Portfolio.new.call
6
- start
5
+ begin
6
+ StockGains::Portfolio.new.call
7
+ start
8
+ rescue
9
+ puts "\n\nTo upload your portfolio to Stock Gains, see installation at:"
10
+ puts "https://github.com/frankNowinski/stock-gains\n\n"
11
+ stock_lookup
12
+ end
13
+ puts "\nGoodbye!"
7
14
  end
8
15
 
9
16
  def start
10
17
  input = ""
11
18
  begin
12
19
  puts "\nTo view more stock information, enter the number associated with"
13
- puts "the stock or enter 'all' to view all of the stocks in your portfolio."
20
+ puts "the stock name in your portfolio or enter 'all' to display all."
14
21
  puts "Separate digits with a space to view multiple stocks."
15
22
  puts "(Enter 'e' at anytime throughout the program to exit)\n\n"
16
23
  input = gets.strip.downcase.scan(/\w+/)
@@ -20,7 +27,6 @@ module StockGains
20
27
  input.first == "all" ? find_all : find(input)
21
28
  stock_lookup
22
29
  end
23
- puts "\nGoodbye!"
24
30
  end
25
31
 
26
32
  def valid_input?(input)
@@ -25,7 +25,7 @@ class StockGains::Portfolio
25
25
  end
26
26
 
27
27
  def calculate_gains
28
- StockGains::Stock.all.each{ |stock| @total += stock.days_value }
28
+ StockGains::Stock.all.collect{ |stock| @total += stock.days_value }
29
29
  @total = @total.round(2).to_f
30
30
  end
31
31
 
@@ -8,8 +8,8 @@ class StockGains::StockLookup
8
8
  def call
9
9
  input = ""
10
10
  loop do
11
- puts "Enter the stock ticker(s) of any stock you'd like to view."
12
- puts "Separated stock tickers with a space.\n\n"
11
+ puts "Enter the stock ticker(s) of any stock you would like to view."
12
+ puts "Separate stock tickers with a space.\n\n"
13
13
  input = gets.strip.downcase
14
14
  break if input == "e" || input == ""
15
15
  tickers << input.strip.scan(/\S[a-zA-Z]+/).join("+").upcase
@@ -1,3 +1,3 @@
1
1
  module StockGains
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
Binary file
@@ -23,4 +23,11 @@ describe 'StockGains::CLI' do
23
23
  expect(cli.valid_input?(["none"])).to be_falsey
24
24
  end
25
25
  end
26
+
27
+ describe 'user inputs' do
28
+ it 'responds to "e"' do
29
+ expect(self).to receive(:gets).and_return('e')
30
+ expect {cli.start}.to output(/Goodbye!/).to_stdout
31
+ end
32
+ end
26
33
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stock-gains
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Nowinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2015-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -148,6 +148,7 @@ files:
148
148
  - spec/03_stock_spec.rb
149
149
  - spec/04_stock_lookup_spec.rb
150
150
  - spec/spec_helper.rb
151
+ - stock-gains-0.1.7.gem
151
152
  - stock-gains.gemspec
152
153
  homepage: https://learn.co
153
154
  licenses: