Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

improve example feature

  • Loading branch information...
commit 07803a362ccec6b1bdff98896e759139ace86013 1 parent 16f92c9
@oriolgual oriolgual authored
View
5 app/controllers/products_controller.rb
@@ -0,0 +1,5 @@
+class ProductsController < ApplicationController
+
+ def index
+ end
+end
View
1  app/views/products/index.html.erb
@@ -0,0 +1 @@
+Products
View
57 config/routes.rb
@@ -1,58 +1,3 @@
SpinachRailsTest::Application.routes.draw do
- # The priority is based upon order of creation:
- # first created -> highest priority.
-
- # Sample of regular route:
- # match 'products/:id' => 'catalog#view'
- # Keep in mind you can assign values other than :controller and :action
-
- # Sample of named route:
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
- # This route can be invoked with purchase_url(:id => product.id)
-
- # Sample resource route (maps HTTP verbs to controller actions automatically):
- # resources :products
-
- # Sample resource route with options:
- # resources :products do
- # member do
- # get 'short'
- # post 'toggle'
- # end
- #
- # collection do
- # get 'sold'
- # end
- # end
-
- # Sample resource route with sub-resources:
- # resources :products do
- # resources :comments, :sales
- # resource :seller
- # end
-
- # Sample resource route with more complex sub-resources
- # resources :products do
- # resources :comments
- # resources :sales do
- # get 'recent', :on => :collection
- # end
- # end
-
- # Sample resource route within a namespace:
- # namespace :admin do
- # # Directs /admin/products/* to Admin::ProductsController
- # # (app/controllers/admin/products_controller.rb)
- # resources :products
- # end
-
- # You can have the root of your site routed with "root"
- # just remember to delete public/index.html.
- # root :to => 'welcome#index'
-
- # See how all your routes lay out with "rake routes"
-
- # This is a legacy wild controller route that's not recommended for RESTful applications.
- # Note: This route will make all actions in every controller accessible via GET requests.
- # match ':controller(/:action(/:id(.:format)))'
+ resources :products
end
View
16 db/schema.rb
@@ -0,0 +1,16 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 0) do
+
+end
View
9 features/steps/test_feature.rb
@@ -1,8 +1,9 @@
class TestFeature < Spinach::FeatureSteps
- Given "I visit the home page" do
- visit '/'
+ Given "I visit the products page" do
+ visit products_path
end
- Then "I should see \"Rails\"" do
- save_and_open_page
+
+ Then "I should see \"Products\"" do
+ page.has_content?('Products').must_equal true
end
end
View
3  features/support/env.rb
@@ -1,2 +1,3 @@
require 'spinach-rails'
-require_relative '../../config/application'
+ENV['RAILS_ENV']='test'
+require_relative '../../config/environment'
View
4 features/test_feature.feature
@@ -1,4 +1,4 @@
Feature: Test feature
Scenario: A test scenario
- Given I visit the home page
- Then I should see "Rails"
+ Given I visit the products page
+ Then I should see "Products"
Please sign in to comment.
Something went wrong with that request. Please try again.