Sha256: 729f7ee297626ae0b52135238240bdffc0e981cdb1547e73245b98b88424d7a1

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 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
        
        it "provides #zodiac_sign_symbol" do
          @date.zodiac_sign_symbol.should == :libra
        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

4 entries across 4 versions & 1 rubygems

Version Path
zodiac-0.2.10 spec/zodiac/date_spec.rb
zodiac-0.2.9 spec/zodiac/date_spec.rb
zodiac-0.2.8 spec/zodiac/date_spec.rb
zodiac-0.2.7 spec/zodiac/date_spec.rb