Sha256: bc08d057d5f8d09371591f674319dbc87f4fc58d6de9fc4c78d622590e03908d

Contents?: true

Size: 1.86 KB

Versions: 7

Compression:

Stored size: 1.86 KB

Contents

require 'spec/spec_helper'
require 'spec/helpers/nested_tag_helper'

#
# Test for Shop Line Item Tags
#
describe Shop::Tags::Card do
  
  dataset :pages
  
  before :all do
    @page = pages(:home)
  end
  
  it 'should describe these tags' do
    Shop::Tags::Card.tags.sort.should == [
      'form:card',
      'form:card:type',
      'form:card:month',
      'form:card:year'].sort
  end
  
  describe 'form:card:type' do
    it 'should output the card types' do
      tag = %{<r:form:card:type />}
      exp = %{<select name="card[type]" id="card_type">
<option value="amex">American Express</option>
<option value="diners">Diners Club</option>
<option value="mastercard">Master Card</option>
<option value="visa">Visa</option>
</select>}

      @page.should render(tag).as(exp)
    end
  end
  
  describe 'form:card:month' do
    it 'should output the card months' do
      tag = %{<r:form:card:month />}
      exp = %{<select name="card[month]" id="card_month">
<option value="01">01 - January</option>
<option value="02">02 - February</option>
<option value="03">03 - March</option>
<option value="04">04 - April</option>
<option value="05">05 - May</option>
<option value="06">06 - June</option>
<option value="07">07 - July</option>
<option value="08">08 - August</option>
<option value="09">09 - September</option>
<option value="10">10 - October</option>
<option value="11">11 - November</option>
<option value="12">12 - December</option>
</select>}

      @page.should render(tag).as(exp)
    end
  end
  
  describe 'form:card:year' do
    it 'should output the card years' do
      tag = %{<r:form:card:year />}
      exp = %{<select name="card[year]" id="card_year">\n}
      (Time.new.year ... Time.new.year + 10).each do |year|
        exp << %{<option value="#{year}">#{year}</option>\n}
      end
      exp << %{</select>}
      @page.should render(tag).as(exp)
    end
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
radiant-shop-extension-0.11.6 spec/lib/shop/tags/card_spec.rb
radiant-shop-extension-0.11.5 spec/lib/shop/tags/card_spec.rb
radiant-shop-extension-0.11.4 spec/lib/shop/tags/card_spec.rb
radiant-shop-extension-0.11.3 spec/lib/shop/tags/card_spec.rb
radiant-shop-extension-0.11.1 spec/lib/shop/tags/card_spec.rb
radiant-shop-extension-0.11.0 spec/lib/shop/tags/card_spec.rb
radiant-shop-extension-0.10.0 spec/lib/shop/tags/card_spec.rb