Browse Source

Update feature for new bike view to pass

denney-fix-saving-dates
Jason Denney 11 years ago
parent
commit
20964eb268
  1. 14
      spec/features/bikes/new_spec.rb

14
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

Loading…
Cancel
Save