first_gem_david_fisher 0.0.2 → 0.0.3

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: 5ab2cef831cda165d9b39e7ea695ae5f4921a856
4
- data.tar.gz: a6cb62498f4ba8f2164df588b8f0036a2d8f5d6d
3
+ metadata.gz: 1821610ade4aeb77b75b17f18a850cb93c9f5f10
4
+ data.tar.gz: b1d871d23fcacf3641d82320a2babc828fa7ff4c
5
5
  SHA512:
6
- metadata.gz: 93e960ff57cf62e593f4c6ff8377cd432ddca4dc6f12aab94154b675579778ec5c0a8027cb234211b17be2f621ade21758824c2e209f543df7f94d8e34883992
7
- data.tar.gz: bac51b538158101cd456b4eb682e8419709231e8bdefaeb3c911582996eb48819532e629c30eb2da09953adfc2406ce155446ea6c8aaeaf8c5751595225702ef
6
+ metadata.gz: ee4f54eb652f379a8ef7c36b4a3964b6bc96efbc77efd8cd441bbce4bd97f8574a8fc678f56debb8fe8a4be9b12e1a04da37466bfbf6051d1122487283c91adb
7
+ data.tar.gz: c188c49a42edb8be4f4c630bfdd88183ce5c94937831bbb356956336a1c50b0bc3a441627af93ccfb0a0b5c58eee0a21266d9dcc3a35bb90a1495745d74a6ec0
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 FirstGemDavidFisher
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -8,4 +8,8 @@ class String
8
8
  def unique_words
9
9
  self.split.uniq
10
10
  end
11
+
12
+ def unique_word_count
13
+ unique_words.count
14
+ end
11
15
  end
@@ -0,0 +1,74 @@
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
+
39
+ describe String, "#unique_words" do
40
+ it "should have a method called unique_words" do
41
+ should respond_to :unique_words
42
+ end
43
+
44
+ it "should return an array of unique words" do
45
+ a_string = "apple the apple brave cars daring a the question"
46
+ unique_words = a_string.unique_words
47
+ expect(unique_words).to eq ['apple', 'the', 'brave', 'cars', 'daring', 'a', 'question']
48
+ end
49
+
50
+ it "should return an empty array with a string length of zero" do
51
+ a_string = ""
52
+ unique_words = a_string.unique_words
53
+ expect(unique_words).to eq []
54
+ end
55
+ end
56
+
57
+
58
+ describe String, "#unique_word_count" do
59
+ it "should have a method called unique_word_count" do
60
+ should respond_to :unique_word_count
61
+ end
62
+
63
+ it "should return 1 when the string is one word long" do
64
+ a_string = "apple"
65
+ the_unique_word_count = a_string.unique_word_count
66
+ expect(the_unique_word_count).to eq 1
67
+ end
68
+
69
+ it "should return 0 when the string is empty" do
70
+ a_string = ""
71
+ the_unique_word_count = a_string.unique_word_count
72
+ expect(the_unique_word_count).to eq 0
73
+ end
74
+ 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_david_fisher'
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_david_fisher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Fisher
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - '>='
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ~>
47
+ - !ruby/object:Gem::Version
48
+ version: 3.0.0.beta
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: 3.0.0.beta
42
56
  description: A longer description about why I wrote this useless gem that no one should
43
57
  use
44
58
  email:
@@ -49,6 +63,7 @@ extensions: []
49
63
  extra_rdoc_files: []
50
64
  files:
51
65
  - .gitignore
66
+ - .rspec
52
67
  - Gemfile
53
68
  - LICENSE.txt
54
69
  - README.md
@@ -56,6 +71,8 @@ files:
56
71
  - first_gem_david_fisher.gemspec
57
72
  - lib/first_gem_david_fisher.rb
58
73
  - lib/first_gem_david_fisher/version.rb
74
+ - spec/first_gem_david_fisher_spec.rb
75
+ - spec/spec_helper.rb
59
76
  homepage: ''
60
77
  licenses:
61
78
  - MIT
@@ -80,4 +97,6 @@ rubygems_version: 2.1.11
80
97
  signing_key:
81
98
  specification_version: 4
82
99
  summary: My first gem. Doesn't do much
83
- test_files: []
100
+ test_files:
101
+ - spec/first_gem_david_fisher_spec.rb
102
+ - spec/spec_helper.rb