Sha256: 2020cc1ba92f9ee3b655ed3673f5f491cf939a0ba0d3d9fc2e55186eab0eb126

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

module Zodiac
  describe Date do
    %w(Time Date DateTime).each do |date_class|
      context "included into #{date_class}" do
        before(:each) do
          klass = Object.const_get(date_class)
          if klass == Time
            @date = Time.gm(Finder::YEAR, 9, 27)
          else
            @date = klass.new(Finder::YEAR, 9, 27)
          end
        end
        
        it 'provides #zodiac_sign' do
          @date.zodiac_sign.should == I18n.t('zodiac.libra')
        end
        
        it "provides #zodiac_sign_id" do
          @date.zodiac_sign_id.should == 7
        end
        
        Zodiac.each_sign do |symbol, integer|
          method_name = "#{symbol}?"
          it "provides ##{method_name}" do
            @date.should respond_to(method_name)
          end
        end
        
        context "predicate methods (like #libra?)" do
          it "return true if the sign is correct" do
            @date.should be_libra
          end
          
          it "return false if the sign is incorrect" do
            @date.should_not be_gemini
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zodiac-0.2.6 spec/zodiac/date_spec.rb
zodiac-0.2.5 spec/zodiac/date_spec.rb
zodiac-0.2.4 spec/zodiac/date_spec.rb
zodiac-0.2.3 spec/zodiac/date_spec.rb
zodiac-0.2.2 spec/zodiac/date_spec.rb
zodiac-0.2.1 spec/zodiac/date_spec.rb
zodiac-0.2.0 spec/zodiac/date_spec.rb