My haml :
- for status in current_account.job_statuses.active
= link_to status.name, '#', :class => params[:job_status_id].to_i == status.id ? "current status block" : "status block", :rel => status.id
My html :
<a rel="1" class="status block" href="#">in progress</a>
<a rel="2" class="status block" href="#">in progress</a>
<a rel="3" class="status block" href="#">in progress</a>
<a rel="4" class="status block" href="#">in progress</a>
My Test :
test 'index - job_status: set' do
job_status = @account.job_statuses.create! :name => 'foo'
job_status.reload
@job.update_attribute :job_status_id, job_status.id
@job.reload
get :index, :job_status_id => job_status.id.to_s
assert_response :success
assert_template 'jobs/index'
jobs = assigns(:jobs)
assert jobs.include?(@job)
assert_select 'div.status[rel=?]', job_status.id
end
But I get this failure :
3) Failure:
test_index_-_job_status:_set(NewJobsControllerTest)
[test/functional/new_jobs_controller_test.rb:127:in `block in <class:NewJobsControllerTest>'
test/test_helper.rb:221:in `run'
test/test_helper.rb:221:in `run']:
Expected at least 1 element matching "div.status[rel='16']", found 0.
<false> is not true.
Is this for an obvious dumb reason? I apologize if it is.. I can’t figure it out.
Oh. It’s always the little things we never think to check… After staring uselessly at that HAML I asked for for five minutes it hit me:
Those ain’t
DIVs. Those areAs.Cheers!