Permalink
Browse files

functional tests

  • Loading branch information...
1 parent f19ccef commit 882459101526d9b6be4f78f00984941d059c16ea @fguillen committed Dec 21, 2008
@@ -1,41 +1,4 @@
class CommentsController < ApplicationController
- # GET /comments
- # GET /comments.xml
- def index
- @comments = Comment.find(:all)
-
- respond_to do |format|
- format.html # index.html.erb
- format.xml { render :xml => @comments }
- end
- end
-
- # GET /comments/1
- # GET /comments/1.xml
- def show
- @comment = Comment.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :xml => @comment }
- end
- end
-
- # GET /comments/new
- # GET /comments/new.xml
- def new
- @comment = Comment.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @comment }
- end
- end
-
- # GET /comments/1/edit
- def edit
- @comment = Comment.find(params[:id])
- end
# POST /comments
# POST /comments.xml
@@ -54,32 +17,4 @@ def create
end
end
- # PUT /comments/1
- # PUT /comments/1.xml
- def update
- @comment = Comment.find(params[:id])
-
- respond_to do |format|
- if @comment.update_attributes(params[:comment])
- flash[:notice] = 'Comment was successfully updated.'
- format.html { redirect_to(@comment) }
- format.xml { head :ok }
- else
- format.html { render :action => "edit" }
- format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }
- end
- end
- end
-
- # DELETE /comments/1
- # DELETE /comments/1.xml
- def destroy
- @comment = Comment.find(params[:id])
- @comment.destroy
-
- respond_to do |format|
- format.html { redirect_to(comments_url) }
- format.xml { head :ok }
- end
- end
end
@@ -1,41 +1,5 @@
class PaymentsController < ApplicationController
- # GET /payments
- # GET /payments.xml
- def index
- @payments = Payment.find(:all)
- respond_to do |format|
- format.html # index.html.erb
- format.xml { render :xml => @payments }
- end
- end
-
- # GET /payments/1
- # GET /payments/1.xml
- def show
- @payment = Payment.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :xml => @payment }
- end
- end
-
- # GET /payments/new
- # GET /payments/new.xml
- def new
- @payment = Payment.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @payment }
- end
- end
-
- # GET /payments/1/edit
- def edit
- @payment = Payment.find(params[:id])
- end
# POST /payments
# POST /payments.xml
@@ -54,32 +18,4 @@ def create
end
end
- # PUT /payments/1
- # PUT /payments/1.xml
- def update
- @payment = Payment.find(params[:id])
-
- respond_to do |format|
- if @payment.update_attributes(params[:payment])
- flash[:notice] = 'Payment was successfully updated.'
- format.html { redirect_to(@payment) }
- format.xml { head :ok }
- else
- format.html { render :action => "edit" }
- format.xml { render :xml => @payment.errors, :status => :unprocessable_entity }
- end
- end
- end
-
- # DELETE /payments/1
- # DELETE /payments/1.xml
- def destroy
- @payment = Payment.find(params[:id])
- @payment.destroy
-
- respond_to do |format|
- format.html { redirect_to(payments_url) }
- format.xml { head :ok }
- end
- end
end
@@ -10,32 +10,6 @@ def index
end
end
- # GET /speakers/1
- # GET /speakers/1.xml
- def show
- @speaker = Speaker.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :xml => @speaker }
- end
- end
-
- # GET /speakers/new
- # GET /speakers/new.xml
- def new
- @speaker = Speaker.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @speaker }
- end
- end
-
- # GET /speakers/1/edit
- def edit
- @speaker = Speaker.find(params[:id])
- end
# POST /speakers
# POST /speakers.xml
@@ -54,22 +28,6 @@ def create
end
end
- # PUT /speakers/1
- # PUT /speakers/1.xml
- def update
- @speaker = Speaker.find(params[:id])
-
- respond_to do |format|
- if @speaker.update_attributes(params[:speaker])
- flash[:notice] = 'Speaker was successfully updated.'
- format.html { redirect_to(@speaker) }
- format.xml { head :ok }
- else
- format.html { render :action => "edit" }
- format.xml { render :xml => @speaker.errors, :status => :unprocessable_entity }
- end
- end
- end
# DELETE /speakers/1
# DELETE /speakers/1.xml
@@ -1,6 +1,29 @@
class UsersController < ApplicationController
- # render new.rhtml
+
+ # GET /users
+ # GET /users.xml
+ def index
+ @users = User.find(:all)
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.xml { render :xml => @users }
+ end
+ end
+
+ # GET /users/1
+ # GET /users/1.xml
+ def show
+ @user = User.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.xml { render :xml => @user }
+ end
+ end
+
+
def new
@user = User.new
end
@@ -37,4 +60,41 @@ def activate
redirect_back_or_default('/')
end
end
+
+ # GET /users/1/edit
+ def edit
+ @user = User.find(params[:id])
+ end
+
+ # PUT /users/1
+ # PUT /users/1.xml
+ def update
+ @user = User.find(params[:id])
+
+ puts @user.valid?
+ puts @user.errors.full_messages
+
+ respond_to do |format|
+ if @user.update_attributes(params[:user])
+ flash[:notice] = 'User was successfully updated.'
+ format.html { redirect_to(@user) }
+ format.xml { head :ok }
+ else
+ format.html { render :action => "edit" }
+ format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /rooms/1
+ # DELETE /rooms/1.xml
+ def destroy
+ @user = User.find(params[:id])
+ @user.destroy
+
+ respond_to do |format|
+ format.html { redirect_to(users_url) }
+ format.xml { head :ok }
+ end
+ end
end
@@ -1,41 +1,4 @@
class VotesController < ApplicationController
- # GET /votes
- # GET /votes.xml
- def index
- @votes = Vote.find(:all)
-
- respond_to do |format|
- format.html # index.html.erb
- format.xml { render :xml => @votes }
- end
- end
-
- # GET /votes/1
- # GET /votes/1.xml
- def show
- @vote = Vote.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :xml => @vote }
- end
- end
-
- # GET /votes/new
- # GET /votes/new.xml
- def new
- @vote = Vote.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @vote }
- end
- end
-
- # GET /votes/1/edit
- def edit
- @vote = Vote.find(params[:id])
- end
# POST /votes
# POST /votes.xml
@@ -70,16 +33,4 @@ def update
end
end
end
-
- # DELETE /votes/1
- # DELETE /votes/1.xml
- def destroy
- @vote = Vote.find(params[:id])
- @vote.destroy
-
- respond_to do |format|
- format.html { redirect_to(votes_url) }
- format.xml { head :ok }
- end
- end
end
View
@@ -2,7 +2,7 @@ class NotDeletableEventException < Exception
end
class Event < ActiveRecord::Base
- has_many :payments
+ has_many :payments, :dependent => :destroy
validates_presence_of :name
validates_presence_of :description
@@ -3,16 +3,25 @@
exit
end
-File.read(ARGV[0]).each do |line|
+if not File.exists?(ARGV[0])
+ puts "Fichero no encontrado: #{ARGV[0]}"
+ exit
+end
+
+result = ""
+
+File.open(ARGV[0]).read.each do |line|
if line =~ /^\s*test ".*" do$/
- line.gsub!( /\"\sdo\s*$/, "" )
+ line.gsub!( /\"\sdo\s*/, "" )
line.gsub!( /"/, "" )
line.gsub!( /^\s*/, "" )
line.gsub!( /\s/, "_" )
line.gsub!( /^/, "def ")
- line = " " + line
+ line = " " + line + "\n"
end
- puts line
-end
+ result << line
+end
+
+File.new( ARGV[0], "w+" ).puts( result )
View
@@ -3,4 +3,8 @@
room1:
name: Room 1
- notes: Just a Room
+ notes: Just a Room
+
+room2:
+ name: Room 2
+ notes: Just a Room 2
Oops, something went wrong.

0 comments on commit 8824591

Please sign in to comment.