encode_with_alphabet 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require "encode_with_alphabet/version"
3
3
  module EncodeWithAlphabet
4
4
  ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
5
5
  def self.encode(number, alphabet = ALPHABET)
6
- raise 'number must be an integer' unless number.is_a? Fixnum
6
+ raise 'number must be an integer' unless number.kind_of? Integer
7
7
  raise 'alphabet must be non-empty' if alphabet.empty?
8
8
 
9
9
  return alphabet[0,1] if number == 0
@@ -1,3 +1,3 @@
1
1
  module EncodeWithAlphabet
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,8 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  module EncodeWithAlphabet
4
+ describe "works with big numbers" do
5
+ let(:number) { 98079714615416886934934209737619787751599303819750539264 }
6
+ specify { expect{ EncodeWithAlphabet.encode(number) }.to_not raise_error('number must be an integer') }
7
+ end
8
+
4
9
  describe "#encode" do
5
10
  subject { EncodeWithAlphabet.encode(number, alphabet) }
11
+
12
+
6
13
  context "when alphabet is '01'" do
7
14
  let(:alphabet) { '01' }
8
15
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: encode_with_alphabet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alexander Glushkov