location_block_test.rb 897 Bytes
require File.dirname(__FILE__) + '/../test_helper'

class LocationBlockTest < ActiveSupport::TestCase

  def setup
    @profile = create_user('lele').person
    @block = LocationBlock.new
    @profile.boxes.first.blocks << @block
    @block.save!
  end
  attr_reader :block, :profile

  should 'provide description' do
    assert_not_equal Block.description, LocationBlock.description
  end

  should 'display no localization map without lat' do
    assert_tag_in_string block.content, :tag => 'i'
  end

  should 'be editable' do
    assert LocationBlock.new.editable?
  end

  should 'default title be blank by default' do
    assert_equal '', LocationBlock.new.title
  end

  should 'use google maps api v3' do
    @block.owner.lat = '-12.34'; @block.owner.save!
    assert_match 'http://maps.google.com/maps/api/staticmap', @block.content
    assert_no_match /key=/, @block.content
  end

end