yhara-moneyrail 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +5 -0
- data/.gitmodules +6 -0
- data/Changelog +21 -0
- data/README +1 -0
- data/Rakefile +32 -0
- data/VERSION +1 -0
- data/app/controllers/accounts_controller.rb +99 -0
- data/app/controllers/application_controller.rb +10 -0
- data/app/controllers/categories_controller.rb +99 -0
- data/app/controllers/home_controller.rb +31 -0
- data/app/controllers/items_controller.rb +105 -0
- data/app/controllers/logs_controller.rb +20 -0
- data/app/helpers/accounts_helper.rb +2 -0
- data/app/helpers/application_helper.rb +3 -0
- data/app/helpers/categories_helper.rb +2 -0
- data/app/helpers/home_helper.rb +2 -0
- data/app/helpers/items_helper.rb +2 -0
- data/app/helpers/logs_helper.rb +42 -0
- data/app/models/account.rb +12 -0
- data/app/models/category.rb +26 -0
- data/app/models/expense.rb +2 -0
- data/app/models/income.rb +2 -0
- data/app/models/item.rb +31 -0
- data/app/models/move.rb +37 -0
- data/app/models/simple_item.rb +27 -0
- data/app/views/accounts/edit.html.erb +16 -0
- data/app/views/accounts/index.html.erb +24 -0
- data/app/views/accounts/new.html.erb +15 -0
- data/app/views/accounts/show.html.erb +8 -0
- data/app/views/categories/edit.html.erb +20 -0
- data/app/views/categories/index.html.erb +26 -0
- data/app/views/categories/new.html.erb +19 -0
- data/app/views/categories/show.html.erb +13 -0
- data/app/views/home/index.html.erb +15 -0
- data/app/views/items/edit.html.erb +45 -0
- data/app/views/items/index.html.erb +38 -0
- data/app/views/items/new.html.erb +40 -0
- data/app/views/items/show.html.erb +3 -0
- data/app/views/layouts/application.html.erb +37 -0
- data/app/views/logs/view.html.erb +120 -0
- data/config/boot.rb +110 -0
- data/config/database.yml +25 -0
- data/config/environment.rb +41 -0
- data/config/environments/cucumber.rb +21 -0
- data/config/environments/development.rb +17 -0
- data/config/environments/production.rb +28 -0
- data/config/environments/test.rb +28 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/inflections.rb +10 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/new_rails_defaults.rb +19 -0
- data/config/initializers/session_store.rb +15 -0
- data/config/locales/en.yml +5 -0
- data/config/routes.rb +80 -0
- data/db/migrate/20090802070406_create_accounts.rb +14 -0
- data/db/migrate/20090802073601_create_categories.rb +15 -0
- data/db/migrate/20090804065900_create_items.rb +26 -0
- data/doc/README_FOR_APP +2 -0
- data/features/step_definitions/webrat_steps.rb +129 -0
- data/features/support/env.rb +37 -0
- data/features/support/paths.rb +27 -0
- data/lib/tasks/cucumber.rake +20 -0
- data/lib/tasks/rspec.rake +182 -0
- data/main.rb +5 -0
- data/moneyrail.gemspec +170 -0
- data/public/404.html +30 -0
- data/public/422.html +30 -0
- data/public/500.html +30 -0
- data/public/favicon.ico +0 -0
- data/public/images/rails.png +0 -0
- data/public/javascripts/application.js +2 -0
- data/public/javascripts/controls.js +963 -0
- data/public/javascripts/dragdrop.js +973 -0
- data/public/javascripts/editor.js +188 -0
- data/public/javascripts/effects.js +1128 -0
- data/public/javascripts/jquery-ui.js +160 -0
- data/public/javascripts/jquery.js +32 -0
- data/public/javascripts/prototype.js +4320 -0
- data/public/robots.txt +5 -0
- data/public/stylesheets/editor.less +67 -0
- data/script/about +4 -0
- data/script/autospec +6 -0
- data/script/console +3 -0
- data/script/cucumber +8 -0
- data/script/dbconsole +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/spec +10 -0
- data/script/spec_server +9 -0
- data/spec/_fixtures/accounts.yml +5 -0
- data/spec/_fixtures/categories.yml +19 -0
- data/spec/_fixtures/incomes.yml +7 -0
- data/spec/_fixtures/items.yml +7 -0
- data/spec/fixtures/accounts.yml +11 -0
- data/spec/fixtures/categories.yml +24 -0
- data/spec/fixtures/items.yml +82 -0
- data/spec/helpers/accounts_helper_spec.rb +11 -0
- data/spec/helpers/categories_helper_spec.rb +11 -0
- data/spec/helpers/items_helper_spec.rb +11 -0
- data/spec/models/account_spec.rb +13 -0
- data/spec/models/category_spec.rb +9 -0
- data/spec/models/income_spec.rb +9 -0
- data/spec/models/item_spec.rb +13 -0
- data/spec/rcov.opts +2 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +51 -0
- data/vendor/plugins/acts_as_list/README +23 -0
- data/vendor/plugins/acts_as_list/init.rb +3 -0
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/vendor/plugins/less/LICENCE +20 -0
- data/vendor/plugins/less/README +52 -0
- data/vendor/plugins/less/init.rb +19 -0
- data/vendor/plugins/less/lib/less_for_rails.rb +37 -0
- data/vendor/plugins/less/test/less_for_rails_test.rb +15 -0
- metadata +201 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
config.action_view.cache_template_loading = true
|
16
|
+
|
17
|
+
# Disable request forgery protection in test environment
|
18
|
+
config.action_controller.allow_forgery_protection = false
|
19
|
+
|
20
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
21
|
+
# The :test delivery method accumulates sent emails in the
|
22
|
+
# ActionMailer::Base.deliveries array.
|
23
|
+
config.action_mailer.delivery_method = :test
|
24
|
+
|
25
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
26
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
27
|
+
# like if you have constraints or database-specific column types
|
28
|
+
# config.active_record.schema_format = :sql
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# These settings change the behavior of Rails 2 apps and will be defaults
|
4
|
+
# for Rails 3. You can remove this initializer when Rails 3 is released.
|
5
|
+
|
6
|
+
if defined?(ActiveRecord)
|
7
|
+
# Include Active Record class name as root for JSON serialized output.
|
8
|
+
ActiveRecord::Base.include_root_in_json = true
|
9
|
+
|
10
|
+
# Store the full class name (including module namespace) in STI type column.
|
11
|
+
ActiveRecord::Base.store_full_sti_class = true
|
12
|
+
end
|
13
|
+
|
14
|
+
# Use ISO 8601 format for JSON serialized times and dates.
|
15
|
+
ActiveSupport.use_standard_json_time_format = true
|
16
|
+
|
17
|
+
# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
|
18
|
+
# if you're including raw json in an HTML page.
|
19
|
+
ActiveSupport.escape_html_entities_in_json = false
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
4
|
+
# If you change this key, all old sessions will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
ActionController::Base.session = {
|
8
|
+
:key => '_moneyrail_session',
|
9
|
+
:secret => 'f56f10c9b9cde91bb4f967e6a669e6d7c84241e992100de4cacf0a58e913e6d5fe0bd9c87deef55c3edb29b19f6a5c81e37ba98db1674677897551654a2c3fbd'
|
10
|
+
}
|
11
|
+
|
12
|
+
# Use the database for sessions instead of the cookie-based default,
|
13
|
+
# which shouldn't be used to store highly confidential information
|
14
|
+
# (create the session table with "rake db:sessions:create")
|
15
|
+
# ActionController::Base.session_store = :active_record_store
|
data/config/routes.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
# -- item
|
3
|
+
map.resources :items
|
4
|
+
# provides expense_path, etc. which is equal to items_path
|
5
|
+
map.resources :expenses, :as => :items
|
6
|
+
map.resources :incomes, :as => :items
|
7
|
+
map.resources :moves, :as => :items
|
8
|
+
|
9
|
+
map.create_item 'items.:format',
|
10
|
+
:controller => :items, :action => :create,
|
11
|
+
:conditions => {:method => :post}
|
12
|
+
map.update_item 'items/:id/update.:format',
|
13
|
+
:controller => :items, :action => :update
|
14
|
+
map.destroy_item 'items/:id/destroy.:format',
|
15
|
+
:controller => :items, :action => :destroy
|
16
|
+
|
17
|
+
# -- category
|
18
|
+
map.resources :categories
|
19
|
+
map.move_up_category 'categories/:id/move_up',
|
20
|
+
:controller => :categories, :action => :move_up
|
21
|
+
map.move_down_category 'categories/:id/move_down',
|
22
|
+
:controller => :categories, :action => :move_down
|
23
|
+
|
24
|
+
# -- account
|
25
|
+
map.resources :accounts
|
26
|
+
map.move_up_account 'accounts/:id/move_up',
|
27
|
+
:controller => :accounts, :action => :move_up
|
28
|
+
map.move_down_account 'accounts/:id/move_down',
|
29
|
+
:controller => :accounts, :action => :move_down
|
30
|
+
|
31
|
+
# -- log
|
32
|
+
map.show_logs 'logs/:year/:month',
|
33
|
+
:controller => :logs, :action => 'view', :mode => :show
|
34
|
+
map.edit_logs 'logs/:year/:month/edit',
|
35
|
+
:controller => :logs, :action => 'view', :mode => :edit
|
36
|
+
|
37
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
38
|
+
|
39
|
+
# Sample of regular route:
|
40
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
41
|
+
# Keep in mind you can assign values other than :controller and :action
|
42
|
+
|
43
|
+
# Sample of named route:
|
44
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
45
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
46
|
+
|
47
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
48
|
+
# map.resources :products
|
49
|
+
|
50
|
+
# Sample resource route with options:
|
51
|
+
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
52
|
+
|
53
|
+
# Sample resource route with sub-resources:
|
54
|
+
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
55
|
+
|
56
|
+
# Sample resource route with more complex sub-resources
|
57
|
+
# map.resources :products do |products|
|
58
|
+
# products.resources :comments
|
59
|
+
# products.resources :sales, :collection => { :recent => :get }
|
60
|
+
# end
|
61
|
+
|
62
|
+
# Sample resource route within a namespace:
|
63
|
+
# map.namespace :admin do |admin|
|
64
|
+
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
65
|
+
# admin.resources :products
|
66
|
+
# end
|
67
|
+
|
68
|
+
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
69
|
+
# map.root :controller => "welcome"
|
70
|
+
|
71
|
+
map.root :controller => :home
|
72
|
+
|
73
|
+
# See how all your routes lay out with "rake routes"
|
74
|
+
|
75
|
+
# Install the default routes as the lowest priority.
|
76
|
+
# Note: These default routes make all actions in every controller accessible via GET requests. You should
|
77
|
+
# consider removing or commenting them out if you're using named routes and resources.
|
78
|
+
map.connect ':controller/:action/:id'
|
79
|
+
map.connect ':controller/:action/:id.:format'
|
80
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CreateItems < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :items do |t|
|
4
|
+
# common attributes
|
5
|
+
t.string :title
|
6
|
+
t.integer :amount
|
7
|
+
t.integer :category_id
|
8
|
+
t.date :date
|
9
|
+
t.integer :position
|
10
|
+
t.timestamps
|
11
|
+
|
12
|
+
# for Expense, Income
|
13
|
+
t.integer :account_id
|
14
|
+
# for Move
|
15
|
+
t.integer :account_id_from
|
16
|
+
t.integer :account_id_to
|
17
|
+
|
18
|
+
# for STI
|
19
|
+
t.string :type
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.down
|
24
|
+
drop_table :items
|
25
|
+
end
|
26
|
+
end
|
data/doc/README_FOR_APP
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
2
|
+
|
3
|
+
# Commonly used webrat steps
|
4
|
+
# http://github.com/brynary/webrat
|
5
|
+
|
6
|
+
Given /^I am on (.+)$/ do |page_name|
|
7
|
+
visit path_to(page_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^I go to (.+)$/ do |page_name|
|
11
|
+
visit path_to(page_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
When /^I press "([^\"]*)"$/ do |button|
|
15
|
+
click_button(button)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I follow "([^\"]*)"$/ do |link|
|
19
|
+
click_link(link)
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
23
|
+
fill_in(field, :with => value)
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
27
|
+
select(value, :from => field)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
31
|
+
# When I select "December 25, 2008 10:00" as the date and time
|
32
|
+
When /^I select "([^\"]*)" as the date and time$/ do |time|
|
33
|
+
select_datetime(time)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Use this step when using multiple datetime_select helpers on a page or
|
37
|
+
# you want to specify which datetime to select. Given the following view:
|
38
|
+
# <%= f.label :preferred %><br />
|
39
|
+
# <%= f.datetime_select :preferred %>
|
40
|
+
# <%= f.label :alternative %><br />
|
41
|
+
# <%= f.datetime_select :alternative %>
|
42
|
+
# The following steps would fill out the form:
|
43
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
44
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
45
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
46
|
+
select_datetime(datetime, :from => datetime_label)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Use this step in conjunction with Rail's time_select helper. For example:
|
50
|
+
# When I select "2:20PM" as the time
|
51
|
+
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
52
|
+
# will convert the 2:20PM to 14:20 and then select it.
|
53
|
+
When /^I select "([^\"]*)" as the time$/ do |time|
|
54
|
+
select_time(time)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Use this step when using multiple time_select helpers on a page or you want to
|
58
|
+
# specify the name of the time on the form. For example:
|
59
|
+
# When I select "7:30AM" as the "Gym" time
|
60
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
61
|
+
select_time(time, :from => time_label)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Use this step in conjunction with Rail's date_select helper. For example:
|
65
|
+
# When I select "February 20, 1981" as the date
|
66
|
+
When /^I select "([^\"]*)" as the date$/ do |date|
|
67
|
+
select_date(date)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Use this step when using multiple date_select helpers on one page or
|
71
|
+
# you want to specify the name of the date on the form. For example:
|
72
|
+
# When I select "April 26, 1982" as the "Date of Birth" date
|
73
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
74
|
+
select_date(date, :from => date_label)
|
75
|
+
end
|
76
|
+
|
77
|
+
When /^I check "([^\"]*)"$/ do |field|
|
78
|
+
check(field)
|
79
|
+
end
|
80
|
+
|
81
|
+
When /^I uncheck "([^\"]*)"$/ do |field|
|
82
|
+
uncheck(field)
|
83
|
+
end
|
84
|
+
|
85
|
+
When /^I choose "([^\"]*)"$/ do |field|
|
86
|
+
choose(field)
|
87
|
+
end
|
88
|
+
|
89
|
+
When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
90
|
+
attach_file(field, path)
|
91
|
+
end
|
92
|
+
|
93
|
+
Then /^I should see "([^\"]*)"$/ do |text|
|
94
|
+
response.should contain(text)
|
95
|
+
end
|
96
|
+
|
97
|
+
Then /^I should see \/([^\/]*)\/$/ do |regexp|
|
98
|
+
regexp = Regexp.new(regexp)
|
99
|
+
response.should contain(regexp)
|
100
|
+
end
|
101
|
+
|
102
|
+
Then /^I should not see "([^\"]*)"$/ do |text|
|
103
|
+
response.should_not contain(text)
|
104
|
+
end
|
105
|
+
|
106
|
+
Then /^I should not see \/([^\/]*)\/$/ do |regexp|
|
107
|
+
regexp = Regexp.new(regexp)
|
108
|
+
response.should_not contain(regexp)
|
109
|
+
end
|
110
|
+
|
111
|
+
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
112
|
+
field_labeled(field).value.should =~ /#{value}/
|
113
|
+
end
|
114
|
+
|
115
|
+
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
116
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
117
|
+
end
|
118
|
+
|
119
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
120
|
+
field_labeled(label).should be_checked
|
121
|
+
end
|
122
|
+
|
123
|
+
Then /^the "([^\"]*)" checkbox should not be checked$/ do |label|
|
124
|
+
field_labeled(label).should_not be_checked
|
125
|
+
end
|
126
|
+
|
127
|
+
Then /^I should be on (.+)$/ do |page_name|
|
128
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
129
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'spork'
|
3
|
+
|
4
|
+
Spork.prefork do
|
5
|
+
# Sets up the Rails environment for Cucumber
|
6
|
+
ENV["RAILS_ENV"] = "cucumber"
|
7
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
8
|
+
|
9
|
+
require 'webrat'
|
10
|
+
require 'cucumber/webrat/table_locator' # Lets you do table.diff!(table_at('#my_table').to_a)
|
11
|
+
|
12
|
+
Webrat.configure do |config|
|
13
|
+
config.mode = :rails
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'webrat/core/matchers'
|
17
|
+
require 'cucumber'
|
18
|
+
|
19
|
+
# Comment out the next line if you don't want Cucumber Unicode support
|
20
|
+
require 'cucumber/formatter/unicode'
|
21
|
+
|
22
|
+
require 'spec/rails'
|
23
|
+
require 'cucumber/rails/rspec'
|
24
|
+
end
|
25
|
+
|
26
|
+
Spork.each_run do
|
27
|
+
# This code will be run each time you run your specs.
|
28
|
+
require 'cucumber/rails/world'
|
29
|
+
|
30
|
+
# Comment out the next line if you don't want transactions to
|
31
|
+
# open/roll back around each scenario
|
32
|
+
Cucumber::Rails.use_transactional_fixtures
|
33
|
+
|
34
|
+
# Comment out the next line if you want Rails' own error handling
|
35
|
+
# (e.g. rescue_action_in_public / rescue_responses / rescue_from)
|
36
|
+
Cucumber::Rails.bypass_rescue
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
# Maps a name to a path. Used by the
|
3
|
+
#
|
4
|
+
# When /^I go to (.+)$/ do |page_name|
|
5
|
+
#
|
6
|
+
# step definition in webrat_steps.rb
|
7
|
+
#
|
8
|
+
def path_to(page_name)
|
9
|
+
case page_name
|
10
|
+
|
11
|
+
when /the homepage/
|
12
|
+
'/'
|
13
|
+
|
14
|
+
# Add more mappings here.
|
15
|
+
# Here is a more fancy example:
|
16
|
+
#
|
17
|
+
# when /^(.*)'s profile page$/i
|
18
|
+
# user_profile_path(User.find_by_login($1))
|
19
|
+
|
20
|
+
else
|
21
|
+
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
22
|
+
"Now, go and add a mapping in #{__FILE__}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
World(NavigationHelpers)
|