Sha256: 6354b9b423aa96d99378158f4534ef6c9315ec532d21e619da8f21b97941dc49

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 Bytes

Contents

require 'spec_helper'

include Ajax::Helpers::RequestHelper

describe 'Ajax::Helpers::RequestHelpers' do
  describe 'set_header' do
    before :each do
      @headers = {}
    end

    it "should add headers" do
      set_header @headers, :tab, '#main .home_tab'
      @headers['Ajax-Info']['tab'].should == '#main .home_tab'
    end

    it "should add assets" do
      set_header @headers, :assets, { :key => ['value'] }
      @headers['Ajax-Info']['assets'].should == { :key => ['value'] }
    end

    it "should merge hashes" do
      set_header @headers, :assets, { :key => ['value1'] }
      set_header @headers, :assets, { :key => ['value2'] }
      @headers['Ajax-Info']['assets'].should == { :key => ['value1', 'value2'] }
    end
    
    it "should concat arrays" do
      set_header @headers, :callbacks, ['one']
      set_header @headers, :callbacks, ['two']
      @headers['Ajax-Info']['callbacks'].should == ['one', 'two']
    end    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ajax-0.1.4 spec/ajax/request_helper_spec.rb
ajax-0.1.3 spec/ajax/request_helper_spec.rb
ajax-0.1.2 spec/ajax/request_helper_spec.rb