Sha256: 14b2951d1a8043e1b2f7d789f274d92d4270a6879887a347e25924f85858c00f

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 KB

Contents

Given /^"([^"]*)" is a member of the "([^"]*)" project$/ do |email, project_name|
  user = User.find_by_email!(email)
  project = Project.find_by_name!(project_name)
  Factory(:account_membership, :user => user, :account => project.account)
  Factory(:project_membership, :user => user, :project => project)
end

Given /^"([^"]*)" is a member of the "([^"]*)" account/ do |email, account_name|
  user = User.find_by_email!(email)
  account = Account.find_by_name!(account_name)
  Factory(:account_membership, :user => user, :account => account)
end

Given /^"([^"]*)" is an admin of the "([^"]*)" account/ do |email, account_name|
  user = User.find_by_email!(email)
  account = Account.find_by_name!(account_name)
  Factory(:account_membership, :user => user, :account => account, :admin => true)
end

Then /^the user "([^"]*)" should be an admin of "([^"]*)"$/ do |email, account_name|
  user = User.find_by_email!(email)
  account = Account.find_by_name!(account_name)
  user.should be_admin_of(account)
end

Given /^the user "([^"]*)" exists under the "([^"]*)" account$/ do |email, account_name|
  Given %{a user exists with an email of "#{email}"}
  Given %{"#{email}" is a member of the "#{account_name}" account}
end

When /^I fill in the following new user:$/ do |table|
  within "fieldset.new_user" do
    table.transpose.hashes.first.each do |field, value|
      fill_in field, :with => value
    end
  end
end

When /^I fill in the following existing user:$/ do |table|
  within "fieldset.existing_user" do
    table.transpose.hashes.first.each do |field, value|
      fill_in field, :with => value
    end
  end
end

Then /^"([^"]*)" should be a member of the "([^"]*)" account$/ do |email, account_name|
  User.find_by_email!(email).should be_member_of(Account.find_by_name!(account_name))
end

Then /^"([^"]*)" should be an admin member of the "([^"]*)" account$/ do |email, account_name|
  User.find_by_email!(email).should be_admin_of(Account.find_by_name!(account_name))
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
saucy-0.1.3 lib/generators/saucy/features/templates/step_definitions/user_steps.rb
saucy-0.1.2 lib/generators/saucy/features/templates/step_definitions/user_steps.rb
saucy-0.1.1 lib/generators/saucy/features/templates/step_definitions/user_steps.rb