muck-services 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -9
- data/VERSION +1 -1
- data/muck-services.gemspec +241 -362
- metadata +9 -241
- data/.gitignore +0 -30
- data/test/rails_test/app/controllers/application_controller.rb +0 -24
- data/test/rails_test/app/controllers/default_controller.rb +0 -7
- data/test/rails_test/app/helpers/application_helper.rb +0 -3
- data/test/rails_test/app/models/activity.rb +0 -24
- data/test/rails_test/app/models/comment.rb +0 -23
- data/test/rails_test/app/models/country.rb +0 -13
- data/test/rails_test/app/models/language.rb +0 -15
- data/test/rails_test/app/models/share.rb +0 -20
- data/test/rails_test/app/models/state.rb +0 -13
- data/test/rails_test/app/models/user.rb +0 -45
- data/test/rails_test/app/models/user_session.rb +0 -2
- data/test/rails_test/config/application.rb +0 -42
- data/test/rails_test/config/boot.rb +0 -13
- data/test/rails_test/config/environment.rb +0 -5
- data/test/rails_test/config/environments/development.rb +0 -26
- data/test/rails_test/config/environments/production.rb +0 -49
- data/test/rails_test/config/environments/test.rb +0 -35
- data/test/rails_test/config/initializers/backtrace_silencers.rb +0 -7
- data/test/rails_test/config/initializers/inflections.rb +0 -10
- data/test/rails_test/config/initializers/mce_options.rb +0 -83
- data/test/rails_test/config/initializers/mime_types.rb +0 -5
- data/test/rails_test/config/initializers/muck.rb +0 -66
- data/test/rails_test/config/initializers/secret_token.rb +0 -7
- data/test/rails_test/config/initializers/session_store.rb +0 -8
- data/test/rails_test/config/routes.rb +0 -12
- data/test/rails_test/db/migrate/20090320174818_create_muck_permissions_and_roles.rb +0 -16
- data/test/rails_test/db/migrate/20090327231918_create_users.rb +0 -40
- data/test/rails_test/db/migrate/20090402033319_add_muck_activities.rb +0 -36
- data/test/rails_test/db/migrate/20090402234137_create_languages.rb +0 -18
- data/test/rails_test/db/migrate/20090426041056_create_countries.rb +0 -15
- data/test/rails_test/db/migrate/20090426041103_create_states.rb +0 -18
- data/test/rails_test/db/migrate/20090512013727_create_profiles.rb +0 -21
- data/test/rails_test/db/migrate/20090517040220_create_uploads.rb +0 -38
- data/test/rails_test/db/migrate/20090602191243_create_muck_raker.rb +0 -322
- data/test/rails_test/db/migrate/20090613173314_create_comments.rb +0 -24
- data/test/rails_test/db/migrate/20090619211125_create_tag_clouds.rb +0 -19
- data/test/rails_test/db/migrate/20090623181458_add_grain_size_to_entries.rb +0 -16
- data/test/rails_test/db/migrate/20090623193525_add_grain_size_to_tag_clouds.rb +0 -12
- data/test/rails_test/db/migrate/20090703055724_add_contents.rb +0 -49
- data/test/rails_test/db/migrate/20090703175825_denormalize_entries_subjects.rb +0 -42
- data/test/rails_test/db/migrate/20090704220055_create_slugs.rb +0 -18
- data/test/rails_test/db/migrate/20090716035935_change_tag_cloud_grain_sizes.rb +0 -9
- data/test/rails_test/db/migrate/20090717173900_add_contributor_to_feeds.rb +0 -9
- data/test/rails_test/db/migrate/20090717175825_normalize_entries_subjects.rb +0 -47
- data/test/rails_test/db/migrate/20090721043213_change_services_title_to_name.rb +0 -9
- data/test/rails_test/db/migrate/20090721054927_remove_services_not_null_from_feeds.rb +0 -9
- data/test/rails_test/db/migrate/20090723050510_create_feed_parents.rb +0 -17
- data/test/rails_test/db/migrate/20090728165716_add_etag_to_feeds.rb +0 -9
- data/test/rails_test/db/migrate/20090730044139_add_comment_cache.rb +0 -9
- data/test/rails_test/db/migrate/20090730045848_add_comment_cache_to_entries.rb +0 -9
- data/test/rails_test/db/migrate/20090730154102_allow_null_user.rb +0 -9
- data/test/rails_test/db/migrate/20090803185323_create_shares.rb +0 -16
- data/test/rails_test/db/migrate/20090804184247_add_comment_count_to_shares.rb +0 -9
- data/test/rails_test/db/migrate/20090804211240_add_entry_id_to_shares.rb +0 -9
- data/test/rails_test/db/migrate/20090804231857_add_shares_uri_index.rb +0 -9
- data/test/rails_test/db/migrate/20090806230610_add_layout_to_contents.rb +0 -9
- data/test/rails_test/db/migrate/20090808175401_add_contents_comment_counter_cache.rb +0 -9
- data/test/rails_test/db/migrate/20090818204527_add_activity_indexes.rb +0 -9
- data/test/rails_test/db/migrate/20090819030523_add_attachable_to_activities.rb +0 -13
- data/test/rails_test/db/migrate/20090826220530_change_services_sequence_to_sort.rb +0 -9
- data/test/rails_test/db/migrate/20090826225652_create_identity_feeds.rb +0 -14
- data/test/rails_test/db/migrate/20090827005105_add_identity_fields_to_services.rb +0 -13
- data/test/rails_test/db/migrate/20090827015308_create_service_categories.rb +0 -12
- data/test/rails_test/db/migrate/20090827221502_add_prompt_and_template_to_services.rb +0 -11
- data/test/rails_test/db/migrate/20090915041650_aggregations_to_polymorphic.rb +0 -15
- data/test/rails_test/db/migrate/20090922174200_update_oai_endpoints.rb +0 -13
- data/test/rails_test/db/migrate/20090922231552_add_dates_to_oai_endpoints.rb +0 -11
- data/test/rails_test/db/migrate/20090923150807_rename_name_in_aggregation.rb +0 -9
- data/test/rails_test/db/migrate/20090924200750_add_uri_data_template_to_services.rb +0 -9
- data/test/rails_test/db/migrate/20091006183742_add_feed_count_to_aggregation.rb +0 -9
- data/test/rails_test/db/migrate/20091022150615_add_uri_key_to_services.rb +0 -9
- data/test/rails_test/db/migrate/20091115011828_add_aggregations_for_personal_recs.rb +0 -9
- data/test/rails_test/db/migrate/20091116094447_rename_action_table.rb +0 -38
- data/test/rails_test/db/migrate/20091118203605_add_default_feed_type_to_aggregation_feed.rb +0 -10
- data/test/rails_test/db/migrate/20091124203137_add_location_to_profiles.rb +0 -15
- data/test/rails_test/db/migrate/20091124205819_add_fields_to_profiles.rb +0 -21
- data/test/rails_test/db/migrate/20100123035450_create_access_codes.rb +0 -19
- data/test/rails_test/db/migrate/20100123233654_create_access_code_requests.rb +0 -14
- data/test/rails_test/db/migrate/20100206000906_remove_name_fields.rb +0 -15
- data/test/rails_test/db/migrate/20100903205928_add_dead_entry_fields.rb +0 -13
- data/test/rails_test/features/step_definitions/common_steps.rb +0 -93
- data/test/rails_test/features/step_definitions/visit_steps.rb +0 -6
- data/test/rails_test/features/step_definitions/web_steps.rb +0 -219
- data/test/rails_test/features/step_definitions/webrat_steps.rb +0 -128
- data/test/rails_test/features/support/custom_env.rb +0 -19
- data/test/rails_test/features/support/env.rb +0 -58
- data/test/rails_test/features/support/paths.rb +0 -33
- data/test/rails_test/lib/daemons/amazonaws.rb +0 -36
- data/test/rails_test/public/dispatch.rb +0 -10
- data/test/rails_test/spec/controllers/admin/feeds_controller_spec.rb +0 -38
- data/test/rails_test/spec/controllers/admin/oai_endpoints_controller_spec.rb +0 -30
- data/test/rails_test/spec/controllers/aggregation_feeds_controller_spec.rb +0 -67
- data/test/rails_test/spec/controllers/aggregations_controller_spec.rb +0 -89
- data/test/rails_test/spec/controllers/feed_previews_controller_spec.rb +0 -32
- data/test/rails_test/spec/controllers/feeds_controller_spec.rb +0 -78
- data/test/rails_test/spec/controllers/identity_feeds_controller_spec.rb +0 -110
- data/test/rails_test/spec/controllers/oai_endpoints_controller_spec.rb +0 -42
- data/test/rails_test/spec/controllers/topics_controller_spec.rb +0 -50
- data/test/rails_test/spec/controllers/visits_controller_spec.rb +0 -21
- data/test/rails_test/spec/factories.rb +0 -16
- data/test/rails_test/spec/mailers/services_mailer_spec.rb +0 -31
- data/test/rails_test/spec/models/aggregation_feed_spec.rb +0 -23
- data/test/rails_test/spec/models/aggregation_spec.rb +0 -87
- data/test/rails_test/spec/models/entry_spec.rb +0 -195
- data/test/rails_test/spec/models/feed_parent_spec.rb +0 -22
- data/test/rails_test/spec/models/feed_spec.rb +0 -204
- data/test/rails_test/spec/models/identity_feed_spec.rb +0 -18
- data/test/rails_test/spec/models/oai_endpoint_spec.rb +0 -78
- data/test/rails_test/spec/models/personal_recommendation_spec.rb +0 -60
- data/test/rails_test/spec/models/recommendation_spec.rb +0 -27
- data/test/rails_test/spec/models/service_category_spec.rb +0 -19
- data/test/rails_test/spec/models/service_spec.rb +0 -383
- data/test/rails_test/spec/models/share_spec.rb +0 -30
- data/test/rails_test/spec/models/tag_cloud_spec.rb +0 -23
- data/test/rails_test/spec/models/user_spec.rb +0 -45
- data/test/rails_test/spec/spec_helper.rb +0 -36
@@ -1,14 +0,0 @@
|
|
1
|
-
class CreateIdentityFeeds < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :identity_feeds, :force => true do |t|
|
4
|
-
t.integer "feed_id", :null => false
|
5
|
-
t.integer "ownable_id", :null => false
|
6
|
-
t.string "ownable_type", :null => false
|
7
|
-
end
|
8
|
-
add_index :identity_feeds, ["ownable_id", "ownable_type"]
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.down
|
12
|
-
drop_table :identity_feeds
|
13
|
-
end
|
14
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class AddIdentityFieldsToServices < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :services, :use_for, :string
|
4
|
-
add_column :services, :service_category_id, :integer
|
5
|
-
add_column :services, :active, :boolean, :default => true
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
remove_column :services, :use_for
|
10
|
-
remove_column :services, :service_category_id
|
11
|
-
remove_column :services, :active
|
12
|
-
end
|
13
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class CreateServiceCategories < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :service_categories, :force => true do |t|
|
4
|
-
t.string 'name', :null => false
|
5
|
-
t.integer 'sort', :default => 0
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
drop_table :service_categories
|
11
|
-
end
|
12
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class AddPromptAndTemplateToServices < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :services, :prompt, :string
|
4
|
-
add_column :services, :template, :string
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.down
|
8
|
-
remove_column :services, :prompt
|
9
|
-
remove_column :services, :template
|
10
|
-
end
|
11
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class AggregationsToPolymorphic < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
remove_column :aggregations, :user_id
|
4
|
-
add_column :aggregations, :ownable_id, :integer
|
5
|
-
add_column :aggregations, :ownable_type, :string
|
6
|
-
add_index :aggregations, [:ownable_id, :ownable_type]
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
add_column :aggregations, :user_id, :integer
|
11
|
-
remove_column :aggregations, :ownable_id
|
12
|
-
remove_column :aggregations, :ownable_type
|
13
|
-
remove_index :aggregations, [:ownable_id, :ownable_type]
|
14
|
-
end
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class UpdateOaiEndpoints < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :oai_endpoints, :contributor_id, :integer
|
4
|
-
add_column :oai_endpoints, :status, :integer
|
5
|
-
add_column :oai_endpoints, :default_language_id, :integer
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
remove_column :oai_endpoints, :contributor_id
|
10
|
-
remove_column :oai_endpoints, :status
|
11
|
-
remove_column :oai_endpoints, :default_language_id
|
12
|
-
end
|
13
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class AddDatesToOaiEndpoints < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :oai_endpoints, :created_at, :datetime
|
4
|
-
add_column :oai_endpoints, :updated_at, :datetime
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.down
|
8
|
-
remove_column :oai_endpoints, :created_at
|
9
|
-
remove_column :oai_endpoints, :updated_at
|
10
|
-
end
|
11
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
class RenameActionTable < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
rename_table :action_types, :attention_types
|
4
|
-
rename_column :attention_types, :action_type, :name
|
5
|
-
rename_column :attention_types, :weight, :default_weight
|
6
|
-
|
7
|
-
change_column :attentions, :attentionable_type, :string, :default => 'User'
|
8
|
-
rename_column :attentions, :action_type, :attention_type_id
|
9
|
-
change_column :attentions, :attention_type_id, :integer
|
10
|
-
change_column :attentions, :weight, :integer, :default => 5
|
11
|
-
add_column :attentions, :created_at, :datetime
|
12
|
-
add_index :attentions, :attention_type_id
|
13
|
-
add_index :attentions, :entry_id
|
14
|
-
|
15
|
-
remove_column :personal_recommendations, :rank
|
16
|
-
add_column :personal_recommendations, :created_at, :datetime
|
17
|
-
add_column :personal_recommendations, :visited_at, :datetime
|
18
|
-
add_index :personal_recommendations, :personal_recommendable_id
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.down
|
22
|
-
remove_index :personal_recommendations, :personal_recommendable_id
|
23
|
-
remove_column :personal_recommendations, :visited_at
|
24
|
-
remove_column :personal_recommendations, :created_at
|
25
|
-
add_column :personal_recommendations, :rank, :integer
|
26
|
-
|
27
|
-
remove_index :attentions, :entry_id
|
28
|
-
remove_index :attentions, :attention_type_id
|
29
|
-
remove_column :attentions, :created_at
|
30
|
-
change_column :attentions, :weight, :float
|
31
|
-
change_column :attentions, :attention_type_id, :string
|
32
|
-
rename_column :attentions, :attention_type_id, :action_type
|
33
|
-
|
34
|
-
rename_column :attention_types, :default_weight, :weight
|
35
|
-
rename_column :attention_types, :name, :action_type
|
36
|
-
rename_table :attention_types, :action_types
|
37
|
-
end
|
38
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
class AddDefaultFeedTypeToAggregationFeed < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
change_column :aggregation_feeds, :feed_type, :string, :default => 'Feed'
|
4
|
-
end
|
5
|
-
|
6
|
-
def self.down
|
7
|
-
change_column :aggregation_feeds, :feed_type, :string, :default => nil
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class AddLocationToProfiles < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :profiles, :location, :string
|
4
|
-
add_column :profiles, :lat, :decimal, :precision => 15, :scale => 10
|
5
|
-
add_column :profiles, :lng, :decimal, :precision => 15, :scale => 10
|
6
|
-
add_index :profiles, [:lat, :lng]
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
remove_index :profiles, [:lat, :lng]
|
11
|
-
remove_column :profiles, :location
|
12
|
-
remove_column :profiles, :lat
|
13
|
-
remove_column :profiles, :lng
|
14
|
-
end
|
15
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class AddFieldsToProfiles < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :profiles, :about, :text
|
4
|
-
add_column :profiles, :first_name, :string
|
5
|
-
add_column :profiles, :last_name, :string
|
6
|
-
add_column :profiles, :city, :string
|
7
|
-
add_column :profiles, :state_id, :integer
|
8
|
-
add_column :profiles, :country_id, :integer
|
9
|
-
add_column :profiles, :language_id, :integer
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.down
|
13
|
-
remove_column :profiles, :about
|
14
|
-
remove_column :profiles, :first_name
|
15
|
-
remove_column :profiles, :last_name
|
16
|
-
remove_column :profiles, :city
|
17
|
-
remove_column :profiles, :state_id
|
18
|
-
remove_column :profiles, :country_id
|
19
|
-
remove_column :profiles, :language_id
|
20
|
-
end
|
21
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class CreateAccessCodes < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :access_codes do |t|
|
4
|
-
t.string :code
|
5
|
-
t.integer :uses, :default => 0, :null => false
|
6
|
-
t.boolean :unlimited, :default => false, :null => false
|
7
|
-
t.datetime :expires_at
|
8
|
-
t.integer :use_limit, :default => 1, :null => false
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
add_index :access_codes, :code
|
12
|
-
add_column :users, :access_code_id, :integer
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.down
|
16
|
-
drop_table :access_codes
|
17
|
-
remove_column :users, :access_code_id
|
18
|
-
end
|
19
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class CreateAccessCodeRequests < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :access_code_requests do |t|
|
4
|
-
t.string :email
|
5
|
-
t.datetime :code_sent_at
|
6
|
-
t.timestamps
|
7
|
-
end
|
8
|
-
add_index :access_code_requests, :email
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.down
|
12
|
-
drop_table :access_code_requests
|
13
|
-
end
|
14
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
class RemoveNameFields < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
remove_column :profiles, :first_name
|
4
|
-
remove_column :profiles, :last_name
|
5
|
-
add_column :profiles, :profile_views, :integer
|
6
|
-
add_column :profiles, :policy, :text
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.down
|
10
|
-
add_column :profiles, :first_name, :string
|
11
|
-
add_column :profiles, :last_name, :string
|
12
|
-
remove_column :profiles, :profile_views
|
13
|
-
remove_column :profiles, :policy
|
14
|
-
end
|
15
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class AddDeadEntryFields < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
add_column :entries, :permalink_good, :boolean, :default => true
|
4
|
-
add_column :entries, :permalink_checked_at, :datetime, :default => '1971-01-01 01:01:01', :null => false
|
5
|
-
add_index :entries, :permalink_good
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.down
|
9
|
-
remove_index :entries, :permalink_good
|
10
|
-
remove_column :entries, :permalink_good
|
11
|
-
remove_column :entries, :permalink_checked_at
|
12
|
-
end
|
13
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
PASSWORD = "asdfasdf"
|
2
|
-
|
3
|
-
def log_in_user(user, password)
|
4
|
-
visit(login_url)
|
5
|
-
fill_in("user_session_login", :with => user.login)
|
6
|
-
fill_in("user_session_password", :with => PASSWORD)
|
7
|
-
click_button("Sign In")
|
8
|
-
end
|
9
|
-
|
10
|
-
def log_in_with_login_and_role(login, role)
|
11
|
-
@user = Factory(:user, :login => login, :password => PASSWORD, :password_confirmation => PASSWORD)
|
12
|
-
@user.add_to_role(role)
|
13
|
-
log_in_user(@user, PASSWORD)
|
14
|
-
end
|
15
|
-
|
16
|
-
def log_in_with_role(role)
|
17
|
-
@user = Factory(:user, :password => PASSWORD, :password_confirmation => PASSWORD)
|
18
|
-
@user.add_to_role(role)
|
19
|
-
log_in_user(@user, PASSWORD)
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
Before do
|
24
|
-
ActionMailer::Base.deliveries = []
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
# Assumes password is 'asdfasdf'
|
29
|
-
Given /I log in as "(.*)"/ do |login|
|
30
|
-
@user = User.find_by_login(login)
|
31
|
-
log_in_user(@user, PASSWORD)
|
32
|
-
end
|
33
|
-
|
34
|
-
Given /I log in as new user "(.*)" with password "(.*)"/ do |login, password|
|
35
|
-
@user = Factory(:user, :login => login, :password => password, :password_confirmation => password)
|
36
|
-
log_in_user(@user, password)
|
37
|
-
end
|
38
|
-
|
39
|
-
Given /I log in as new user/ do
|
40
|
-
@user = Factory(:user, :password => PASSWORD, :password_confirmation => PASSWORD)
|
41
|
-
log_in_user(@user, PASSWORD)
|
42
|
-
end
|
43
|
-
|
44
|
-
Given /^I log in with role "(.*)"$/ do |role|
|
45
|
-
log_in_with_role(role)
|
46
|
-
end
|
47
|
-
|
48
|
-
Given /^I am not logged in$/ do
|
49
|
-
post '/logout'
|
50
|
-
end
|
51
|
-
|
52
|
-
Then /^I should see the login$/ do
|
53
|
-
response.body.should =~ /sign_in/m
|
54
|
-
response.body.should =~ /user_session_login/m
|
55
|
-
response.body.should =~ /user_session_password/m
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
#features/step_definitions/common_steps.rb
|
60
|
-
# On page/record
|
61
|
-
Given /^I am on "([^"]*)"$/ do |path|
|
62
|
-
visit path
|
63
|
-
end
|
64
|
-
|
65
|
-
Then /^I should be on "([^"]*)"$/ do |path|
|
66
|
-
current_path.should == path
|
67
|
-
end
|
68
|
-
|
69
|
-
Given /^I am on "([^"]*)" "([^"]*)"$/ do |model,number|
|
70
|
-
visit polymorphic_path(record_from_strings(model,number))
|
71
|
-
end
|
72
|
-
|
73
|
-
Then /^I should be on "([^"]*)" "([^"]*)"$/ do |model,number|
|
74
|
-
current_path.should == polymorphic_path(record_from_strings(model,number))
|
75
|
-
end
|
76
|
-
|
77
|
-
# Existing
|
78
|
-
Given /^a "([^"]*)" exists for "([^"]*)" "([^"]*)"$/ do |associated,model,number|
|
79
|
-
record = record_from_strings(model,number)
|
80
|
-
record.send(associated.underscore+'=',valid(associated))
|
81
|
-
record.save!
|
82
|
-
end
|
83
|
-
|
84
|
-
# Support
|
85
|
-
def current_path
|
86
|
-
response.request.request_uri
|
87
|
-
end
|
88
|
-
|
89
|
-
def record_from_strings(model,number)
|
90
|
-
model.constantize.find(:first,:offset=>number.to_i-1)
|
91
|
-
end
|
92
|
-
|
93
|
-
|
@@ -1,219 +0,0 @@
|
|
1
|
-
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
2
|
-
# It is recommended to regenerate this file in the future when you upgrade to a
|
3
|
-
# newer version of cucumber-rails. Consider adding your own code to a new file
|
4
|
-
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
5
|
-
# files.
|
6
|
-
|
7
|
-
|
8
|
-
require 'uri'
|
9
|
-
require 'cgi'
|
10
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
11
|
-
|
12
|
-
module WithinHelpers
|
13
|
-
def with_scope(locator)
|
14
|
-
locator ? within(locator) { yield } : yield
|
15
|
-
end
|
16
|
-
end
|
17
|
-
World(WithinHelpers)
|
18
|
-
|
19
|
-
Given /^(?:|I )am on (.+)$/ do |page_name|
|
20
|
-
visit path_to(page_name)
|
21
|
-
end
|
22
|
-
|
23
|
-
When /^(?:|I )go to (.+)$/ do |page_name|
|
24
|
-
visit path_to(page_name)
|
25
|
-
end
|
26
|
-
|
27
|
-
When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
|
28
|
-
with_scope(selector) do
|
29
|
-
click_button(button)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
|
34
|
-
with_scope(selector) do
|
35
|
-
click_link(link)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
|
40
|
-
with_scope(selector) do
|
41
|
-
fill_in(field, :with => value)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
46
|
-
with_scope(selector) do
|
47
|
-
fill_in(field, :with => value)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Use this to fill in an entire form with data from a table. Example:
|
52
|
-
#
|
53
|
-
# When I fill in the following:
|
54
|
-
# | Account Number | 5002 |
|
55
|
-
# | Expiry date | 2009-11-01 |
|
56
|
-
# | Note | Nice guy |
|
57
|
-
# | Wants Email? | |
|
58
|
-
#
|
59
|
-
# TODO: Add support for checkbox, select og option
|
60
|
-
# based on naming conventions.
|
61
|
-
#
|
62
|
-
When /^(?:|I )fill in the following(?: within "([^"]*)")?:$/ do |selector, fields|
|
63
|
-
with_scope(selector) do
|
64
|
-
fields.rows_hash.each do |name, value|
|
65
|
-
When %{I fill in "#{name}" with "#{value}"}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
When /^(?:|I )select "([^"]*)" from "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector|
|
71
|
-
with_scope(selector) do
|
72
|
-
select(value, :from => field)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
When /^(?:|I )check "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
77
|
-
with_scope(selector) do
|
78
|
-
check(field)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
When /^(?:|I )uncheck "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
83
|
-
with_scope(selector) do
|
84
|
-
uncheck(field)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
|
89
|
-
with_scope(selector) do
|
90
|
-
choose(field)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
|
95
|
-
with_scope(selector) do
|
96
|
-
attach_file(field, path)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
Then /^(?:|I )should see JSON:$/ do |expected_json|
|
101
|
-
require 'json'
|
102
|
-
expected = JSON.pretty_generate(JSON.parse(expected_json))
|
103
|
-
actual = JSON.pretty_generate(JSON.parse(response.body))
|
104
|
-
expected.should == actual
|
105
|
-
end
|
106
|
-
|
107
|
-
Then /^(?:|I )should see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
108
|
-
with_scope(selector) do
|
109
|
-
if page.respond_to? :should
|
110
|
-
page.should have_content(text)
|
111
|
-
else
|
112
|
-
assert page.has_content?(text)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
Then /^(?:|I )should see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
118
|
-
regexp = Regexp.new(regexp)
|
119
|
-
with_scope(selector) do
|
120
|
-
if page.respond_to? :should
|
121
|
-
page.should have_xpath('//*', :text => regexp)
|
122
|
-
else
|
123
|
-
assert page.has_xpath?('//*', :text => regexp)
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
Then /^(?:|I )should not see "([^"]*)"(?: within "([^"]*)")?$/ do |text, selector|
|
129
|
-
with_scope(selector) do
|
130
|
-
if page.respond_to? :should
|
131
|
-
page.should have_no_content(text)
|
132
|
-
else
|
133
|
-
assert page.has_no_content?(text)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
Then /^(?:|I )should not see \/([^\/]*)\/(?: within "([^"]*)")?$/ do |regexp, selector|
|
139
|
-
regexp = Regexp.new(regexp)
|
140
|
-
with_scope(selector) do
|
141
|
-
if page.respond_to? :should
|
142
|
-
page.should have_no_xpath('//*', :text => regexp)
|
143
|
-
else
|
144
|
-
assert page.has_no_xpath?('//*', :text => regexp)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should contain "([^"]*)"$/ do |field, selector, value|
|
150
|
-
with_scope(selector) do
|
151
|
-
field = find_field(field)
|
152
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
153
|
-
if field_value.respond_to? :should
|
154
|
-
field_value.should =~ /#{value}/
|
155
|
-
else
|
156
|
-
assert_match(/#{value}/, field_value)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
Then /^the "([^"]*)" field(?: within "([^"]*)")? should not contain "([^"]*)"$/ do |field, selector, value|
|
162
|
-
with_scope(selector) do
|
163
|
-
field = find_field(field)
|
164
|
-
field_value = (field.tag_name == 'textarea') ? field.text : field.value
|
165
|
-
if field_value.respond_to? :should_not
|
166
|
-
field_value.should_not =~ /#{value}/
|
167
|
-
else
|
168
|
-
assert_no_match(/#{value}/, field_value)
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
|
174
|
-
with_scope(selector) do
|
175
|
-
field_checked = find_field(label)['checked']
|
176
|
-
if field_checked.respond_to? :should
|
177
|
-
field_checked.should be_true
|
178
|
-
else
|
179
|
-
assert field_checked
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
|
185
|
-
with_scope(selector) do
|
186
|
-
field_checked = find_field(label)['checked']
|
187
|
-
if field_checked.respond_to? :should
|
188
|
-
field_checked.should be_false
|
189
|
-
else
|
190
|
-
assert !field_checked
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
Then /^(?:|I )should be on (.+)$/ do |page_name|
|
196
|
-
current_path = URI.parse(current_url).path
|
197
|
-
if current_path.respond_to? :should
|
198
|
-
current_path.should == path_to(page_name)
|
199
|
-
else
|
200
|
-
assert_equal path_to(page_name), current_path
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|
|
205
|
-
query = URI.parse(current_url).query
|
206
|
-
actual_params = query ? CGI.parse(query) : {}
|
207
|
-
expected_params = {}
|
208
|
-
expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')}
|
209
|
-
|
210
|
-
if actual_params.respond_to? :should
|
211
|
-
actual_params.should == expected_params
|
212
|
-
else
|
213
|
-
assert_equal expected_params, actual_params
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
Then /^show me the page$/ do
|
218
|
-
save_and_open_page
|
219
|
-
end
|