Last active
November 7, 2015 11:04
-
-
Save trosborn/84e526f0504ad0dbde5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'helpers/test_helper' | |
feature 'admin can CRUD salads' do | |
before :each do | |
sign_in :admin | |
end | |
scenario 'admin wants to create a salad', js: true do | |
visit salads_path | |
click_on 'Add New Salad' | |
fill_in 'Name', with: 'Pagliaccio' | |
click_on 'Add Size' | |
find('.salad_sizes_name input').set('Small') | |
find('.salad_sizes_price input').set('5.49') | |
click_on 'Add Size' | |
within(all('.salad_sizes_name').last { find('input').set('Large') }) | |
within(all('.salad_sizes_price').last { find('input').set('8.49') }) | |
click_on 'Add Size' | |
within(all('.salad_sizes_name').last { find('input').set('Party') }) | |
within(all('.salad_sizes_price').last { find(' input').set('15.99') }) | |
check 'salami' | |
check 'garbanzo_beans' | |
check 'kasseri' | |
check 'red_onions' | |
check 'red_peppers' | |
check 'pagliaccio_dressing' | |
click_on 'Save' | |
page.must_have_content 'Pagliaccio' | |
page.must_have_content 'Small' | |
page.must_have_content '5.49' | |
page.must_have_content 'Large' | |
page.must_have_content '8.49' | |
page.must_have_content 'Party' | |
page.must_have_content '15.99' | |
page.must_have_content 'salami' | |
page.must_have_content 'garbanzo beans' | |
page.must_have_content 'kasseri' | |
page.must_have_content 'red onions' | |
page.must_have_content 'red peppers' | |
page.must_have_content 'pagliaccio dressing' | |
page.must_have_content 'Salad was successfully created.' | |
end | |
scenario 'admin wants to edit a salad', js: true do | |
test_salad = salads(:caesar) | |
visit salad_path test_salad | |
click_on edit | |
fill_in 'Name', match: :first, with: 'Brutus' | |
within(all('.salad_sizes_name')[0] { find('input').set('Parvus') }) | |
within(all('.salad_sizes_price')[0] { find('input').set('1.11') }) | |
within(all('.salad_sizes_name')[1] { find('input').set('Amplus') }) | |
within(all('.salad_sizes_price')[1] { find('input').set('2.22') }) | |
within(all('.salad_sizes_name')[2] { find('input').set('Festum') }) | |
within all('.salad_sizes_price')[2] do | |
find('input').set('33.33') | |
end | |
click_on 'Save' | |
page.must_have_content 'Brutus' | |
page.must_have_content 'Parvus' | |
page.must_have_content '1.11' | |
page.must_have_content 'Amplus' | |
page.must_have_content '2.22' | |
page.must_have_content 'Festum' | |
page.must_have_content '33.33' | |
page.must_have_content 'Salad was successfully updated.' | |
end | |
scenario 'admin wants to delete a salad' do | |
test_salad = salads(:caesar) | |
visit salad_path test_salad | |
click_on 'Delete' | |
page.wont_have_content 'Caesar Salad' | |
page.must_have_content 'Salad was successfully destroyed.' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SyntaxError: /Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:50: syntax error, unexpected { arg, expecting ')' | |
...n(all('.salad_sizes_name')[0] { find('input').set('Parvus') ... | |
... ^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:50: syntax error, unexpected '}', expecting keyword_end | |
...{ find('input').set('Parvus') }) | |
... ^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:51: syntax error, unexpected { arg, expecting ')' | |
within(all('.salad_sizes_price')[0] { find('input').set('1.11') }) | |
^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:51: syntax error, unexpected '}', expecting keyword_end | |
within(all('.salad_sizes_price')[0] { find('input').set('1.11') }) | |
^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:52: syntax error, unexpected { arg, expecting ')' | |
...n(all('.salad_sizes_name')[1] { find('input').set('Amplus') ... | |
... ^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:52: syntax error, unexpected '}', expecting keyword_end | |
...{ find('input').set('Amplus') }) | |
... ^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:53: syntax error, unexpected { arg, expecting ')' | |
within(all('.salad_sizes_price')[1] { find('input').set('2.22') }) | |
^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:53: syntax error, unexpected '}', expecting keyword_end | |
within(all('.salad_sizes_price')[1] { find('input').set('2.22') }) | |
^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:54: syntax error, unexpected { arg, expecting ')' | |
...n(all('.salad_sizes_name')[2] { find('input').set('Festum') ... | |
... ^ | |
/Users/Thomas/uwrailswinter/pagliacci/test/features/admin/can_crud_salad_test.rb:54: syntax error, unexpected '}', expecting keyword_end | |
...{ find('input').set('Festum') }) | |
... ^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment