
Untitled
By: a guest on
May 6th, 2012 | syntax:
None | size: 0.79 KB | hits: 12 | expires: Never
require 'spec_helper'
describe Catalog do
describe "validation" do
subject { Catalog.new }
it { should have(1).error_on(:title) }
it { should have(1).error_on(:valid_from) }
it { should have(1).error_on(:valid_until) }
end
describe "#current" do
before do
@curr_catalog = Factory(:catalog, :valid_from => 3.days.ago, :valid_until => 3.days.from_now)
@prev_catalog = Factory(:catalog, :valid_from => 9.days.ago, :valid_until => 3.days.ago)
@next_catalog = Factory(:catalog, :valid_from => 3.days.from_now, :valid_until => 9.days.from_now)
end
subject { Catalog.current }
it { should include(@curr_catalog) }
it { should_not include(@prev_catalog) }
it { should_not include(@next_catalog) }
end
end