Spec fixes

This commit is contained in:
2014-12-01 17:54:55 +01:00
parent 9ef3d4b725
commit 60e6b2a648
21 changed files with 74 additions and 86 deletions
+21 -17
View File
@@ -1,17 +1,24 @@
step "the supplier visits the new table page" do
visit new_suppliers_table_path
step "the supplier visits the tables page" do
visit "/supplier#/tables"
end
step "the supplier clicks on the new table button" do
find('.new-table-button').click
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'
within '.modal' do
find('.number input').set '7'
find('.section select').find(%|option[value="#{@sections.first.id}"]|).select_option
end
end
step "the supplier submits the table form" do
#find('.save-table-button').click
find('.form-action-submit').click
within '.modal' do
find('.modal-confirm').click
end
end
step "the new supplier table with proper properties should have been created" do
@@ -19,23 +26,20 @@ step "the new supplier table with proper properties should have been created" do
@table.section_id.should == @sections.first.id
end
step "the supplier should be on the table section page" do
step "the supplier clicks on the edit table button" 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)
find('.table-edit').click
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'
within '.modal' do
find('.number input').set number
find('.section select').find(%|option[value="#{@sections.last.id}"]|).select_option
end
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
expect( @table.number ).to eq number.to_i
expect( @table.section_id ).to eq @sections.last.id
end