Skip to main content

specs

Specs​

QA testing https://drive.google.com/drive/folders/0B_llOdNUg7wINEZKNFlyamJ5M3M

Specs:

1 to run => from your console run: rspec spec/helpers/file_name_spec.rb

if you want to run just one of the many tests in one file you should run

rspec --tag focus spec/requests/apps/ecommerce_spec.rb

do not forget to add focus command to specs name:

it 'Should return sth',focus:true do

end

2 to debug: add on top of your file:

require 'pry'

then just add this line to debug file: binding.pry

3 there is a helper that uses factory girl to fake records: request_helper.rb. Pls make sure to add

require 'spec_helper'

on top of your file

4 all the data could be checked at powr_test DB

run from your console:

psql

\c powr_test

regular commands:

\l - list of all created DB names

\d - list of all tables in DB

\d table_name - shows table's features

5 to run Selenium specs you need to install firefox 34.0.5.dmg

6 To travel in time you can use:

Timecop.travel(1.month.from_now) do

end

In Selenium test you may use

using_wait_time 30 do

end

7 To test a route for ajax call you may use:

put :update_charge_level, :id => @pro_subscription.id, :level => 'pro', :price => 1399

make sure to pass all the required parameters

To update/delete/edit use PUT

To send and get data use GET

8 The main idea of the test is that it returns right data, so pls make sure to use SHOULD command like:

for checking for record in DB:

enterprise_apps.count.should == 1

for checking web site element:

page.should have_css($conf[:settingsFrame], visible:true)

page.should have_selector('.publishSuccess')