first_gem_better_carl 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 +4 -4
- data/.rspec +2 -0
- data/first_gem_better_carl.gemspec +1 -0
- data/lib/first_gem_better_carl/version.rb +1 -1
- data/spec/first_gem_better_carl_spec.rb +68 -0
- data/spec/spec_helper.rb +12 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dc91db58aeae43d93d4cda4d3c7d7c873a0d0ef
|
4
|
+
data.tar.gz: f22caac3ed097317186d1db8ea9b16fbee1e700e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 475053e44593364c58c8e6ce7e9a0312e0c931ceb91bd8cd92b2a9b4dd4aa181333fef7eacf352aaef0fa32e96e2074e870084ebcccbe79485f1b121da2534fd
|
7
|
+
data.tar.gz: ccab6d8bba5397e557f9293a6cec887ed9db4b76f668932a6be260eedb59a4d3ee03033de2994e28378945001ba6a1ecfa7edf8f42a0bff544d3fe81014cc042
|
data/.rspec
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
describe '#word_count' do
|
5
|
+
it 'should have a method called word_count' do
|
6
|
+
should respond_to :word_count
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should return 1 when the string is one word long' do
|
10
|
+
a_string = 'Apple'
|
11
|
+
expect(a_string.word_count).to eq 1
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should return 0 when the string is blank' do
|
15
|
+
a_string = ''
|
16
|
+
expect(a_string.word_count).to eq 0
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should return 4 when the string is 4 words long' do
|
20
|
+
a_string = 'An apple and banana'
|
21
|
+
expect(a_string.word_count).to eq 4
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'should return 3 when the string is 3 words repeated' do
|
25
|
+
a_string = 'apple apple apple'
|
26
|
+
expect(a_string.word_count).to eq 3
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#unique_words' do
|
31
|
+
it 'should return an array containing the word when the string is only one word long' do
|
32
|
+
a_string = "Apple"
|
33
|
+
expect(a_string.unique_words).to eq ['Apple']
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should return an array containing one word when the string repeats the same word' do
|
37
|
+
a_string = "apple apple apple"
|
38
|
+
expect(a_string.unique_words).to eq ['apple']
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should return an array containing unique words when different words are in the string' do
|
42
|
+
a_string = "apple banana orange"
|
43
|
+
expect(a_string.unique_words).to eq ['apple', 'banana', 'orange']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '#unique_words_count' do
|
48
|
+
it 'should return 1 when the string is one word long' do
|
49
|
+
a_string = 'Apple'
|
50
|
+
expect(a_string.unique_words_count).to eq 1
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should return 0 when the string is blank' do
|
54
|
+
a_string = ''
|
55
|
+
expect(a_string.unique_words_count).to eq 0
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should return 4 when the string is 4 unique words long' do
|
59
|
+
a_string = 'An apple and banana'
|
60
|
+
expect(a_string.unique_words_count).to eq 4
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should return 1 when the string is 3 words repeated' do
|
64
|
+
a_string = 'apple apple apple'
|
65
|
+
expect(a_string.unique_words_count).to eq 1
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -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_better_carl'
|
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_better_carl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Stone
|
@@ -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: ''
|
42
56
|
email:
|
43
57
|
- mikestone14@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_better_carl.gemspec
|
54
69
|
- lib/first_gem_better_carl.rb
|
55
70
|
- lib/first_gem_better_carl/version.rb
|
71
|
+
- spec/first_gem_better_carl_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
56
73
|
homepage: ''
|
57
74
|
licenses:
|
58
75
|
- MIT
|
@@ -77,5 +94,7 @@ rubygems_version: 2.2.0
|
|
77
94
|
signing_key:
|
78
95
|
specification_version: 4
|
79
96
|
summary: This gem adds methods to the String class.
|
80
|
-
test_files:
|
97
|
+
test_files:
|
98
|
+
- spec/first_gem_better_carl_spec.rb
|
99
|
+
- spec/spec_helper.rb
|
81
100
|
has_rdoc:
|