Skip to content

Instantly share code, notes, and snippets.

Se
1 = 5
2 = 25
3 = 325
4 = 4325
5 = X
Qual o valor de X? (faz um fork com a resposta ;D)
'''Aceitando requisições para a URL de validação com ou sem / no final (o manual indica *com*, mas atualmente só aceita sem)'''
'''pagseguro.py:107'''
if path.lower().rstrip('/')=='/security/npi/default.aspx':
'''pagsegurotest.py:53'''
def testNPIWithoutSlash(self):
'''Testa se a confirmação do retorno automático (usando url sem /) vem como "VERIFICADO"'''
retorno=pagseguro.process(retornoURL,dados)
self.assertEquals('VERIFICADO',retorno)
# template.rb
# from Anderson Dias
#====================
# PLUGINS
#====================
# Testing
plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git'
plugin 'cucumber', :git => 'git://github.com/aslakhellesoy/cucumber.git'
Feature: Sign Up
In order to access the restricted areas of the site
visitor
wants to sign up and activate an account
Scenario: Sign up
When I signup as elomar, elomar@maisweb.org, Elomar França
Then I should not be logged in
And I should receive an email with subject "Please activate your new account"
class EventsController < ResourceController::Base
before_filter :require_user, :except => [:index, :show]
before_filter :require_organizer, :only => [:edit, :update, :destroy]
create.before do
object.organizer = current_user
end
end
require File.dirname(__FILE__) + '/../spec_helper'
describe Event do
it { should belong_to(:organizer, :class_name => "User") }
it { should have_many(:registrations) }
it { should have_many(:users, :through => :registrations) }
it { should have_many(:promocodes)}
it { should validate_presence_of(:title, :location, :description, :start_at, :finish_at)}
it { should validate_numericality_of(:price, :allow_nil => true)}
require 'faker'
Sham.name { Faker::Name.name }
Sham.email { Faker::Internet.email }
Sham.title { Faker::Lorem.sentence }
Sham.body { Faker::Lorem.paragraph }
User.blueprint do
name
email
Post.blueprint do
title "Hello world"
text "<p>Hello there</p>"*3
published_on Date.today
author { User.make }
end
Comment.blueprint do
author_name "Test name"
author_email "unknown@maisweb.org"
post = Post.make
post.new_record? # false
post = Post.make_unsaved
post.new_record? # true
post.plan
# { :title => "Lorem ipsum", :body => "Lorem ipsum dolor sit amet", ... }
post = Post.make(:title => "Machinist FTW")
Comment.blueprint do
author_name "Test name"
author_email "unknown@maisweb.org"
post
end
Comment.blueprint(:approved) do
state :approved
end