Sha256: 981e9ac994736488c8fb694e0fdad30de1ad4108e8e6c8f701c27eec8afe20bf

Contents?: true

Size: 1.4 KB

Versions: 14

Compression:

Stored size: 1.4 KB

Contents

require "spec_helper"
require "lol"

include Lol

describe Team do
  it_behaves_like 'Lol model' do
    let(:valid_attributes) { {  } }
  end

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

  %w(create_date last_game_date last_join_date second_last_join_date third_last_join_date last_joined_ranked_team_queue_date modify_date).each do |attribute|
    describe "#{attribute} attribute" do
      it_behaves_like 'time attribute' do
        let(:attribute) { attribute }
      end
    end
  end

  describe 'match_history attribute' do
    it_behaves_like 'collection attribute' do
      let(:attribute) { 'match_history' }
      let(:attribute_class) { MatchSummary }
    end
  end

  describe 'team_stat_details attribute' do
    it_behaves_like 'collection attribute' do
      let(:attribute) { 'team_stat_details' }
      let(:attribute_class) { TeamStatistic }
      let(:attribute_value) { { 'teamStatDetails' => [{}, {}] } }
    end
  end

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

    it 'parses the value if it is an Hash' do
      model = Team.new roster: {}
      expect(model.roster).to be_a Roster
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruby-lol-0.12.2 spec/lol/team_spec.rb
ruby-lol-0.12.1 spec/lol/team_spec.rb
ruby-lol-0.12.0 spec/lol/team_spec.rb
ruby-lol-0.11.6 spec/lol/team_spec.rb
ruby-lol-0.11.5 spec/lol/team_spec.rb
ruby-lol-0.11.4 spec/lol/team_spec.rb
ruby-lol-0.11.3 spec/lol/team_spec.rb
ruby-lol-0.11.2 spec/lol/team_spec.rb
ruby-lol-0.11.1 spec/lol/team_spec.rb
ruby-lol-0.11.0 spec/lol/team_spec.rb
ruby-lol-0.10.0 spec/lol/team_spec.rb
ruby-lol-0.9.19.1 spec/lol/team_spec.rb
ruby-lol-0.9.19 spec/lol/team_spec.rb
ruby-lol-0.9.18 spec/lol/team_spec.rb