coined 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dfd9a9badab30acbcb3df67ed39bf745cfa166cc
4
+ data.tar.gz: 03154a1d57c845319b96d9b53f64776d7b81bf65
5
+ SHA512:
6
+ metadata.gz: 36e22d63224056025bfd6052c519b9f4becda4b49c9f722d0c75afe2663d5af48f3acfb644dc4ed4ada88619d9fc83df8dad154281ae6270afb87afd0cc0bda9
7
+ data.tar.gz: cb979eb04c91cfcf5cc900e40494150fa397f3f89f45eb2a94051fceac507da8a08c5011f03a6ad5d5d4c9b01dcc6fbd750cefc205ff379483d7a841bddc0048
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,9 @@
1
+ # Custom rules
2
+
3
+ Metrics/LineLength:
4
+ Max: 120
5
+
6
+ # Disabled cops
7
+
8
+ Style/Documentation:
9
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - 2.1.5
5
+ - 2.1.0
6
+ - 2.0.0
7
+ - 1.9.3
8
+ script: bundle exec rake test
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in coined.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Rafaël Gonzalez
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Coined
2
+
3
+ ![Coin](./coin.png)
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/coined.svg)](http://badge.fury.io/rb/coined)
6
+ [![Dependency Status](https://gemnasium.com/rafaelgonzalez/coined.svg)](https://gemnasium.com/rafaelgonzalez/coined)
7
+ [![Build Status](https://travis-ci.org/rafaelgonzalez/coined.svg?branch=master)](https://travis-ci.org/rafaelgonzalez/coined)
8
+ [![Test Coverage](https://codeclimate.com/github/rafaelgonzalez/coined/coverage.svg)](https://codeclimate.com/github/rafaelgonzalez/coined)
9
+ [![Code Climate](https://codeclimate.com/github/rafaelgonzalez/coined.svg)](https://codeclimate.com/github/rafaelgonzalez/coined)
10
+
11
+ A gem that keeps your coins in a purse.
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'coined', '~> 0.1.0'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install coined
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ task default: :test
8
+
9
+ desc 'Run the test suite'
10
+ task test: [:spec, :rubocop]
11
+
12
+ RuboCop::RakeTask.new(:rubocop) do |task|
13
+ task.options = ['-D']
14
+ end
data/coin.png ADDED
Binary file
data/coined.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'coined/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'coined'
8
+ spec.version = Coined::VERSION
9
+ spec.authors = ['Rafaël Gonzalez']
10
+ spec.email = ['rafaelgonzalez@users.noreply.github.com']
11
+ spec.summary = 'A gem that keeps your coins in a purse'
12
+ spec.description = 'A gem that keeps your coins in a purse'
13
+ spec.homepage = 'https://github.com/rafaelgonzalez/coined'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'rspec', '~> 3.2.0'
23
+ spec.add_development_dependency 'simplecov', '~> 0.9.2'
24
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4.7'
25
+ spec.add_development_dependency 'rubocop', '~> 0.30.1'
26
+ end
data/lib/coined.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'coined/coin'
2
+ require 'coined/purse'
3
+ require 'coined/version'
4
+
5
+ module Coined
6
+ end
@@ -0,0 +1,6 @@
1
+ require 'bigdecimal'
2
+
3
+ require 'coined/coin/copper'
4
+ require 'coined/coin/gold'
5
+ require 'coined/coin/platinum'
6
+ require 'coined/coin/silver'
@@ -0,0 +1,13 @@
1
+ require 'coined/coin/silver'
2
+
3
+ module Coined
4
+ module Coin
5
+ module Copper
6
+ GOLD_VALUE = 0.01
7
+
8
+ def self.value(coin)
9
+ (BigDecimal.new(GOLD_VALUE.to_s).div(BigDecimal.new(coin::GOLD_VALUE.to_s), 3)).to_f
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ require 'coined/coin/silver'
2
+ require 'coined/coin/platinum'
3
+
4
+ module Coined
5
+ module Coin
6
+ module Gold
7
+ GOLD_VALUE = 1.0
8
+
9
+ def self.value(coin)
10
+ (BigDecimal.new(GOLD_VALUE.to_s).div(BigDecimal.new(coin::GOLD_VALUE.to_s), 3)).to_f
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ require 'coined/coin/gold'
2
+
3
+ module Coined
4
+ module Coin
5
+ module Platinum
6
+ GOLD_VALUE = 10.0
7
+
8
+ def self.value(coin)
9
+ (BigDecimal.new(GOLD_VALUE.to_s).div(BigDecimal.new(coin::GOLD_VALUE.to_s), 3)).to_f
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ require 'coined/coin/copper'
2
+ require 'coined/coin/gold'
3
+
4
+ module Coined
5
+ module Coin
6
+ module Silver
7
+ GOLD_VALUE = 0.1
8
+
9
+ def self.value(coin)
10
+ (BigDecimal.new(GOLD_VALUE.to_s).div(BigDecimal.new(coin::GOLD_VALUE.to_s), 3)).to_f
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,38 @@
1
+ module Coined
2
+ class Purse
3
+ attr_reader :coins
4
+
5
+ def initialize(copper = 0, silver = 0, gold = 0, platinum = 0)
6
+ @coins = []
7
+
8
+ add_coins(Coin::Copper, copper)
9
+ add_coins(Coin::Silver, silver)
10
+ add_coins(Coin::Gold, gold)
11
+ add_coins(Coin::Platinum, platinum)
12
+ end
13
+
14
+ def add_coins(coin_type, amount)
15
+ @coins += Array.new(amount, coin_type)
16
+ end
17
+
18
+ def remove_coins(coin_type, amount)
19
+ amount.times do
20
+ break if @coins.index(coin_type).nil?
21
+
22
+ @coins.delete_at(@coins.rindex(coin_type))
23
+ end
24
+
25
+ @coins
26
+ end
27
+
28
+ def amount(coin_type)
29
+ @coins.count(coin_type)
30
+ end
31
+
32
+ def value(coin_type)
33
+ coins.map do |coin|
34
+ BigDecimal.new(coin.value(coin_type).to_s)
35
+ end.inject(&:+).to_f
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,3 @@
1
+ module Coined
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,31 @@
1
+ RSpec.describe Coined::Coin::Copper do
2
+ it { expect(described_class::GOLD_VALUE).to eql 0.01 }
3
+
4
+ describe '.value' do
5
+ subject { described_class.value(coin) }
6
+
7
+ context 'with Coin::Copper' do
8
+ let(:coin) { Coined::Coin::Copper }
9
+
10
+ it { is_expected.to eql 1.0 }
11
+ end
12
+
13
+ context 'with Coin::Silver' do
14
+ let(:coin) { Coined::Coin::Silver }
15
+
16
+ it { is_expected.to eql 0.1 }
17
+ end
18
+
19
+ context 'with Coin::Gold' do
20
+ let(:coin) { Coined::Coin::Gold }
21
+
22
+ it { is_expected.to eql 0.01 }
23
+ end
24
+
25
+ context 'with Coin::Platinum' do
26
+ let(:coin) { Coined::Coin::Platinum }
27
+
28
+ it { is_expected.to eql 0.001 }
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ RSpec.describe Coined::Coin::Gold do
2
+ it { expect(described_class::GOLD_VALUE).to eql 1.0 }
3
+
4
+ describe '.value' do
5
+ subject { described_class.value(coin) }
6
+
7
+ context 'with Coin::Copper' do
8
+ let(:coin) { Coined::Coin::Copper }
9
+
10
+ it { is_expected.to eql 100.0 }
11
+ end
12
+
13
+ context 'with Coin::Silver' do
14
+ let(:coin) { Coined::Coin::Silver }
15
+
16
+ it { is_expected.to eql 10.0 }
17
+ end
18
+
19
+ context 'with Coin::Gold' do
20
+ let(:coin) { Coined::Coin::Gold }
21
+
22
+ it { is_expected.to eql 1.0 }
23
+ end
24
+
25
+ context 'with Coin::Platinum' do
26
+ let(:coin) { Coined::Coin::Platinum }
27
+
28
+ it { is_expected.to eql 0.1 }
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ RSpec.describe Coined::Coin::Platinum do
2
+ it { expect(described_class::GOLD_VALUE).to eql 10.0 }
3
+
4
+ describe '.value' do
5
+ subject { described_class.value(coin) }
6
+
7
+ context 'with Coin::Copper' do
8
+ let(:coin) { Coined::Coin::Copper }
9
+
10
+ it { is_expected.to eql 1000.0 }
11
+ end
12
+
13
+ context 'with Coin::Silver' do
14
+ let(:coin) { Coined::Coin::Silver }
15
+
16
+ it { is_expected.to eql 100.0 }
17
+ end
18
+
19
+ context 'with Coin::Gold' do
20
+ let(:coin) { Coined::Coin::Gold }
21
+
22
+ it { is_expected.to eql 10.0 }
23
+ end
24
+
25
+ context 'with Coin::Platinum' do
26
+ let(:coin) { Coined::Coin::Platinum }
27
+
28
+ it { is_expected.to eql 1.0 }
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ RSpec.describe Coined::Coin::Silver do
2
+ it { expect(described_class::GOLD_VALUE).to eql 0.1 }
3
+
4
+ describe '.value' do
5
+ subject { described_class.value(coin) }
6
+
7
+ context 'with Coin::Copper' do
8
+ let(:coin) { Coined::Coin::Copper }
9
+
10
+ it { is_expected.to eql 10.0 }
11
+ end
12
+
13
+ context 'with Coin::Silver' do
14
+ let(:coin) { Coined::Coin::Silver }
15
+
16
+ it { is_expected.to eql 1.0 }
17
+ end
18
+
19
+ context 'with Coin::Gold' do
20
+ let(:coin) { Coined::Coin::Gold }
21
+
22
+ it { is_expected.to eql 0.1 }
23
+ end
24
+
25
+ context 'with Coin::Platinum' do
26
+ let(:coin) { Coined::Coin::Platinum }
27
+
28
+ it { is_expected.to eql 0.01 }
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,200 @@
1
+ RSpec.describe Coined::Purse do
2
+ describe '#initialize' do
3
+ subject { described_class.new(copper, silver, gold, platinum) }
4
+
5
+ context 'without zero coins' do
6
+ let(:copper) { 0 }
7
+ let(:silver) { 0 }
8
+ let(:gold) { 0 }
9
+ let(:platinum) { 0 }
10
+
11
+ it { expect(subject.coins).to be_empty }
12
+ end
13
+
14
+ context 'with coin amounts' do
15
+ let(:copper) { 10 }
16
+ let(:silver) { 23 }
17
+ let(:gold) { 3 }
18
+ let(:platinum) { 1 }
19
+
20
+ it { expect(subject.coins.size).to eql 37 }
21
+ it { expect(subject.amount(Coined::Coin::Copper)).to eql 10 }
22
+ it { expect(subject.amount(Coined::Coin::Silver)).to eql 23 }
23
+ it { expect(subject.amount(Coined::Coin::Gold)).to eql 3 }
24
+ it { expect(subject.amount(Coined::Coin::Platinum)).to eql 1 }
25
+ end
26
+ end
27
+
28
+ describe '#add_coins' do
29
+ subject { purse.add_coins(coin_type, amount) }
30
+
31
+ let(:purse) { described_class.new(11, 5, 14, 20) }
32
+
33
+ context 'adding copper' do
34
+ let(:coin_type) { Coined::Coin::Copper }
35
+ let(:amount) { 27 }
36
+
37
+ it { expect { subject }.to change { purse.coins.size }.by(27) }
38
+
39
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Copper) }.from(11).to(38) }
40
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
41
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
42
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
43
+ end
44
+
45
+ context 'adding silver' do
46
+ let(:coin_type) { Coined::Coin::Silver }
47
+ let(:amount) { 9 }
48
+
49
+ it { expect { subject }.to change { purse.coins.size }.by(9) }
50
+
51
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
52
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Silver) }.from(5).to(14) }
53
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
54
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
55
+ end
56
+
57
+ context 'adding gold' do
58
+ let(:coin_type) { Coined::Coin::Gold }
59
+ let(:amount) { 36 }
60
+
61
+ it { expect { subject }.to change { purse.coins.size }.by(36) }
62
+
63
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
64
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
65
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Gold) }.from(14).to(50) }
66
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
67
+ end
68
+
69
+ context 'adding platinum' do
70
+ let(:coin_type) { Coined::Coin::Platinum }
71
+ let(:amount) { 15 }
72
+
73
+ it { expect { subject }.to change { purse.coins.size }.by(15) }
74
+
75
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
76
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
77
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
78
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Platinum) }.from(20).to(35) }
79
+ end
80
+ end
81
+
82
+ describe '#remove_coins' do
83
+ subject { purse.remove_coins(coin_type, amount) }
84
+
85
+ let(:purse) { described_class.new(11, 5, 14, 20) }
86
+
87
+ context 'removing copper' do
88
+ let(:coin_type) { Coined::Coin::Copper }
89
+ let(:amount) { 4 }
90
+
91
+ it { expect { subject }.to change { purse.coins.size }.by(-4) }
92
+
93
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Copper) }.from(11).to(7) }
94
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
95
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
96
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
97
+ end
98
+
99
+ context 'removing silver' do
100
+ let(:coin_type) { Coined::Coin::Silver }
101
+ let(:amount) { 5 }
102
+
103
+ it { expect { subject }.to change { purse.coins.size }.by(-5) }
104
+
105
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
106
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Silver) }.from(5).to(0) }
107
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
108
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
109
+ end
110
+
111
+ context 'removing gold' do
112
+ let(:coin_type) { Coined::Coin::Gold }
113
+ let(:amount) { 20 }
114
+
115
+ it { expect { subject }.to change { purse.coins.size }.by(-14) }
116
+
117
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
118
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
119
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Gold) }.from(14).to(0) }
120
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Platinum) } }
121
+ end
122
+
123
+ context 'removing platinum' do
124
+ let(:coin_type) { Coined::Coin::Platinum }
125
+ let(:amount) { 14 }
126
+
127
+ it { expect { subject }.to change { purse.coins.size }.by(-14) }
128
+
129
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Copper) } }
130
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Silver) } }
131
+ it { expect { subject }.not_to change { purse.amount(Coined::Coin::Gold) } }
132
+ it { expect { subject }.to change { purse.amount(Coined::Coin::Platinum) }.from(20).to(6) }
133
+ end
134
+ end
135
+
136
+ describe '#amount' do
137
+ subject { purse.amount(coin_type) }
138
+
139
+ let(:purse) { described_class.new(20, 12, 6, 2) }
140
+
141
+ context 'of copper' do
142
+ let(:coin_type) { Coined::Coin::Copper }
143
+
144
+ it { is_expected.to eql 20 }
145
+ end
146
+
147
+ context 'of silver' do
148
+ let(:coin_type) { Coined::Coin::Silver }
149
+
150
+ it { is_expected.to eql 12 }
151
+ end
152
+
153
+ context 'of gold' do
154
+ let(:coin_type) { Coined::Coin::Gold }
155
+
156
+ it { is_expected.to eql 6 }
157
+ end
158
+
159
+ context 'of platinum' do
160
+ let(:coin_type) { Coined::Coin::Platinum }
161
+
162
+ it { is_expected.to eql 2 }
163
+ end
164
+ end
165
+
166
+ describe '#value' do
167
+ subject { purse.value(coin_type) }
168
+
169
+ let(:purse) { described_class.new(copper, silver, gold, platinum) }
170
+
171
+ let(:copper) { 153 }
172
+ let(:silver) { 62 }
173
+ let(:gold) { 21 }
174
+ let(:platinum) { 7 }
175
+
176
+ context 'with Coin::Copper' do
177
+ let(:coin_type) { Coined::Coin::Copper }
178
+
179
+ it { is_expected.to eql 9873.0 }
180
+ end
181
+
182
+ context 'with Coin::Silver' do
183
+ let(:coin_type) { Coined::Coin::Silver }
184
+
185
+ it { is_expected.to eql 987.3 }
186
+ end
187
+
188
+ context 'with Coin::Gold' do
189
+ let(:coin_type) { Coined::Coin::Gold }
190
+
191
+ it { is_expected.to eql 98.73 }
192
+ end
193
+
194
+ context 'with Coin::Platinum' do
195
+ let(:coin_type) { Coined::Coin::Platinum }
196
+
197
+ it { is_expected.to eql 9.873 }
198
+ end
199
+ end
200
+ end
@@ -0,0 +1,99 @@
1
+ require 'coined'
2
+ require 'simplecov'
3
+ require 'codeclimate-test-reporter'
4
+
5
+ SimpleCov.start
6
+ SimpleCov.minimum_coverage 100
7
+
8
+ CodeClimate::TestReporter.start
9
+
10
+ # This file was generated by the `rspec --init` command. Conventionally, all
11
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
12
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
13
+ # this file to always be loaded, without a need to explicitly require it in any
14
+ # files.
15
+ #
16
+ # Given that it is always loaded, you are encouraged to keep this file as
17
+ # light-weight as possible. Requiring heavyweight dependencies from this file
18
+ # will add to the boot time of your test suite on EVERY test run, even for an
19
+ # individual file that may not need all of that loaded. Instead, consider making
20
+ # a separate helper file that requires the additional dependencies and performs
21
+ # the additional setup, and require it from the spec files that actually need
22
+ # it.
23
+ #
24
+ # The `.rspec` file also contains a few flags that are not defaults but that
25
+ # users commonly want.
26
+ #
27
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
28
+ RSpec.configure do |config|
29
+ # rspec-expectations config goes here. You can use an alternate
30
+ # assertion/expectation library such as wrong or the stdlib/minitest
31
+ # assertions if you prefer.
32
+ config.expect_with :rspec do |expectations|
33
+ # This option will default to `true` in RSpec 4. It makes the `description`
34
+ # and `failure_message` of custom matchers include text for helper methods
35
+ # defined using `chain`, e.g.:
36
+ # be_bigger_than(2).and_smaller_than(4).description
37
+ # # => "be bigger than 2 and smaller than 4"
38
+ # ...rather than:
39
+ # # => "be bigger than 2"
40
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
41
+ end
42
+
43
+ # rspec-mocks config goes here. You can use an alternate test double
44
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
45
+ config.mock_with :rspec do |mocks|
46
+ # Prevents you from mocking or stubbing a method that does not exist on
47
+ # a real object. This is generally recommended, and will default to
48
+ # `true` in RSpec 4.
49
+ mocks.verify_partial_doubles = true
50
+ end
51
+
52
+ # The settings below are suggested to provide a good initial experience
53
+ # with RSpec, but feel free to customize to your heart's content.
54
+
55
+ # These two settings work together to allow you to limit a spec run
56
+ # to individual examples or groups you care about by tagging them with
57
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
58
+ # get run.
59
+ config.filter_run :focus
60
+ config.run_all_when_everything_filtered = true
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
65
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
67
+ config.disable_monkey_patching!
68
+
69
+ # This setting enables warnings. It's recommended, but in some cases may
70
+ # be too noisy due to issues in dependencies.
71
+ config.warnings = true
72
+
73
+ # Many RSpec users commonly either run the entire suite or an individual
74
+ # file, and it's useful to allow more verbose output when running an
75
+ # individual spec file.
76
+ if config.files_to_run.one?
77
+ # Use the documentation formatter for detailed output,
78
+ # unless a formatter has already been configured
79
+ # (e.g. via a command-line flag).
80
+ config.default_formatter = 'doc'
81
+ end
82
+
83
+ # Print the 10 slowest examples and example groups at the
84
+ # end of the spec run, to help surface which specs are running
85
+ # particularly slow.
86
+ # config.profile_examples = 10
87
+
88
+ # Run specs in random order to surface order dependencies. If you find an
89
+ # order dependency and want to debug it, you can fix the order by providing
90
+ # the seed, which is printed after each run.
91
+ # --seed 1234
92
+ config.order = :random
93
+
94
+ # Seed global randomization in this process using the `--seed` CLI option.
95
+ # Setting this allows you to use `--seed` to deterministically reproduce
96
+ # test failures related to randomization by passing the same `--seed` value
97
+ # as the one that triggered the failure.
98
+ Kernel.srand config.seed
99
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coined
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rafaël Gonzalez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.2.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.2.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.9.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: codeclimate-test-reporter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.7
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.4.7
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.30.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.30.1
83
+ description: A gem that keeps your coins in a purse
84
+ email:
85
+ - rafaelgonzalez@users.noreply.github.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".rubocop.yml"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - coin.png
99
+ - coined.gemspec
100
+ - lib/coined.rb
101
+ - lib/coined/coin.rb
102
+ - lib/coined/coin/copper.rb
103
+ - lib/coined/coin/gold.rb
104
+ - lib/coined/coin/platinum.rb
105
+ - lib/coined/coin/silver.rb
106
+ - lib/coined/purse.rb
107
+ - lib/coined/version.rb
108
+ - spec/coined/coin/copper_spec.rb
109
+ - spec/coined/coin/gold_spec.rb
110
+ - spec/coined/coin/platinum_spec.rb
111
+ - spec/coined/coin/silver_spec.rb
112
+ - spec/coined/purse_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: https://github.com/rafaelgonzalez/coined
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.4.6
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: A gem that keeps your coins in a purse
138
+ test_files:
139
+ - spec/coined/coin/copper_spec.rb
140
+ - spec/coined/coin/gold_spec.rb
141
+ - spec/coined/coin/platinum_spec.rb
142
+ - spec/coined/coin/silver_spec.rb
143
+ - spec/coined/purse_spec.rb
144
+ - spec/spec_helper.rb
145
+ has_rdoc: