Sha256: 2ef5b8aa4227623e4b600521c5b0c3c637d388415f65b6dd388007faf14a24d5

Contents?: true

Size: 921 Bytes

Versions: 26

Compression:

Stored size: 921 Bytes

Contents

require "spec_helper"
require "lol"

include Lol

describe ChampionStatisticsSummary do
  it_behaves_like 'Lol model' do
    let(:valid_attributes) { { id: 1 } }
  end

  %w(id name).each do |attribute|
    describe "#{attribute} attribute" do
      it_behaves_like 'plain attribute' do
        let(:attribute) { attribute }
        let(:attribute_value) { 'asd' }
      end
    end
  end

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

    context 'when it is passed as an hash' do
      subject { ChampionStatisticsSummary.new stats: { 'FooBar' => 'baz' } }

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

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

Version data entries

26 entries across 26 versions & 1 rubygems

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