Sha256: 704787dc01a0c2558d53e92cff26492231fe17cb3727093a89f6d2272ef84e11

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'
require File.dirname(__FILE__) + '/../../lib/yelp4r'

describe Yelp4r::Neighborhoods do
  include Yelp4rSpecHelper
  include Yelp4rNeighsSpecHelper
  
  before do
    @yelp_neighs = Yelp4r::Neighborhoods.new
    @yelp_neighs.parse_url = File.dirname(__FILE__) + "/../fixtures/neighborhoods.html"
  end
  
  describe 'initialize' do
    it 'should set the url for the page to parse' do
      @yelp_neighs.parse_url.should_not be_blank
    end
  end
  
  describe 'list' do
    before do 
      @neighs = @yelp_neighs.list  
    end
    
    it "should return the list of neighborhoods" do
      @neighs.should_not be_blank
      @neighs.should == yelp4r_test_neighs_list
    end
  end
  
  describe 'options_from_collection' do
    it "should return an array of options" do
      @yelp_neighs.options_from_list.should_not be_blank
      @yelp_neighs.options_from_list.should == yelp4r_test_neighs_opts
    end
    
    it "should return an array of options with a single selected value when given a string" do
      @opts = @yelp_neighs.options_from_list("Yaletown, Vancouver, BC, Canada")
      @opts.should_not be_blank
      @opts.should == yelp4r_test_neighs_opts_single_selected
    end
    
    it "should return an array of options with multiple selected values when given a array" do
      @opts = @yelp_neighs.options_from_list([
        "Yaletown, Vancouver, BC, Canada", 
        "New York, NY, USA", 
        "Bath Beach, Brooklyn, New York, NY, USA"
      ])
      @opts.should_not be_blank
      @opts.should == yelp4r_test_neighs_opts_multiple_selected
    end
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
tcocca-yelp4r-1.0.2 spec/yelp4r/neighborhoods_spec.rb
yelp4r-1.2.0 spec/yelp4r/neighborhoods_spec.rb
yelp4r-1.1.0 spec/yelp4r/neighborhoods_spec.rb