Sha256: f3b6096392c63b3a5b378fa0da16d8ad13268d041253705ff7505fedc950564d

Contents?: true

Size: 1.25 KB

Versions: 116

Compression:

Stored size: 1.25 KB

Contents

module FactoryGirlDefinitionsHelper
  def append_file_to_factory_girl_definitions_path(path_to_file)
    FactoryGirl.definition_file_paths ||= []
    FactoryGirl.definition_file_paths << path_to_file
  end
end

World(FactoryGirlDefinitionsHelper)

When /^"([^"]*)" is added to Factory Girl's file definitions path$/ do |file_name|
  new_factory_file = File.join(current_dir, file_name.gsub(".rb", ""))

  append_file_to_factory_girl_definitions_path(new_factory_file)

  step %{I find definitions}
end

When /^"([^"]*)" is added to Factory Girl's file definitions path as an absolute path$/ do |file_name|
  new_factory_file = File.expand_path(File.join(current_dir, file_name.gsub(".rb", "")))

  append_file_to_factory_girl_definitions_path(new_factory_file)

  step %{I find definitions}
end

When /^I create a "([^"]*)" instance from Factory Girl$/ do |factory_name|
  FactoryGirl.create(factory_name)
end

Given /^these super users exist:$/ do |table|
  headers = table.headers + ["admin"]
  rows    = table.rows.map { |row| row + [true] }
  new_table = Cucumber::Ast::Table.new([headers] + rows)
  step %{the following person exists:}, new_table
end

When /^I find definitions$/ do
  FactoryGirl.find_definitions
end

When /^I reload factories$/ do
  FactoryGirl.reload
end

Version data entries

116 entries across 64 versions & 5 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.5 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.4 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.3 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.2 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.1 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.7.0 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.9 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.9 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.8 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.8 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.7 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.7 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.6 vendor/bundle/gems/factory_girl-3.2.0/features/step_definitions/factory_girl_steps.rb
classiccms-0.6.6 vendor/bundle/gems/factory_girl-3.3.0/features/step_definitions/factory_girl_steps.rb