Skip to content

Commit

Permalink
interim progress
Browse files Browse the repository at this point in the history
  • Loading branch information
patmbolger committed Jun 24, 2017
1 parent 2c3c0ed commit 75f5e10
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 41 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ end

group :test do
gem 'poltergeist'
gem 'selenium-webdriver'
end
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ GEM
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.7.0)
ffi (~> 1.0, >= 1.0.11)
chronic (0.10.2)
city-state (0.0.13)
rubyzip (~> 1.1)
Expand Down Expand Up @@ -364,6 +366,9 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.4.3)
childprocess (~> 0.5)
rubyzip (~> 1.0)
sexp_processor (4.8.0)
shoulda-matchers (3.1.1)
activesupport (>= 4.0.0)
Expand Down Expand Up @@ -485,6 +490,7 @@ DEPENDENCIES
rubyzip (>= 1.2.1)
sanitize
sass-rails (~> 5.0)
selenium-webdriver
shoulda-matchers
smarter_csv
spring
Expand Down
14 changes: 8 additions & 6 deletions app/views/membership_applications/_reason_waiting.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
.container
.reason-waiting-information
= f.label( :member_app_waiting_reasons, t('membership_applications.need_info.reason_title'))
- collection = AdminOnly::MemberAppWaitingReason.all.to_a
- collection << AdminOnly::MemberAppWaitingReason.new(id: -1, "name_#{I18n.locale.to_s}": "#{@other_waiting_reason_text}")
= f.collection_select(:member_app_waiting_reasons_id,
AdminOnly::MemberAppWaitingReason.all,
collection,
:id,
reason_name_method,
{ include_blank: t('membership_applications.need_info.select_a_reason') },
{ class: 'reason-waiting-list',
onchange: 'changed_reason()' },
{ class: 'reason-waiting-list' },
)

.row
.container
#other-text-field
= f.label( :reason_waiting_custom_text, t('membership_applications.need_info.other_reason_label') )
= f.text_field :custom_reason_text, onchange: 'changed_custom_text()'
= f.text_field :custom_reason_text


:javascript
Expand Down Expand Up @@ -96,9 +97,10 @@


let initialize = (function() {
reasons_list.options.add(other_reason_option); // add the other_reason to the list
// reasons_list.options.add(other_reason_option); // add the other_reason to the list
hideOrShowCustomReasonElements();
$('#membership_application_member_app_waiting_reasons_id').on('change', changed_reason);
$('#membership_application_custom_reason_text').on('change', changed_custom_text)
});

$(document).ready(initialize);

60 changes: 30 additions & 30 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,38 @@
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "addresses", force: :cascade do |t|
t.string "street_address"
t.string "post_code"
t.string "city"
t.string "country", default: "Sverige", null: false
t.integer "region_id"
t.string "addressable_type"
t.integer "addressable_id"
t.integer "kommun_id"
t.float "latitude"
t.float "longitude"
create_table "addresses", id: :bigserial, force: :cascade do |t|
t.string "street_address"
t.string "post_code"
t.string "city"
t.string "country", default: "Sverige", null: false
t.bigint "region_id"
t.string "addressable_type"
t.bigint "addressable_id"
t.bigint "kommun_id"
t.float "latitude"
t.float "longitude"
t.index ["addressable_type", "addressable_id"], name: "index_addresses_on_addressable_type_and_addressable_id", using: :btree
t.index ["kommun_id"], name: "index_addresses_on_kommun_id", using: :btree
t.index ["latitude", "longitude"], name: "index_addresses_on_latitude_and_longitude", using: :btree
t.index ["region_id"], name: "index_addresses_on_region_id", using: :btree
end

create_table "business_categories", force: :cascade do |t|
create_table "business_categories", id: :bigserial, force: :cascade do |t|
t.string "name"
t.string "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "business_categories_membership_applications", force: :cascade do |t|
t.integer "membership_application_id"
t.integer "business_category_id"
create_table "business_categories_membership_applications", id: :bigserial, force: :cascade do |t|
t.bigint "membership_application_id"
t.bigint "business_category_id"
t.index ["business_category_id"], name: "index_on_categories", using: :btree
t.index ["membership_application_id"], name: "index_on_applications", using: :btree
end

create_table "ckeditor_assets", force: :cascade do |t|
create_table "ckeditor_assets", id: :bigserial, force: :cascade do |t|
t.string "data_file_name", null: false
t.string "data_content_type"
t.integer "data_file_size"
Expand All @@ -56,12 +56,12 @@
t.integer "height"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "company_id"
t.bigint "company_id"
t.index ["company_id"], name: "index_ckeditor_assets_on_company_id", using: :btree
t.index ["type"], name: "index_ckeditor_assets_on_type", using: :btree
end

create_table "companies", force: :cascade do |t|
create_table "companies", id: :bigserial, force: :cascade do |t|
t.string "name"
t.string "company_number"
t.string "phone_number"
Expand All @@ -74,13 +74,13 @@
t.index ["company_number"], name: "index_companies_on_company_number", unique: true, using: :btree
end

create_table "kommuns", force: :cascade do |t|
create_table "kommuns", id: :bigserial, force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "member_app_waiting_reasons", force: :cascade, comment: "reasons why SHF is waiting for more info from applicant. Add more columns when more locales needed." do |t|
create_table "member_app_waiting_reasons", id: :bigserial, force: :cascade, comment: "reasons why SHF is waiting for more info from applicant. Add more columns when more locales needed." do |t|
t.string "name_sv", comment: "name of the reason in svenska/Swedish"
t.string "description_sv", comment: "description for the reason in svenska/Swedish"
t.string "name_en", comment: "name of the reason in engelsk/English"
Expand All @@ -90,23 +90,23 @@
t.datetime "updated_at", null: false
end

create_table "member_pages", force: :cascade do |t|
create_table "member_pages", id: :bigserial, force: :cascade do |t|
t.string "filename", null: false
t.string "title"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "membership_applications", force: :cascade do |t|
create_table "membership_applications", id: :bigserial, force: :cascade do |t|
t.string "company_number"
t.string "phone_number"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.bigint "user_id"
t.string "first_name"
t.string "last_name"
t.string "contact_email"
t.integer "company_id"
t.bigint "company_id"
t.string "membership_number"
t.string "state", default: "new"
t.integer "member_app_waiting_reasons_id"
Expand All @@ -116,15 +116,15 @@
t.index ["user_id"], name: "index_membership_applications_on_user_id", using: :btree
end

create_table "regions", force: :cascade do |t|
create_table "regions", id: :bigserial, force: :cascade do |t|
t.string "name"
t.string "code"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "shf_documents", force: :cascade do |t|
t.integer "uploader_id", null: false
create_table "shf_documents", id: :bigserial, force: :cascade do |t|
t.bigint "uploader_id", null: false
t.string "title"
t.text "description"
t.datetime "created_at", null: false
Expand All @@ -136,18 +136,18 @@
t.index ["uploader_id"], name: "index_shf_documents_on_uploader_id", using: :btree
end

create_table "uploaded_files", force: :cascade do |t|
create_table "uploaded_files", id: :bigserial, force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "actual_file_file_name"
t.string "actual_file_content_type"
t.integer "actual_file_file_size"
t.datetime "actual_file_updated_at"
t.integer "membership_application_id"
t.bigint "membership_application_id"
t.index ["membership_application_id"], name: "index_uploaded_files_on_membership_application_id", using: :btree
end

create_table "users", force: :cascade do |t|
create_table "users", id: :bigserial, force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: "Other/Custom" waiting reason comes from locale file and Admin cannot e
Background:

# it is important that this statement is first so that tables are empty, so that things will be seeded
Given the system is seeded with initial data
# Given the system is seeded with initial data


Given the following users exists
Expand Down Expand Up @@ -55,7 +55,7 @@ Feature: "Other/Custom" waiting reason comes from locale file and Admin cannot e
And I am logged in as "[email protected]"


@admin
@admin @javascript
Scenario: The "other/custom" reason is listed as a reason for the 'waiting for...' status
Given I am on "AnnaWaiting" application page
Then "membership_application_member_app_waiting_reasons_id" should have t("admin_only.member_app_waiting_reasons.other_custom_reason") as an option
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Feature: Admin sets or enters the reason they are waiting for info from a user

And the following member app waiting reasons exist
| name_sv | description_sv | name_en | description_en | is_custom |
| Annat (skriv in orsaken) | Annat | Other (enter the reason) | other | false |
| need doc | need doc | need documentation | need more documents proving qualifications | false |
| waiting for payment | still waiting for payment | waiting for payment | still waiting for payment | false |

Expand All @@ -47,8 +46,10 @@ Feature: Admin sets or enters the reason they are waiting for info from a user
Scenario: Admin selects 'need more documentation' as the reason SHF is waiting_for_applicant
Given I am on "AnnaWaiting" application page
When I set "membership_application_member_app_waiting_reasons_id" to "need doc"
And show me the page
And I am on the list applications page
And I am on "AnnaWaiting" application page
And show me the page
Then "membership_application_member_app_waiting_reasons_id" should have "need doc" selected
And I should not see t("admin_only.member_app_waiting_reasons.other_custom_reason")

Expand Down Expand Up @@ -104,4 +105,3 @@ Feature: Admin sets or enters the reason they are waiting for info from a user
Given I am logged in as "[email protected]"
And I am on the application page for "AnnaWaiting"
Then I should not see t("membership_applications.need_info.reason_title")

7 changes: 6 additions & 1 deletion features/support/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
Capybara.current_driver = :poltergeist
end

After('@javascript, @poltergeist') do
Before('@selenium') do
# For JS-driven tests that Poltergeist does not handle cleanly.
Capybara.javascript_driver = :selenium
end

After('@javascript, @poltergeist, @selenium') do
Capybara.reset_sessions!
Capybara.current_driver = :rack_test
end

0 comments on commit 75f5e10

Please sign in to comment.