Skip to content

Instantly share code, notes, and snippets.

@ogryzek
Last active August 29, 2015 13:56
Show Gist options
  • Save ogryzek/9086657 to your computer and use it in GitHub Desktop.
Save ogryzek/9086657 to your computer and use it in GitHub Desktop.
rspec Homepage Features, Controller, Model examples
require 'spec_helper'
describe HomepageController do
describe "#index" do
it "is successful" do
get :index
expect(response).to be_success
end
end
end
require 'spec_helper'
feature "Homepage" do
scenario "User sees product information" do
visit "/"
expect(page).to have_text("Our Products")
expect(page).to have_text("Bikes")
expect(page).to have_text("1,500.00")
end
scenario "User can view bikes" do
visit "/"
click_on "Bikes"
fill_in "max-price", with: 3000
click_on "View Bikes"
expect(page).to have_text("Results")
expect(current_path).to eq("/bikes-results")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment