Sha256: 6131499f951fe8d820db883bb6d29c14e5865b05449e43bc54315db1584d1561

Contents?: true

Size: 1.72 KB

Versions: 12

Compression:

Stored size: 1.72 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe "DueBadge" do

  it "Create" do
    data = {
      'pending' => {
        'badge_name' => [
          {
            'scoutid' => '1',
            'firstname' => 'John',
            'lastname' => 'Doe',
            'completed' => '',
            'extra' => '',
          }
        ],
        'cubs_core_participation' => [{
            'sid' => '2',
            'firstname' => 'Jane',
            'lastname' => 'Doe',
            'completed' => '3',
            'extra' => 'Lvl 3'
          }, {
            'sid' => '1',
            'firstname' => 'John',
            'lastname' => 'Doe',
            'completed' => '2',
            'extra' => 'Lvl 2'
          }
        ]
      },

      'description' => {
        'badge_name' => {
          'name' => 'Badge Name',
          'section' => 'cubs',
          'type' => 'activity',
          'badge' => 'badge_name'
        },
        'cubs_core_participation' => {
          'name' => 'Participation',
          'section' => 'cubs',
          'type' => 'core',
          'badge' => 'participation'
        }
      }
    }
    db = Osm::DueBadges.new(data)

    db.empty?.should == false
    db.descriptions.should == {:badge_name=>{:name=>"Badge Name", :section=>:cubs, :type=>:activity, :badge=>"badge_name"}, :cubs_core_participation=>{:name=>"Participation", :section=>:cubs, :type=>:core, :badge=>"participation"}}
    db.by_member.should == {"John Doe"=>[{:badge=>:badge_name, :extra_information=>""}, {:badge=>:cubs_core_participation, :extra_information=>"Lvl 2"}], "Jane Doe"=>[{:badge=>:cubs_core_participation, :extra_information=>"Lvl 3"}]}
    db.totals.should == {:badge_name=>{""=>1}, :cubs_core_participation=>{"Lvl 3"=>1, "Lvl 2"=>1}}
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
osm-0.0.11 spec/osm/due_badges_spec.rb
osm-0.0.10 spec/osm/due_badges_spec.rb
osm-0.0.9 spec/osm/due_badges_spec.rb
osm-0.0.8 spec/osm/due_badges_spec.rb
osm-0.0.7 spec/osm/due_badges_spec.rb
osm-0.0.6 spec/osm/due_badges_spec.rb
osm-0.0.5 spec/osm/due_badges_spec.rb
osm-0.0.4 spec/osm/due_badges_spec.rb
osm-0.0.3 spec/osm/due_badges_spec.rb
osm-0.0.2 spec/osm/due_badges_spec.rb
osm-0.0.1 spec/osm/due_badges_spec.rb
osm-0.0.1.alpha spec/osm/due_badges_spec.rb