Class: Saucy::Generators::FeaturesGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/saucy/features/features_generator.rb

Instance Method Summary collapse

Methods inherited from Base

source_root

Instance Method Details

#copy_feature_filesObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/saucy/features/features_generator.rb', line 12

def copy_feature_files
  engine_directory "features"
  engine_directory "features/step_definitions"
  engine_directory "features/support"
  template "README", "features/saucy/README"
  template "README", "features/step_definitions/saucy/README"
  empty_directory "spec"
  empty_directory "spec/factories"
  template "factories.rb", "spec/factories/saucy_factories.rb"
end

#create_pathsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/generators/saucy/features/features_generator.rb', line 29

def create_paths
  paths = "    when 'the admin page'\nadmin_path\n    when 'the list of accounts'\naccounts_path\n    when 'the list of plans page'\nplans_path\n    when /^the memberships page for the \"([^\"]+)\" account$/\naccount = Account.find_by_name!($1)\naccount_memberships_path(account)\n    when /^the projects page for the \"([^\"]+)\" account$/\naccount = Account.find_by_name!($1)\naccount_projects_path(account)\n    when /settings page for the \"([^\"]+)\" account$/i\naccount = Account.find_by_name!($1)\nedit_account_path(account)\n    when /settings page$/\nedit_profile_path\n    when /dashboard page$/\naccounts_path\n    when /sign up page for the \"([^\"]+)\" plan$/i\nplan = Plan.find_by_name!($1)\nnew_plan_account_path(plan)\n    when /^the billing page for the \"([^\"]+)\" account$/\naccount = Account.find_by_name!($1)\naccount_billing_path(account)\n    when /^the upgrade plan page for the \"([^\"]+)\" account$/\naccount = Account.find_by_name!($1)\nedit_account_plan_path(account)\n    when /^the new project page for the newest account by \"([^\"]*)\"$/\nuser = User.find_by_email!($1)\naccount = user.accounts.order(\"id desc\").first\nnew_account_project_path(account)\n    when /^the \"([^\"]*)\" project page$/\nproject = Project.find_by_name!($1)\naccount_project_path(project.account, project)\n    when /^the new project page for the \"([^\"]+)\" account$/\naccount = Account.find_by_name!($1)\nnew_account_project_path(account)\n\n\n  PATHS\n\n  replace_in_file \"features/support/paths.rb\",\n                  \"case page_name\",\n                  \"case page_name\\n\#{paths}\"\nend\n"

#remove_conflicting_filesObject



23
24
25
26
27
# File 'lib/generators/saucy/features/features_generator.rb', line 23

def remove_conflicting_files
  remove_file "features/clearance/visitor_signs_up.feature"
  remove_file "spec/factories/clearance.rb"
  remove_file "test/factories/clearance.rb"
end