para_dice 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/.pullreview.yml +77 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +9 -0
- data/Guardfile +27 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/VERSION +1 -0
- data/bin/dice_tests.rb +27 -0
- data/data/face_types.yml +27 -0
- data/data/gotham_dice.yml +55 -0
- data/data/specs/not_really_yaml.yml +22 -0
- data/data/specs/simple_array.yml +7 -0
- data/data/specs/simple_hash.yml +4 -0
- data/data/star_wars_dice.yml +87 -0
- data/lib/gotham_dice.rb +44 -0
- data/lib/para_dice/bag.rb +44 -0
- data/lib/para_dice/cup.rb +19 -0
- data/lib/para_dice/die.rb +64 -0
- data/lib/para_dice/faces/arrayed.rb +34 -0
- data/lib/para_dice/faces/ranged.rb +38 -0
- data/lib/para_dice/numbered_die.rb +13 -0
- data/lib/para_dice/poly_bag.rb +31 -0
- data/lib/para_dice/results/and_keep.rb +34 -0
- data/lib/para_dice/results/array.rb +13 -0
- data/lib/para_dice/results/cancel_opposing.rb +46 -0
- data/lib/para_dice/results/hash.rb +14 -0
- data/lib/para_dice/results/number.rb +39 -0
- data/lib/para_dice/results/split_faces.rb +23 -0
- data/lib/para_dice/string_die.rb +15 -0
- data/lib/para_dice/utility.rb +54 -0
- data/lib/para_dice.rb +9 -0
- data/lib/star_wars_dice.rb +41 -0
- data/para_dice.gemspec +34 -0
- data/spec/gotham_dice_spec.rb +19 -0
- data/spec/para_dice/bag_spec.rb +53 -0
- data/spec/para_dice/cup_spec.rb +73 -0
- data/spec/para_dice/die_spec.rb +21 -0
- data/spec/para_dice/faces/ranged_spec.rb +42 -0
- data/spec/para_dice/faces/string_arrayed_spec.rb +41 -0
- data/spec/para_dice/numbered_die_spec.rb +19 -0
- data/spec/para_dice/poly_bag_spec.rb +9 -0
- data/spec/para_dice/results/and_keep_spec.rb +30 -0
- data/spec/para_dice/results/array_spec.rb +8 -0
- data/spec/para_dice/results/cancel_opposing_spec.rb +18 -0
- data/spec/para_dice/results/hash_spec.rb +6 -0
- data/spec/para_dice/results/number_spec.rb +44 -0
- data/spec/para_dice/results/parse_faces_spec.rb +9 -0
- data/spec/para_dice/string_die_spec.rb +14 -0
- data/spec/para_dice/utility_spec.rb +82 -0
- data/spec/para_dice_spec.rb +10 -0
- data/spec/spec_helper.rb +82 -0
- data/spec/star_wars_dice_spec.rb +19 -0
- metadata +274 -0
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
            require 'para_dice/numbered_die'
         | 
| 3 | 
            +
            describe ParaDice::NumberedDie do
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              describe '#get(max, offset = 0)' do
         | 
| 6 | 
            +
                subject { described_class.get(arg) }
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                context 'only max' do
         | 
| 9 | 
            +
                  let(:arg) { 6 }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  it { expect(subject.name).to eq 'd6' }
         | 
| 12 | 
            +
                  it do
         | 
| 13 | 
            +
                    is_expected.to have_attributes(name:        'd6',
         | 
| 14 | 
            +
                                                   description: '',
         | 
| 15 | 
            +
                                                   faces:       [1, 2, 3, 4, 5, 6])
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,9 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'para_dice/poly_bag'
         | 
| 4 | 
            +
            describe ParaDice::PolyBag do
         | 
| 5 | 
            +
              let(:expected_dice) { ['d2', 'd3', 'd4', 'd6', 'd8', 'd10', 'd12', 'd20', 'd30', 'd100'] }
         | 
| 6 | 
            +
              subject { described_class.get }
         | 
| 7 | 
            +
              it { is_expected.to be_a ParaDice::Bag }
         | 
| 8 | 
            +
              it { expect(subject.dice.keys).to eq expected_dice }
         | 
| 9 | 
            +
            end
         | 
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
            require 'para_dice/results/and_keep'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe ParaDice::Results::AndKeep do
         | 
| 5 | 
            +
              let(:faces) { [2, 3, 4, 5] }
         | 
| 6 | 
            +
              subject { described_class.new.resolve(faces, 2) }
         | 
| 7 | 
            +
              it { is_expected.to eq [4, 5] }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              context 'with default_keep' do
         | 
| 10 | 
            +
                subject { described_class.new(2).resolve(faces) }
         | 
| 11 | 
            +
                it { is_expected.to eq [4, 5] }
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              context 'with a given keep' do
         | 
| 15 | 
            +
                subject { described_class.new(2).resolve(faces, 3) }
         | 
| 16 | 
            +
                it { is_expected.to eq [3, 4, 5] }
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              context 'keep from low values' do
         | 
| 20 | 
            +
                subject { described_class.new(2).resolve(faces, 2, true) }
         | 
| 21 | 
            +
                it { is_expected.to eq [2, 3] }
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              end
         | 
| 24 | 
            +
             | 
| 25 | 
            +
              context 'given a sort_block' do
         | 
| 26 | 
            +
                let(:faces) { [[:z, 7], [:x, 3], [:y, 4]] }
         | 
| 27 | 
            +
                subject { described_class.new(3).resolve(faces) { |f| f.last } }
         | 
| 28 | 
            +
                it { is_expected.to eq [[:x, 3], [:y, 4], [:z, 7]] }
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
            end
         | 
| @@ -0,0 +1,18 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
            require 'para_dice/results/cancel_opposing'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe ParaDice::Results::CancelOpposing do
         | 
| 5 | 
            +
              subject { described_class.new.resolve(faces, opposing) }
         | 
| 6 | 
            +
              let(:opposing) { [['foo', 'FOO'], ['bar', 'BAR'], ['blank', 'blank']] }
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              context 'everything cancels' do
         | 
| 9 | 
            +
                let(:faces) { [:foo, :foo, :bar, :blank, :BAR, :BAR, :FOO, :bar, :FOO].map(&:to_s) }
         | 
| 10 | 
            +
                it { is_expected.to eq [] }
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
              context 'partial cancellation' do
         | 
| 13 | 
            +
                let(:faces) { [:foo, :bar, :foo, :bar, :BAR, :FOO, :blank, :blank].map(&:to_s) }
         | 
| 14 | 
            +
                let(:expected_result) { ['foo', 'bar'] }
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                it { is_expected.to eq expected_result }
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
| @@ -0,0 +1,44 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'para_dice/results/number'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            describe ParaDice::Results::Number do
         | 
| 6 | 
            +
              let(:faces) { [2, 3, 4] }
         | 
| 7 | 
            +
              subject { described_class.new }
         | 
| 8 | 
            +
              it { is_expected.to have_attributes(default_initial_value: 0, default_operator: :+) }
         | 
| 9 | 
            +
              describe 'ParaDice::Results::Number.revolve(faces, initial, operator)' do
         | 
| 10 | 
            +
                context 'with default values' do
         | 
| 11 | 
            +
                  subject { described_class.new.resolve(faces) }
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  it { is_expected.to eq 9 }
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                context 'given an initial value' do
         | 
| 17 | 
            +
                  let(:initial) { 17 }
         | 
| 18 | 
            +
                  subject { described_class.new(17).resolve(faces) }
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  it { is_expected.to eq 26 }
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                context 'passed an initial value' do
         | 
| 24 | 
            +
                  let(:initial) { 17 }
         | 
| 25 | 
            +
                  subject { described_class.new(17).resolve(faces, 22) }
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  it { is_expected.to eq 31 }
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                context 'given an initial value and operator' do
         | 
| 31 | 
            +
                  let(:operator) { :* }
         | 
| 32 | 
            +
                  let(:initial) { 1 }
         | 
| 33 | 
            +
                  subject { described_class.new(initial, operator).resolve(faces) }
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                  it { is_expected.to eq 24 }
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  describe 'another example' do
         | 
| 38 | 
            +
                    let(:operator) { :- }
         | 
| 39 | 
            +
                    let(:initial) { 100 }
         | 
| 40 | 
            +
                    it { is_expected.to eq 91 }
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
                end
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
            end
         | 
| @@ -0,0 +1,9 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
            require 'para_dice/results/split_faces'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe ParaDice::Results::SplitFaces do
         | 
| 5 | 
            +
              let(:faces) { [:foo, :foo_bar, :bar_bar, :foo_bar_foo] }
         | 
| 6 | 
            +
              subject { described_class.new.resolve(faces) }
         | 
| 7 | 
            +
              it { is_expected.to eq ['foo', 'foo', 'bar', 'bar', 'bar', 'foo', 'bar', 'foo'] }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            end
         | 
| @@ -0,0 +1,14 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
            require 'para_dice/string_die'
         | 
| 3 | 
            +
            describe ParaDice::StringDie do
         | 
| 4 | 
            +
              let(:name) { 'FBB' }
         | 
| 5 | 
            +
              let(:faces) { [:foo, :bar, :baz] }
         | 
| 6 | 
            +
              subject { described_class.new(name: name, faces: faces) }
         | 
| 7 | 
            +
              it { is_expected.to be_a described_class }
         | 
| 8 | 
            +
              it do
         | 
| 9 | 
            +
                is_expected.to have_attributes(name:        'FBB',
         | 
| 10 | 
            +
                                               faces:       ['foo', 'bar', 'baz'],
         | 
| 11 | 
            +
                                               description: 'faces: foo, bar, baz',
         | 
| 12 | 
            +
                                               face_count:  3)
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
            end
         | 
| @@ -0,0 +1,82 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
            require 'para_dice/utility'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe ParaDice::Utility do
         | 
| 5 | 
            +
              it { expect(ParaDice::Utility).to respond_to :module_from }
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              describe '.module_from' do
         | 
| 8 | 
            +
                shared_examples_for 'a correct module' do |string, module_obj|
         | 
| 9 | 
            +
                  let(:module_string) { string }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  it { is_expected.to be module_obj }
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                context 'without namespace' do
         | 
| 15 | 
            +
                  subject { ParaDice::Utility.module_from(module_string) }
         | 
| 16 | 
            +
             | 
| 17 | 
            +
                  context 'with top level module as string' do
         | 
| 18 | 
            +
                    let(:module_string) { 'ParaDice' }
         | 
| 19 | 
            +
                    it { is_expected.to be ParaDice }
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  context 'with deep module as string' do
         | 
| 23 | 
            +
                    it_should_behave_like 'a correct module', 'ParaDice::Utility', ParaDice::Utility
         | 
| 24 | 
            +
                    it_should_behave_like 'a correct module', 'para_dice__utility', ParaDice::Utility
         | 
| 25 | 
            +
                    it_should_behave_like 'a correct module', 'ParaDice/Utility', ParaDice::Utility
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
                context 'with namespace' do
         | 
| 29 | 
            +
                  let(:namespace) { ParaDice }
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  subject { ParaDice::Utility.module_from(module_string, namespace) }
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  context 'with top level module as string' do
         | 
| 34 | 
            +
                    let(:module_string) { 'ParaDice' }
         | 
| 35 | 
            +
                    it { is_expected.to be ParaDice }
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  context 'with deep module as string' do
         | 
| 39 | 
            +
                    it_should_behave_like 'a correct module', 'ParaDice::Utility', ParaDice::Utility
         | 
| 40 | 
            +
                    it_should_behave_like 'a correct module', 'para_dice__utility', ParaDice::Utility
         | 
| 41 | 
            +
                    it_should_behave_like 'a correct module', 'ParaDice/Utility', ParaDice::Utility
         | 
| 42 | 
            +
                    it_should_behave_like 'a correct module', 'Utility', ParaDice::Utility
         | 
| 43 | 
            +
                    it_should_behave_like 'a correct module', 'utility', ParaDice::Utility
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                context 'when theres no module with namd' do
         | 
| 48 | 
            +
                  shared_examples_for 'an incorrect module' do |string, namespace_obj = nil|
         | 
| 49 | 
            +
                    let(:module_string) { string }
         | 
| 50 | 
            +
                    let(:namespace) { namespace_obj }
         | 
| 51 | 
            +
                    subject { ParaDice::Utility.module_from(module_string, namespace) }
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                    it { is_expected.to be_falsey }
         | 
| 54 | 
            +
                  end
         | 
| 55 | 
            +
             | 
| 56 | 
            +
                  it_should_behave_like 'an incorrect module', 'BadName'
         | 
| 57 | 
            +
                  it_should_behave_like 'an incorrect module', 'BadName', ParaDice
         | 
| 58 | 
            +
                  it_should_behave_like 'an incorrect module', 'ParaDice__BadName'
         | 
| 59 | 
            +
                  it_should_behave_like 'an incorrect module', 'bad_name', ParaDice
         | 
| 60 | 
            +
                  it_should_behave_like 'an incorrect module', 'bad_name'
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                context 'when a class of module is passed' do
         | 
| 65 | 
            +
                  it { expect(ParaDice::Utility.module_from(String)).to eq String }
         | 
| 66 | 
            +
                  it { expect(ParaDice::Utility.module_from(ParaDice::Utility)).to eq ParaDice::Utility }
         | 
| 67 | 
            +
                end
         | 
| 68 | 
            +
              end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
              describe '.to_summary' do
         | 
| 71 | 
            +
                let(:arr) { [3, 4, 3, 3, 4, 2, 1] }
         | 
| 72 | 
            +
                subject { ParaDice::Utility.to_summary(arr) }
         | 
| 73 | 
            +
                it { is_expected.to eq({ 3 => 3, 4 => 2, 2 => 1, 1 => 1 }) }
         | 
| 74 | 
            +
              end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
              describe '.from_summary' do
         | 
| 77 | 
            +
                let(:summary) { { 3 => 3, 4 => 2, 2 => 1, 1 => 1 } }
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                subject { ParaDice::Utility.from_summary(summary) }
         | 
| 80 | 
            +
                it { is_expected.to eq [3, 3, 3, 4, 4, 2, 1] }
         | 
| 81 | 
            +
              end
         | 
| 82 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | @@ -0,0 +1,82 @@ | |
| 1 | 
            +
            require 'codeclimate-test-reporter'
         | 
| 2 | 
            +
            require 'pullreview/coverage_reporter'
         | 
| 3 | 
            +
            #CodeClimate::TestReporter.start
         | 
| 4 | 
            +
            PullReview::CoverageReporter.start
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
         | 
| 7 | 
            +
            RSpec.configure do |config|
         | 
| 8 | 
            +
              config.filter_run_excluding rewrite: true
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              # rspec-expectations config goes here. You can use an alternate
         | 
| 11 | 
            +
              # assertion/expectation library such as wrong or the stdlib/minitest
         | 
| 12 | 
            +
              # assertions if you prefer.
         | 
| 13 | 
            +
              config.expect_with :rspec do |expectations|
         | 
| 14 | 
            +
                # This option will default to `true` in RSpec 4. It makes the `description`
         | 
| 15 | 
            +
                # and `failure_message` of custom matchers include text for helper methods
         | 
| 16 | 
            +
                # defined using `chain`, e.g.:
         | 
| 17 | 
            +
                # be_bigger_than(2).and_smaller_than(4).description
         | 
| 18 | 
            +
                #   # => 'be bigger than 2 and smaller than 4'
         | 
| 19 | 
            +
                # ...rather than:
         | 
| 20 | 
            +
                #   # => 'be bigger than 2'
         | 
| 21 | 
            +
                expectations.include_chain_clauses_in_custom_matcher_descriptions = true
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              # rspec-mocks config goes here. You can use an alternate test double
         | 
| 25 | 
            +
              # library (such as bogus or mocha) by changing the `mock_with` option here.
         | 
| 26 | 
            +
              config.mock_with :rspec do |mocks|
         | 
| 27 | 
            +
                # Prevents you from mocking or stubbing a method that does not exist on
         | 
| 28 | 
            +
                # a real object. This is generally recommended, and will default to
         | 
| 29 | 
            +
                # `true` in RSpec 4.
         | 
| 30 | 
            +
                mocks.verify_partial_doubles = true
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              config.filter_run :focus
         | 
| 34 | 
            +
              config.run_all_when_everything_filtered = true
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              # The settings below are suggested to provide a good initial experience
         | 
| 37 | 
            +
              # with RSpec, but feel free to customize to your heart's content.
         | 
| 38 | 
            +
            =begin
         | 
| 39 | 
            +
              # These two settings work together to allow you to limit a spec run
         | 
| 40 | 
            +
              # to individual examples or groups you care about by tagging them with
         | 
| 41 | 
            +
              # `:focus` metadata. When nothing is tagged with `:focus`, all examples
         | 
| 42 | 
            +
              # get run.
         | 
| 43 | 
            +
             | 
| 44 | 
            +
              # Limits the available syntax to the non-monkey patched syntax that is recommended.
         | 
| 45 | 
            +
              # For more details, see:
         | 
| 46 | 
            +
              #   - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
         | 
| 47 | 
            +
              #   - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
         | 
| 48 | 
            +
              #   - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
         | 
| 49 | 
            +
              config.disable_monkey_patching!
         | 
| 50 | 
            +
             | 
| 51 | 
            +
              # This setting enables warnings. It's recommended, but in some cases may
         | 
| 52 | 
            +
              # be too noisy due to issues in dependencies.
         | 
| 53 | 
            +
              config.warnings = true
         | 
| 54 | 
            +
             | 
| 55 | 
            +
              # Many RSpec users commonly either run the entire suite or an individual
         | 
| 56 | 
            +
              # file, and it's useful to allow more verbose output when running an
         | 
| 57 | 
            +
              # individual spec file.
         | 
| 58 | 
            +
              if config.files_to_run.one?
         | 
| 59 | 
            +
                # Use the documentation formatter for detailed output,
         | 
| 60 | 
            +
                # unless a formatter has already been configured
         | 
| 61 | 
            +
                # (e.g. via a command-line flag).
         | 
| 62 | 
            +
                config.default_formatter = 'doc'
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              # Print the 10 slowest examples and example groups at the
         | 
| 66 | 
            +
              # end of the spec run, to help surface which specs are running
         | 
| 67 | 
            +
              # particularly slow.
         | 
| 68 | 
            +
              config.profile_examples = 10
         | 
| 69 | 
            +
             | 
| 70 | 
            +
              # Run specs in random order to surface order dependencies. If you find an
         | 
| 71 | 
            +
              # order dependency and want to debug it, you can fix the order by providing
         | 
| 72 | 
            +
              # the seed, which is printed after each run.
         | 
| 73 | 
            +
              #     --seed 1234
         | 
| 74 | 
            +
              config.order = :random
         | 
| 75 | 
            +
             | 
| 76 | 
            +
              # Seed global randomization in this process using the `--seed` CLI option.
         | 
| 77 | 
            +
              # Setting this allows you to use `--seed` to deterministically reproduce
         | 
| 78 | 
            +
              # test failures related to randomization by passing the same `--seed` value
         | 
| 79 | 
            +
              # as the one that triggered the failure.
         | 
| 80 | 
            +
              Kernel.srand config.seed
         | 
| 81 | 
            +
            =end
         | 
| 82 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require 'rspec'
         | 
| 2 | 
            +
            require 'star_wars_dice'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe StarWarsDice do
         | 
| 5 | 
            +
              subject { described_class.get }
         | 
| 6 | 
            +
              it { is_expected.to be_a described_class }
         | 
| 7 | 
            +
              it { expect(subject.dice.keys.count).to eq 7 }
         | 
| 8 | 
            +
              it { expect(subject.dice.values.all? { |d| d.is_a? ParaDice::StringDie }).to be true }
         | 
| 9 | 
            +
              it { expect(subject.default_readers.size).to eq(3) }
         | 
| 10 | 
            +
              it { expect(subject.default_readers[0]).to be_a ParaDice::Results::SplitFaces }
         | 
| 11 | 
            +
              it { expect(subject.default_readers[1]).to be_a ParaDice::Results::CancelOpposing }
         | 
| 12 | 
            +
              it { expect(subject.default_readers[2]).to eq ParaDice::Results::Hash }
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              describe '.get_cup' do
         | 
| 15 | 
            +
                let(:dice) { ['boost', 'boost', 'setback', 'proficincy', 'ability', 'ability', 'difficulty', 'difficulty'] }
         | 
| 16 | 
            +
                subject { described_class.get.get_cup(*dice) }
         | 
| 17 | 
            +
                it { expect(subject.roll!.size).to eq 8 }
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,274 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: para_dice
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.6.0
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Scott M Parrish
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2014-11-20 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: virtus
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: 1.0.3
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: 1.0.3
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: facets
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - "~>"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: 2.9.3
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: 2.9.3
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: hashie
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - "~>"
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: 3.3.1
         | 
| 48 | 
            +
              type: :runtime
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - "~>"
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: 3.3.1
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: bundler
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - "~>"
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: 1.7.6
         | 
| 62 | 
            +
              type: :development
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - "~>"
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: 1.7.6
         | 
| 69 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 70 | 
            +
              name: yard
         | 
| 71 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 | 
            +
                requirements:
         | 
| 73 | 
            +
                - - "~>"
         | 
| 74 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            +
                    version: 0.8.7.6
         | 
| 76 | 
            +
              type: :development
         | 
| 77 | 
            +
              prerelease: false
         | 
| 78 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            +
                requirements:
         | 
| 80 | 
            +
                - - "~>"
         | 
| 81 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            +
                    version: 0.8.7.6
         | 
| 83 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            +
              name: rake
         | 
| 85 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 | 
            +
                requirements:
         | 
| 87 | 
            +
                - - "~>"
         | 
| 88 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            +
                    version: 10.3.2
         | 
| 90 | 
            +
              type: :development
         | 
| 91 | 
            +
              prerelease: false
         | 
| 92 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 | 
            +
                requirements:
         | 
| 94 | 
            +
                - - "~>"
         | 
| 95 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            +
                    version: 10.3.2
         | 
| 97 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 98 | 
            +
              name: rspec
         | 
| 99 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 100 | 
            +
                requirements:
         | 
| 101 | 
            +
                - - "~>"
         | 
| 102 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 103 | 
            +
                    version: 3.1.0
         | 
| 104 | 
            +
              type: :development
         | 
| 105 | 
            +
              prerelease: false
         | 
| 106 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 107 | 
            +
                requirements:
         | 
| 108 | 
            +
                - - "~>"
         | 
| 109 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 110 | 
            +
                    version: 3.1.0
         | 
| 111 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 112 | 
            +
              name: guard-rspec
         | 
| 113 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 114 | 
            +
                requirements:
         | 
| 115 | 
            +
                - - "~>"
         | 
| 116 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 117 | 
            +
                    version: 4.3.1
         | 
| 118 | 
            +
              type: :development
         | 
| 119 | 
            +
              prerelease: false
         | 
| 120 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 121 | 
            +
                requirements:
         | 
| 122 | 
            +
                - - "~>"
         | 
| 123 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 124 | 
            +
                    version: 4.3.1
         | 
| 125 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            +
              name: guard-bundler
         | 
| 127 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            +
                requirements:
         | 
| 129 | 
            +
                - - "~>"
         | 
| 130 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            +
                    version: 2.0.0
         | 
| 132 | 
            +
              type: :development
         | 
| 133 | 
            +
              prerelease: false
         | 
| 134 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 | 
            +
                requirements:
         | 
| 136 | 
            +
                - - "~>"
         | 
| 137 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            +
                    version: 2.0.0
         | 
| 139 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 140 | 
            +
              name: version
         | 
| 141 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 142 | 
            +
                requirements:
         | 
| 143 | 
            +
                - - "~>"
         | 
| 144 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 145 | 
            +
                    version: 1.0.0
         | 
| 146 | 
            +
              type: :development
         | 
| 147 | 
            +
              prerelease: false
         | 
| 148 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 149 | 
            +
                requirements:
         | 
| 150 | 
            +
                - - "~>"
         | 
| 151 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 152 | 
            +
                    version: 1.0.0
         | 
| 153 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 154 | 
            +
              name: fuubar
         | 
| 155 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 156 | 
            +
                requirements:
         | 
| 157 | 
            +
                - - "~>"
         | 
| 158 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 159 | 
            +
                    version: 2.0.0
         | 
| 160 | 
            +
              type: :development
         | 
| 161 | 
            +
              prerelease: false
         | 
| 162 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 163 | 
            +
                requirements:
         | 
| 164 | 
            +
                - - "~>"
         | 
| 165 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 166 | 
            +
                    version: 2.0.0
         | 
| 167 | 
            +
            description: A Toolbox to help me build a board game.
         | 
| 168 | 
            +
            email:
         | 
| 169 | 
            +
            - anithri@gmail.com
         | 
| 170 | 
            +
            executables:
         | 
| 171 | 
            +
            - dice_tests.rb
         | 
| 172 | 
            +
            extensions: []
         | 
| 173 | 
            +
            extra_rdoc_files: []
         | 
| 174 | 
            +
            files:
         | 
| 175 | 
            +
            - ".gitignore"
         | 
| 176 | 
            +
            - ".pullreview.yml"
         | 
| 177 | 
            +
            - ".rspec"
         | 
| 178 | 
            +
            - ".travis.yml"
         | 
| 179 | 
            +
            - Gemfile
         | 
| 180 | 
            +
            - Guardfile
         | 
| 181 | 
            +
            - LICENSE.txt
         | 
| 182 | 
            +
            - README.md
         | 
| 183 | 
            +
            - Rakefile
         | 
| 184 | 
            +
            - VERSION
         | 
| 185 | 
            +
            - bin/dice_tests.rb
         | 
| 186 | 
            +
            - data/face_types.yml
         | 
| 187 | 
            +
            - data/gotham_dice.yml
         | 
| 188 | 
            +
            - data/specs/not_really_yaml.yml
         | 
| 189 | 
            +
            - data/specs/simple_array.yml
         | 
| 190 | 
            +
            - data/specs/simple_hash.yml
         | 
| 191 | 
            +
            - data/star_wars_dice.yml
         | 
| 192 | 
            +
            - lib/gotham_dice.rb
         | 
| 193 | 
            +
            - lib/para_dice.rb
         | 
| 194 | 
            +
            - lib/para_dice/bag.rb
         | 
| 195 | 
            +
            - lib/para_dice/cup.rb
         | 
| 196 | 
            +
            - lib/para_dice/die.rb
         | 
| 197 | 
            +
            - lib/para_dice/faces/arrayed.rb
         | 
| 198 | 
            +
            - lib/para_dice/faces/ranged.rb
         | 
| 199 | 
            +
            - lib/para_dice/numbered_die.rb
         | 
| 200 | 
            +
            - lib/para_dice/poly_bag.rb
         | 
| 201 | 
            +
            - lib/para_dice/results/and_keep.rb
         | 
| 202 | 
            +
            - lib/para_dice/results/array.rb
         | 
| 203 | 
            +
            - lib/para_dice/results/cancel_opposing.rb
         | 
| 204 | 
            +
            - lib/para_dice/results/hash.rb
         | 
| 205 | 
            +
            - lib/para_dice/results/number.rb
         | 
| 206 | 
            +
            - lib/para_dice/results/split_faces.rb
         | 
| 207 | 
            +
            - lib/para_dice/string_die.rb
         | 
| 208 | 
            +
            - lib/para_dice/utility.rb
         | 
| 209 | 
            +
            - lib/star_wars_dice.rb
         | 
| 210 | 
            +
            - para_dice.gemspec
         | 
| 211 | 
            +
            - spec/gotham_dice_spec.rb
         | 
| 212 | 
            +
            - spec/para_dice/bag_spec.rb
         | 
| 213 | 
            +
            - spec/para_dice/cup_spec.rb
         | 
| 214 | 
            +
            - spec/para_dice/die_spec.rb
         | 
| 215 | 
            +
            - spec/para_dice/faces/ranged_spec.rb
         | 
| 216 | 
            +
            - spec/para_dice/faces/string_arrayed_spec.rb
         | 
| 217 | 
            +
            - spec/para_dice/numbered_die_spec.rb
         | 
| 218 | 
            +
            - spec/para_dice/poly_bag_spec.rb
         | 
| 219 | 
            +
            - spec/para_dice/results/and_keep_spec.rb
         | 
| 220 | 
            +
            - spec/para_dice/results/array_spec.rb
         | 
| 221 | 
            +
            - spec/para_dice/results/cancel_opposing_spec.rb
         | 
| 222 | 
            +
            - spec/para_dice/results/hash_spec.rb
         | 
| 223 | 
            +
            - spec/para_dice/results/number_spec.rb
         | 
| 224 | 
            +
            - spec/para_dice/results/parse_faces_spec.rb
         | 
| 225 | 
            +
            - spec/para_dice/string_die_spec.rb
         | 
| 226 | 
            +
            - spec/para_dice/utility_spec.rb
         | 
| 227 | 
            +
            - spec/para_dice_spec.rb
         | 
| 228 | 
            +
            - spec/spec_helper.rb
         | 
| 229 | 
            +
            - spec/star_wars_dice_spec.rb
         | 
| 230 | 
            +
            homepage: ''
         | 
| 231 | 
            +
            licenses:
         | 
| 232 | 
            +
            - MIT
         | 
| 233 | 
            +
            metadata: {}
         | 
| 234 | 
            +
            post_install_message: 
         | 
| 235 | 
            +
            rdoc_options: []
         | 
| 236 | 
            +
            require_paths:
         | 
| 237 | 
            +
            - lib
         | 
| 238 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 239 | 
            +
              requirements:
         | 
| 240 | 
            +
              - - ">="
         | 
| 241 | 
            +
                - !ruby/object:Gem::Version
         | 
| 242 | 
            +
                  version: '0'
         | 
| 243 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 244 | 
            +
              requirements:
         | 
| 245 | 
            +
              - - ">="
         | 
| 246 | 
            +
                - !ruby/object:Gem::Version
         | 
| 247 | 
            +
                  version: '0'
         | 
| 248 | 
            +
            requirements: []
         | 
| 249 | 
            +
            rubyforge_project: 
         | 
| 250 | 
            +
            rubygems_version: 2.4.2
         | 
| 251 | 
            +
            signing_key: 
         | 
| 252 | 
            +
            specification_version: 4
         | 
| 253 | 
            +
            summary: Game Dev Toolbox.
         | 
| 254 | 
            +
            test_files:
         | 
| 255 | 
            +
            - spec/gotham_dice_spec.rb
         | 
| 256 | 
            +
            - spec/para_dice/bag_spec.rb
         | 
| 257 | 
            +
            - spec/para_dice/cup_spec.rb
         | 
| 258 | 
            +
            - spec/para_dice/die_spec.rb
         | 
| 259 | 
            +
            - spec/para_dice/faces/ranged_spec.rb
         | 
| 260 | 
            +
            - spec/para_dice/faces/string_arrayed_spec.rb
         | 
| 261 | 
            +
            - spec/para_dice/numbered_die_spec.rb
         | 
| 262 | 
            +
            - spec/para_dice/poly_bag_spec.rb
         | 
| 263 | 
            +
            - spec/para_dice/results/and_keep_spec.rb
         | 
| 264 | 
            +
            - spec/para_dice/results/array_spec.rb
         | 
| 265 | 
            +
            - spec/para_dice/results/cancel_opposing_spec.rb
         | 
| 266 | 
            +
            - spec/para_dice/results/hash_spec.rb
         | 
| 267 | 
            +
            - spec/para_dice/results/number_spec.rb
         | 
| 268 | 
            +
            - spec/para_dice/results/parse_faces_spec.rb
         | 
| 269 | 
            +
            - spec/para_dice/string_die_spec.rb
         | 
| 270 | 
            +
            - spec/para_dice/utility_spec.rb
         | 
| 271 | 
            +
            - spec/para_dice_spec.rb
         | 
| 272 | 
            +
            - spec/spec_helper.rb
         | 
| 273 | 
            +
            - spec/star_wars_dice_spec.rb
         | 
| 274 | 
            +
            has_rdoc: 
         |