Skip to content

Instantly share code, notes, and snippets.

@heronmedeiros
Created April 13, 2011 18:58
Show Gist options
  • Save heronmedeiros/918153 to your computer and use it in GitHub Desktop.
Save heronmedeiros/918153 to your computer and use it in GitHub Desktop.
#ap/model/bunch.rb
def excisable?
created_at <= 12.weeks.ago
end
#bunch_spec.rb
require 'spec_helper'
describe Bunch do
before(:each) do
@bunch = Factory.build(:bunch)
end
context 'verificar a quantidade prevista de cachos' do
# Como usuario quero verificar a quantidade prevista de cachos a colher na semana
# recebe o dia e com base na semana procura todos os cachos previstos pra colheita.
# Os cachos lançados numa determinada semana deverão ser colhidos após 10 a 12 semanas aproximadamente.
it 'Cachos que podem ser colhidos' do
@bunch = Factory(:bunch, :created_at => 12.weeks.ago)
@bunch.should be_excisable
end
it 'Um novo cacho nao pode ser colhidos' do
@bunch = Factory(:bunch, :created_at => Time.now)
@bunch.should_not be_excisable
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment