Sha256: 4e6d8aa7738c33e16a41a3861d541845f7712fdebc27c8554ce36a633b59f7ab
Contents?: true
Size: 1.06 KB
Versions: 13
Compression:
Stored size: 1.06 KB
Contents
module CandidatureFactoryMethods def set_candidature_defaults(attributes) attributes[:user_id] ||= @me.id unless attributes[:user] || attributes[:user_id] || !@me attributes[:vacancy_id] ||= Vacancy.last.id unless attributes[:vacancy_id] || Vacancy.all.none? attributes[:offeror_id] ||= Vacancy.find(attributes[:vacancy_id]).project.user_id if attributes[:vacancy_id] end def new_candidature(name, state = nil) attributes = { name: name } attributes[:state] = state if state set_candidature_defaults(attributes) @candidature = Factory(:candidature, attributes) @candidature.reload end end World(CandidatureFactoryMethods) Given /^a candidature named "([^\"]*)"$/ do |name| new_candidature(name) end Given /^a candidature named "([^\"]*)" with state "([^\"]*)"$/ do |name,state| new_candidature(name, state) end Then /^I should see the following candidatures:$/ do |expected_table| rows = find('table').all('tr') table = rows.map { |r| r.all('th,td').map { |c| c.text.strip } } expected_table.diff!(table) end
Version data entries
13 entries across 13 versions & 1 rubygems