Skip to content

Commit 1af9d3f

Browse files
committed
WIP
1 parent 0737dce commit 1af9d3f

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

lib/coupon_code/configuration.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,26 @@ class << self
33
attr_accessor :configuration
44
end
55

6-
def self.configuration
7-
@configuration ||= Configuration.new
6+
def self.config
7+
@config ||= Configuration.new
88
end
99

1010
def self.configure
11-
yield(configuration)
11+
yield(config)
1212
end
1313

1414
def self.reset
15-
@configuration = Configuration.new
15+
@config = Configuration.new
1616
end
1717

1818
class Configuration
19-
attr_accessor :separator
19+
20+
attr_accessor :separator, :part_length, :num_parts
2021

2122
def initialize
2223
@separator = '-'
24+
@part_length = 4
25+
@num_parts = 3
2326
end
2427
end
2528
end

test/configuration_test.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
require 'test_helper'
22

3-
module CouponCode
4-
describe Configuration do
5-
it 'separator' do
6-
config = Configuration.new
7-
config.separator = '*'
8-
config.separator.must_equal('*')
9-
end
3+
describe 'Configuration' do
4+
it 'separator' do
5+
config = CouponCode::Configuration.new
6+
config.separator = '*'
7+
config.separator.must_equal('*')
108
end
119
end

test/validator_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require 'test_helper'
22

3-
describe 'Validator' do
3+
describe Validator do
44
it 'should be loaded.' do
55
CouponCode.must_respond_to(:validate)
66
end

0 commit comments

Comments
 (0)