Files
mozo-backend/spec/acceptance_steps/suppliers/table_steps.rb
T

41 lines
1.3 KiB
Ruby

step "the supplier visits the new table page" do
visit new_suppliers_table_path
end
step "the supplier fills in the new table form selecting the first section" do
find('#table_number').set '7'
section_option = find(%|option[value="#{@sections.first.id}"]|)
select section_option.text, from: 'table_section_id'
end
step "the supplier submits the table form" do
find('.save-table-button').click
end
step "the new supplier table with proper properties should have been created" do
@table = Table.find_by_number 7
@table.section_id.should == @sections.first.id
end
step "the supplier should be on the table section page" do
@table.reload
route_should_be 'suppliers/sections#show', id: @table.section_id
end
step "the supplier visits the edit table page" do
visit edit_suppliers_table_path(@table)
end
step "the supplier changes the table number to :number and section to the last section" do |number|
find('#table_number').set number
section_option = find(%|option[value="#{@sections.last.id}"]|)
select section_option.text, from: 'table_section_id'
end
step "the supplier table should have number :number and be linked to the last section" do |number|
@table.reload
@table.number.should == number.to_i
@table.section_id.should == @sections.last.id
end