Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ENV["RAILS_ENV"] = "test"
- require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
- require 'spec/rails/story_adapter'
- def create_account(options = {})
- options.reverse_update(
- :name => "test",
- :password => "secret",
- :password_confirmation => options[:password_confirmation] || options[:password] || "test@naruku.de",
- :email => "test@naruku.de",
- :email_confirmation => options[:email_confirmation] || options[:email] || "test@naruku.de",
- :activated => true
- )
- u = User.create!(options)
- u.activate! if options[:activated]
- end
- def current_user
- User.find(session[:user_id]) if session[:user_id]
- end
- steps_for :misc do
- Given "an account with username: $username and password: $password" do |username, password|
- create_account(:name => username, :password => password)
- end
- Given "I view the index" do
- visits "/"
- end
- When "I click the \"$link_text\" link" do |link_text|
- clicks_link link_text
- end
- When "I fill in \"$field\" with \"$content\"" do |field, content|
- fills_in field, :with => content
- end
- When "I click the \"$button\" button" do |button|
- clicks_button button
- end
- Then "I should be logged in" do
- session[:user_id].should_not be_nil
- end
- Then "I should not be logged in" do
- session[:user_id].should be_nil
- end
- Then "I should see a flash $type" do |type|
- if flash[type.to_sym]
- flash[type.to_sym].should_not be_blank
- else
- response.should have_tag("#flash") do
- with_tag(".#{type}")
- end
- end
- end
- Then "I should not see a flash $type" do |type|
- if flash[type.to_sym]
- flash[type.to_sym].should be_blank
- else
- response.should have_tag("#flash") do
- without_tag(".#{type}")
- end
- end
- end
- Then "I should see my dashboard" do
- response.should have_text(/Dein Dashboard/)
- end
- Then "I should see the signup page" do
- response.should have_text(/Anmeldung/)
- end
- Then "I should see the index" do
- response.should have_text(/Willkommen bei Naruku/)
- end
- Then "I should see error messages" do
- response.should have_tag("#errorExplanation") do
- with_tag("ul li")
- end
- end
- end
Add Comment
Please, Sign In to add comment