first_gem_libby 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 230ca330eda0a3e77603d53a1a91f132d7aeec9e
4
- data.tar.gz: 6d729e150773a7fa4aeada28a1e3755d1a2d4234
3
+ metadata.gz: cf4eb411eb299ae210368fd6cd6a76b4e34a9053
4
+ data.tar.gz: 6ff75b51ef2d768fd298f2ccf825551614426b7d
5
5
  SHA512:
6
- metadata.gz: cecea57243c49add1b8f8f7beb277ca5f25988ba17747317c0fca38a89545a8c315450b4751172e889285dc00cffb24be905b49d643c31620b385d4ce95956c2
7
- data.tar.gz: 11b1e67578b9ce7244113b1aa0bc2a7b87be44ef321429717f9b20773b2c477dd4946a1846718234a7daae272e34cbeab42a40ec25b9564ce127e0896d799823
6
+ metadata.gz: 87f02fc3df0f8c582ae080b07b856c4911862f9e4a30994088a82c5d367125b1360900ea6ef986824355fec521df861320e813d7d65388abf1b7a321ab8a3e40
7
+ data.tar.gz: 79cfe49014e5b7fb93ca76d1f5a0727d4eb8130671a8f22bcd2c2e7b4005e9078f2177da4b3176b28cf2442addbba58bedf3e63ad1a0cb8309bf47274372f92c
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.5"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", "~> 3.0.0.beta"
23
24
  end
@@ -1,3 +1,3 @@
1
1
  module FirstGemLibby
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -7,4 +7,7 @@ class String
7
7
  def unique_words
8
8
  self.split.uniq
9
9
  end
10
+ def unique_word_count
11
+ unique_words.count
12
+ end
10
13
  end
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+
3
+ describe String, "#word_count" do
4
+ it "should have a method called word_count" do
5
+ should respond_to :word_count
6
+ end
7
+
8
+ it "should return 1 when the string is one word long" do
9
+ a_string = "apple"
10
+ the_word_count = a_string.word_count
11
+ expect(the_word_count).to eq 1
12
+ end
13
+
14
+ it "should return 0 when the string is empty" do
15
+ a_string = ""
16
+ the_word_count = a_string.word_count
17
+ expect(the_word_count).to eq 0
18
+ end
19
+
20
+ it "should return 3 when the string is three words long" do
21
+ a_string = "I am happy"
22
+ the_word_count = a_string.word_count
23
+ expect(the_word_count).to eq 3
24
+ end
25
+
26
+ it "should return 2 when the string is two words long" do
27
+ a_string = "You're cool"
28
+ the_word_count = a_string.word_count
29
+ expect(the_word_count).to eq 2
30
+ end
31
+
32
+ it "should return 3 when the string is three words repeated" do
33
+ a_string = "buffalo buffalo buffalo"
34
+ the_word_count = a_string.word_count
35
+ expect(the_word_count).to eq 3
36
+ end
37
+ end
38
+ describe String, "#unique_words" do
39
+ it "should have a method called unique_words" do
40
+ should respond_to :unique_words
41
+ end
42
+
43
+ it "should return an array of unique words" do
44
+ a_string = "apple the apple brave cars daring a the question"
45
+ unique_words = a_string.unique_words
46
+ expect(unique_words).to eq ['apple', 'the', 'brave', 'cars', 'daring', 'a', 'question']
47
+ end
48
+
49
+ it "should return an empty array with a string length of zero" do
50
+ a_string = ""
51
+ unique_words = a_string.unique_words
52
+ expect(unique_words).to eq []
53
+ end
54
+ end
55
+
56
+
57
+ describe String, "#unique_word_count" do
58
+ it "should have a method called unique_word_count" do
59
+ should respond_to :unique_word_count
60
+ end
61
+
62
+ it "should return 1 when the string is one word long" do
63
+ a_string = "apple"
64
+ the_unique_word_count = a_string.unique_word_count
65
+ expect(the_unique_word_count).to eq 1
66
+ end
67
+
68
+ it "should return 0 when the string is empty" do
69
+ a_string = ""
70
+ the_unique_word_count = a_string.unique_word_count
71
+ expect(the_unique_word_count).to eq 0
72
+ end
73
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'first_gem_libby'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: first_gem_libby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elisabeth Waltz
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0.beta
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0.beta
41
55
  description: My first gem. Doesn't do much
42
56
  email:
43
57
  - elisabeth.waltz@gmail.com
@@ -46,6 +60,7 @@ extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
62
  - ".gitignore"
63
+ - ".rspec"
49
64
  - Gemfile
50
65
  - LICENSE.txt
51
66
  - README.md
@@ -53,6 +68,8 @@ files:
53
68
  - first_gem_libby.gemspec
54
69
  - lib/first_gem_libby.rb
55
70
  - lib/first_gem_libby/version.rb
71
+ - spec/first_gem_libby_spec.rb
72
+ - spec/spec_helper.rb
56
73
  homepage: ''
57
74
  licenses:
58
75
  - MIT
@@ -77,4 +94,6 @@ rubygems_version: 2.2.1
77
94
  signing_key:
78
95
  specification_version: 4
79
96
  summary: My first gem. Doesn't do much
80
- test_files: []
97
+ test_files:
98
+ - spec/first_gem_libby_spec.rb
99
+ - spec/spec_helper.rb