spec/lib/trackerific/event_spec.rb in trackerific-0.3.5 vs spec/lib/trackerific/event_spec.rb in trackerific-0.4.0

- old
+ new

@@ -1,20 +1,33 @@ require 'spec_helper' describe Trackerific::Event do - before(:all) do + + before do @date = Time.now - @event = Trackerific::Event.new(Time.new, String.new, String.new) + @description = "description" + @location = "location" + @event = Trackerific::Event.new(@date, @description, @location) end - describe "date" do - specify { @event.date.should be_a Time } + describe :date do + subject { @event.date } + it { should be @date } end - describe "description" do - specify { @event.description.should be_a String } + describe :description do + subject { @event.description } + it { should be @description } end - describe "location" do - specify { @event.location.should be_a String } + describe :location do + subject { @event.location } + it { should be @location } end + + describe :to_s do + before { @regex = /(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (0[1-9]|[1-2][0-9]|3[01]) \d{2}:\d{2} (am|pm).*/ } + subject { @event.to_s } + it("should be in format mmm dd hh:mm am/pm.*") { should =~ @regex } + end + end