Weird Translation Bug

So we encountered this error

can not load translations from /vagrant/config/locales/en.yml: #<Psych::SyntaxError: (/vagrant/config/locales/en.yml): could not find expected ':' while scanning a simple key at line 370 column 7&gt

We thought it was tough Funny enough the error was caused by a space .Only a space 🙂

Ooh Ruby you never fail to surprise

Thanks StackoverFlow

By simply inserting a space between the colon separating password and anythingapple, like this: password: anythingapple the Rake db:create ran fine. One neglected space makes the diff. Hope this helps 

Here is the answer

http://stackoverflow.com/questions/10512615/rails-rake-dbschemadump-error

Happy coding 😀

Dealing with Installation errors

Invalid credentials. Please try again!

This error occurs when after successfully setting up RapidFTR when you try to log in you are met with the following error .

site location – http://localhost:3000/sessions/new

Screenshot

Capture2

Couch Db – http://localhost:5984/_utils/database.html?rapidftr_development

Screenshot

screenshot1

Solution

Run the following commands

Start CouchDB:

On the command line, execute the command couchdb. This should start couchdb.

If you have not yet created admin username/password for CouchDB:

  • Either run: bundle exec rake db:create_couch_sysadmin[<desired-username>,<desired-password>]

(OR)

  • Go to: localhost:5984/_utils (assuming that’s where your CouchDB is running)
    • On the right bottom you should see “Welcome to Admin Party! Every one is admin. Fix this!”. Click on “Fix this!” to create your first admin user.
    • And choose what username and password you want to use.
    • If you instead see the “Sign-In” link at the bottom right, that means the username and password is already configured for your couchDB. Find out what it is!

Once you have a username/password for CouchDB:

Run:

bundle exec rake db:create_couchdb_yml[<username>,<password>]

That will create the CouchDB configuration file at config/couchdb.yml. You can check if the username and password is stored in this file (by opening this file in a text editor).

Seeding the Database

  • Run: bundle exec rake app:reset This will add all the seed data (users and form sections)

Running the server:

  • Like any Rails project, run: bundle exec rails server
  • To start Solr (required for searching), run: bundle exec rake search:clean_start
  • To start the background scheduler, run: bundle exec rake scheduler:restart

Working with Cucumber Tests

 

Cucumber Tests

Cucumber is a software tool that computer programmers use for testing other software. It runs automated acceptance tests written in a behavior-driven development (BDD) style.
from Wikipedia

To begin working with Cucumber we started of looking at examples online and found a someone had asked a similar question on Stackoverflow :-).

This is one of the samples


@javascript
Feature: invitation acceptance
Scenario: accept invitation from admin
Given I have been invited by an admin
And I am on my acceptance form page
And I fill in the new user form
And I press "Sign up"
Then I should be on the getting started page
And I should see "Well, hello there!"
And I fill in the following:
| profile_first_name | O |

This example was obtained from Github https://github.com/diaspora/diaspora/tree/master/features/mobile, we were able to learn how  to write cucumber test by exploring this tests.

Working with cucumber tests in RapidFTR

  • To be able to begin testing in RapidFTR follow the link below  Running Tests in RapidFTR
  • Cucumber – Use these for testing User Flows – end to end scenarios that touch upon multiple functionality. Don’t use these for trivial tests, try using the Unit tests instead.
  • Cucumber Headless – These are tests that don’t involve any Javascript, so they can be run with simple HTTP GET/POST (curl-style) requests, and can be verified by inspecting the response.
  • Cucumber Browser – These tests run Javascript (such as dropdowns, dialogs, etc), and thus need a running browser environment, in our case Firefox.
  • API Tests – These test the public JSON API
  • Related gems: Cucumber, Capybara, json_spec
  • Related folders: features/ This folder is where the cucumber tests are located and created and where we are required to add the cucumber tests.

To run all the cucumber tests in Rapid FTR

# Run all cucumber tests
bundle exec rake cucumber:all

# Run headless tests
bundle exec rake cucumber:headless

# Run browser tests
bundle exec rake cucumber:browser

To be able to run a test for a specific feature in RapidFTR

The correct way is to run it using the cucumber executable if you’re using Rails 2, or bundle exec cucumber if you’re using Rails 3 (and thus Bundler).

To run a specific feature:

[command] features/signing_in.feature

To run a specific scenario from that feature:

[command] features/signing_in.feature:6

The line number can be any line inside that feature, but is usually the first line.

If you run rake cucumber:ok and some scenarios fail, at the bottom of the output you will see something like this:

cucumber features/sigining_in.feature:6 # Signing in via form

You can triple-click this line and paste it into your terminal to just run that scenario.

At the moment we are now working on the code for the cucumber test to be do our first cucumber test hurray!!!

Setup Rapid FTR on any Machine

This took us a while , things were not working , this blog will help you setup quick on your machine and start working on RapidFTR.

NB :Lesson learnt -Never ever give up 

 

  1. Part one.

Download Virtual Box by following this link  https://www.virtualbox.org/wiki/Downloads and set it up, this was pretty sraightforward

Download Vagrant https://www.vagrantup.com/downloads.html, vagrant is used to Create and configure lightweight, reproducible, and portable development environments.For more information follow this link- Documentations

For RapidFTR we are using the ubuntu/trusty32 , no need to worry,this will automatically be donwloaded for you.

This can enable you to be able to run and deploy a virtual development environment , Mercy uses Linux Kali so she was set and Nelly uses windows 10 ,therefore this enables Nelly to run the environment without any worry, since there was no need to install the ubuntu when you can have it with you ready via Vagrant

    • Setup Git 

Download Git https://git-scm.com/downloads  if you don’t have it already , it will help you setup the environment and work on the repo from Github

Part Two.

After confirming that everything has been setup correctly .

Carry out the following steps

Go to the https://github.com/rapidftr/RapidFTR repo site and fork the project to your own repo as shown

git

After the above open git Bash on your machine and got to the the directory your wish to save your project in and perform the following commands

# Download source code:
# replace this with your forked site.
git clone git://github.com/rapidftr/RapidFTR.git
cd RapidFTR
git submodule update --init

After performing the above commands successful

you now have the completer repo with you.

Part Three.

To setup vagrant on your machine carry out the following tasks

# Start the VM
vagrant plugin install vagrant-omnibus
vagrant plugin install vagrant-faster
vagrant up
  • The box file is large. It should only have to download once.
  • The first time vagrant up will run, the Chef recipes will be executed to provision the VM. This involves downloading and installing CouchDB, Ruby, Java, etc, so it will take some time. But the good thing is, once they are downloaded, they are all cached in shared folders so you’ll have much less storage space taken up.

Part Four

One the Virtual machine is up run the following commands

  • vagrant ssh
    cd /vagrant
    rake sunspot:solr:start
    rails server

This should allow you to run the RAPIFTR

Rapid FTR

RapidFTR is a versatile open-source mobile phone application and data storage system that seeks to expedite this process by helping humanitarian workers collect, sort and share information about unaccompanied and separated children in emergency situations so they can be registered for care services and reunited with their families. RapidFTR is specifically designed to streamline and speed up Family Tracing and Reunification (FTR) efforts both in the immediate aftermath of a crisis and during ongoing recovery efforts.

RapidFTR is an open source, volunteer-driven project, under active development by the Child Protection in Emergencies Team at UNICEF, and has received funding from the Humanitarian Innovation Fund and UNICEF Supply Division.

More information can be obtained from there site http://www.rapidftr.com/