Sha256: 865177e3b6a3d7ea3cc80384659b4ff6d18f6673c02f4b07556672eb35b6ab26
Contents?: true
Size: 1.39 KB
Versions: 22
Compression:
Stored size: 1.39 KB
Contents
require 'test_helper' def test_regex(str) /Account balance/.match(str) end test_regex("<dt>Account balance:</dt>") class Kaui::AccountsControllerTest < ActionController::TestCase fixtures :accounts test "should get index" do get :index assert_response :success end test "should find account by id" do pierre = accounts(:pierre) get :show, :id => pierre["accountId"] assert_response :success assert_equal assigns(:account).account_id, pierre["accountId"] end test "should find correct positive balance" do accnt = accounts(:account_with_positive_balance) get :show, :id => accnt["accountId"] assert_response :success assert assigns(:account).balance > 0 #puts @response.body assert_select "dd" do |elements| elements.each do |element| if /span/.match(element.to_s) assert_select "span" do |inner| assert /"label label-important"/.match(inner[0].to_s) end end end end end test "should find correct negative balance" do accnt = accounts(:account_with_negative_balance) get :show, :id => accnt["accountId"] assert_response :success assert assigns(:account).balance < 0 end test "should find correct zero balance" do accnt = accounts(:account_with_zero_balance) get :show, :id => accnt["accountId"] assert_response :success assert assigns(:account).balance == 0 end end
Version data entries
22 entries across 22 versions & 1 rubygems