Sha256: 60c794b847cf20de6d74bcf2b91c03b8368bd959b767f8a2dfd85e5d9455e269

Contents?: true

Size: 988 Bytes

Versions: 2

Compression:

Stored size: 988 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe "Grouping" do

  describe "Using the API" do

    it "Create" do
      body = {'patrols' => [{
        'patrolid' => 1,
        'name' => 'Patrol Name',
        'active' => 1,
        'points' => '3',
      }]}
      FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/users.php?action=getPatrols&sectionid=2", :body => body.to_json)

      patrols = Osm::Grouping.get_for_section(@api, 2)
      patrols.size.should == 1
      patrol = patrols[0]
      patrol.id.should == 1
      patrol.section_id.should == 2
      patrol.name.should == 'Patrol Name'
      patrol.active.should == true
      patrol.points.should == 3
      patrol.valid?.should be_true
    end

    it "Handles no data" do
      FakeWeb.register_uri(:post, "https://www.onlinescoutmanager.co.uk/users.php?action=getPatrols&sectionid=2", :body => '')
      patrols = Osm::Grouping.get_for_section(@api, 2)
      patrols.size.should == 0
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
osm-0.1.17 spec/osm/grouping_spec.rb
osm-0.1.16 spec/osm/grouping_spec.rb