Skip to content

Instantly share code, notes, and snippets.

@abacha
Created March 14, 2013 20:58
Show Gist options
  • Select an option

  • Save abacha/5165213 to your computer and use it in GitHub Desktop.

Select an option

Save abacha/5165213 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require 'spec_helper'
feature "accounts" do
given(:person) { create(:person).decorate }
background { login_as(person.user) }
scenario "creating individual account" do
visit "/accounts/new"
within(".clients_0") do
find_field("Nome Completo").value.should == person.name
find_field("CPF").value.should == person.cpf
find_field("Email").value.should == person.email
find_field("Telefone Celular").value.should == person.phone_mobile
end
choose "Conta Individual"
click_on "Próximo ►"
person.accounts.should have(1).item
page.should have_content("Informações Pessoais")
page.should have_content(person.name.upcase)
end
scenario "creating joined account with a new user" do
visit "/accounts/new"
within(".clients_0") do
find_field("Nome Completo").value.should == person.name
find_field("CPF").value.should == person.cpf
find_field("Email").value.should == person.email
find_field("Telefone Celular").value.should == person.phone_mobile
select "Titular"
end
choose "Conta Conjunta"
within(".clients_1") do
fill_in "Nome Completo", with: "John Doe"
fill_in "CPF", with: "090.128.707-55"
fill_in "Email", with: "[email protected]"
fill_in "Telefone Celular", with: "(21) 33566312"
end
click_on "Próximo ►"
person.accounts.should have(1).item
page.should have_content("Informações Pessoais")
page.should have_content(person.name.upcase)
page.should have_content(Person.find_by_cpf("090.128.707-55").name.upcase)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment