From 20964eb2680e4327409fd5e35dabc8a733716640 Mon Sep 17 00:00:00 2001 From: Jason Denney Date: Mon, 10 Feb 2014 00:09:11 -0500 Subject: [PATCH] Update feature for new bike view to pass --- spec/features/bikes/new_spec.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/spec/features/bikes/new_spec.rb b/spec/features/bikes/new_spec.rb index 555ca8b..639b0e4 100644 --- a/spec/features/bikes/new_spec.rb +++ b/spec/features/bikes/new_spec.rb @@ -2,6 +2,10 @@ require "spec_helper" feature "Bikes" do before(:each) do + # create brand and wheel size + @bike_brand = BikeBrand.create( brand: "Huffy") + @bike_wheel_size = BikeWheelSize.create( description: "MyWheelSize") + @user = FactoryGirl.create(:bike_admin) visit new_user_session_path fill_in "user_username", with: @user.username @@ -9,14 +13,18 @@ feature "Bikes" do click_button "Sign in" end - scenario "User creates a new bike" do + scenario "User creates a new bike", js: true do visit new_bike_path fill_in "shop_id", with: 1 - fill_in "model", with: "Huffy" + fill_in "model", with: "Huffle Puffle" fill_in "serial_number", with: "XKCD" + find('label.btn.btn-default', text: 'RD').click + find('label.btn.btn-default', text: 'Poor').click fill_in "seat_tube_height", with: 52 + select @bike_brand.brand, from: "bike_brand_id" + select @bike_wheel_size.description, from: "bike_wheel_size_id" click_button "Add Bike" - expect(page).to have_text("Huffy") + expect(page).to have_text(@bike_brand.brand) end scenario "User submits a bike with errors", js: true do