Skip to content

Instantly share code, notes, and snippets.

@dmilith
Created December 29, 2008 20:20
Show Gist options
  • Select an option

  • Save dmilith/41373 to your computer and use it in GitHub Desktop.

Select an option

Save dmilith/41373 to your computer and use it in GitHub Desktop.
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
require 'webrat'
describe "routes test" do
before(:each) do
@response0 = request("/")
@response1 = request("/register")
@response2 = request("/register/new")
@response3 = request("/register/create")
@response4 = request("/regulations")
@response5 = request("/help")
@response6 = request("/price_list")
end
it "responds successfully" do
@response0.should be_successful
@response1.should be_successful
@response2.should be_successful
@response3.should_not be_successful
@response4.should be_successful
@response5.should be_successful
@response6.should be_successful
end
end
describe "login test" do
it "logged in successfully" do
visits "/"
click_link "Zaloguj się"
fill_in "Login", :with => "dmilith"
fill_in "Password", :with => "Alaniemakota666"
click_button "Log in"
response.should be_successful
response.body.to_s.should match(/Authenticated\ Successfully/)
end
end
describe "registration test" do
given "there're no users" do
User.all.destroy!
end
it "registered successfully" do
visits "/register/new"
fill_in "Login", :with => "dmilith2"
fill_in "Hasło", :with => "Alaniemakota666"
fill_in "Powtórz hasło", :with => "Alaniemakota666"
fill_in "Imię", :with => "zło wcielone"
fill_in "Nazwisko", :with => "zło wcielone 2"
fill_in "Adres", :with => "piekło 666"
fill_in "E-Mail", :with => "dmilith@gmail.com"
fill_in "Telefon", :with => "666666666"
click_button "Rejestruj użytkownika"
response.should be_successful
response.body.to_s.should_not match(/submission failed/)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment