Sha256: 548ebf30183d72767f4982152a325bce8a7ce5c4c68fd80e6774ae036e2bba6c

Contents?: true

Size: 1.12 KB

Versions: 29

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"
require "lol"

include Lol

describe PlayerStatistic do
  it_behaves_like 'Lol model' do
    let(:valid_attributes) { { wins: 1 } }
  end

  %w(aggregated_stats losses modify_date_str player_stat_summary_type wins).each do |attribute|
    describe "#{attribute} attribute" do
      it_behaves_like 'plain attribute' do
        let(:attribute) { attribute }
        let(:attribute_value) { 'asd' }
      end
    end
  end

  describe 'aggregated_stats attribute' do
    it_behaves_like 'plain attribute' do
      let(:attribute) { 'aggregated_stats' }
      let(:attribute_value) { 'asd' }
    end

    context 'when is passed as an hash' do
      subject { PlayerStatistic.new aggregated_stats: { 'FooBar' => 'baz' } }

      it 'will convert the hash in an openstruct object' do
        expect(subject.aggregated_stats).to be_a OpenStruct
      end

      it 'will convert each hash key in underscore' do
        expect(subject.aggregated_stats.foo_bar).to eq 'baz'
      end
    end
  end

  describe 'modify_date attribute' do
    it_behaves_like 'time attribute' do
      let(:attribute) { 'modify_date' }
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
ruby-lol-0.12.2 spec/lol/player_statistic_spec.rb
ruby-lol-0.12.1 spec/lol/player_statistic_spec.rb
ruby-lol-0.12.0 spec/lol/player_statistic_spec.rb
ruby-lol-0.11.6 spec/lol/player_statistic_spec.rb
ruby-lol-0.11.5 spec/lol/player_statistic_spec.rb
ruby-lol-0.11.4 spec/lol/player_statistic_spec.rb
ruby-lol-0.11.3 spec/lol/player_statistic_spec.rb
ruby-lol-0.11.2 spec/lol/player_statistic_spec.rb
ruby-lol-0.11.1 spec/lol/player_statistic_spec.rb
ruby-lol-0.11.0 spec/lol/player_statistic_spec.rb
ruby-lol-0.10.0 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.19.1 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.19 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.18 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.17 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.16 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.15 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.14 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.13 spec/lol/player_statistic_spec.rb
ruby-lol-0.9.12 spec/lol/player_statistic_spec.rb