templates/devise/cucumber.rb in prologue-0.3.6 vs templates/devise/cucumber.rb in prologue-0.3.7

- old
+ new

@@ -1,19 +1,19 @@ create_file 'spec/factories/user.rb' do <<-'FILE' Factory.define :user do |u| u.sequence(:name) { |n| "Quick #{n}" } - u.sequence(:email) { |n| "info.#{n}@quickleft.com" } + u.sequence(:email) { |n| "user.#{n}@quickleft.com" } u.password "password" u.confirmed_at Time.new.to_s u.confirmation_sent_at Time.new.to_s u.password_confirmation { |u| u.password } end Factory.define :admin, :parent => :user do |admin| - admin.email "quickleft@quickleft.com" + admin.email "admin@quickleft.com" admin.password "password" admin.roles { [ Factory(:role, :name => 'Admin') ] } end Factory.define :member, :parent => :user do |member| @@ -35,31 +35,23 @@ fill_in("user[email]", :with => email) fill_in("user[password]", :with => password) click_button("Sign in") end -Given /^a logged in admin user$/ do - Factory.create(:admin) +Given /^a logged in (\w+)$/ do |usertype| + Factory.create(usertype.to_sym) visit(new_user_session_path) - fill_in("user[email]", :with => "quickleft@quickleft.com") + fill_in("user[email]", :with => "#{usertype}@quickleft.com") fill_in("user[password]", :with => "password") click_button("Sign in") end -Given /^a logged in member user$/ do - Factory.create(:member) - visit(new_user_session_path) - fill_in("user[email]", :with => "member@quickleft.com") - fill_in("user[password]", :with => "password") - click_button("Sign in") -end - When /^I log out$/ do visit(destroy_user_session_path) end -Given /^a user "([^\"]*)"$/ do |email| - Factory.create(:user, :email => email) +Given /^an? (\w+) "([^\"]*)"$/ do |usertype, email| + Factory.create(usertype.to_sym, :email => email) end FILE end inject_into_file 'features/support/paths.rb', :after => "case page_name\n" do \ No newline at end of file