diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb new file mode 100644 --- /dev/null +++ b/app/controllers/submissions_controller.rb @@ -0,0 +1,112 @@ +class SubmissionsController < ApplicationController + before_filter :authenticate + + before_filter(only: [:show]) { + #check if authenticated + return false unless authenticate + + #admin always has privileged + if @current_user.admin? + return true + end + + sub = Submission.find(params[:id]) + if sub.problem.available? + return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user + end + + #default to NO + unauthorized_redirect + return false + } + + # GET /submissions + # GET /submissions.json + def index + @user = @current_user + @problems = @user.available_problems + + if params[:problem_id]==nil + @problem = nil + @submissions = nil + else + @problem = Problem.find_by_id(params[:problem_id]) + if (@problem == nil) or (not @problem.available) + redirect_to :action => 'list' + flash[:notice] = 'Error: submissions for that problem are not viewable.' + return + end + @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) + end + end + + # GET /submissions/1 + # GET /submissions/1.json + def show + @submission = Submission.find(params[:id]) + + #log the viewing + user = User.find(session[:user_id]) + SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin? + end + + # GET /submissions/new + # GET /submissions/new.json + def new + @submission = Submission.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @submission } + end + end + + # GET /submissions/1/edit + def edit + @submission = Submission.find(params[:id]) + end + + # POST /submissions + # POST /submissions.json + def create + @submission = Submission.new(params[:submission]) + + respond_to do |format| + if @submission.save + format.html { redirect_to @submission, notice: 'Submission was successfully created.' } + format.json { render json: @submission, status: :created, location: @submission } + else + format.html { render action: "new" } + format.json { render json: @submission.errors, status: :unprocessable_entity } + end + end + end + + # PUT /submissions/1 + # PUT /submissions/1.json + def update + @submission = Submission.find(params[:id]) + + respond_to do |format| + if @submission.update_attributes(params[:submission]) + format.html { redirect_to @submission, notice: 'Submission was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @submission.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /submissions/1 + # DELETE /submissions/1.json + def destroy + @submission = Submission.find(params[:id]) + @submission.destroy + + respond_to do |format| + format.html { redirect_to submissions_url } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/submissions_helper.rb b/app/helpers/submissions_helper.rb new file mode 100644 --- /dev/null +++ b/app/helpers/submissions_helper.rb @@ -0,0 +1,2 @@ +module SubmissionsHelper +end diff --git a/app/views/application/_compiler_message.html.erb b/app/views/application/_compiler_message.html.erb new file mode 100644 --- /dev/null +++ b/app/views/application/_compiler_message.html.erb @@ -0,0 +1,15 @@ + +<% if compiler_message == nil or compiler_message.chomp == '' %> + No message +<% else %> +
+ (click to see) +
+
+
+ <%=simple_format(compiler_message) %> +
+
+<% end %> diff --git a/app/views/application/_submission.html.haml b/app/views/application/_submission.html.haml new file mode 100644 --- /dev/null +++ b/app/views/application/_submission.html.haml @@ -0,0 +1,26 @@ + +%tr + %td{:align => "center"} + = submission_counter+1 + %td{:align => "center"} + = link_to "##{submission.id}", submission_path(submission.id) + %td + = l submission.submitted_at, format: :long + = "( #{time_ago_in_words(submission.submitted_at)} ago)" + %td + = submission.source_filename + = " (#{submission.language.pretty_name}) " + = link_to('[load]',{:action => 'source', :id => submission.id}) + %td + - if submission.graded_at + = "Graded at #{format_short_time(submission.graded_at)}." + %br/ + = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score'] + = " [" + %tt + = submission.grader_comment + = "]" + %td + = render :partial => 'compiler_message', :locals => {:compiler_message => submission.compiler_message } + %td + = link_to 'Edit', direct_edit_submission_path(submission.id), class: 'btn btn-success' diff --git a/app/views/graders/submission.html.haml b/app/views/graders/submission.html.haml --- a/app/views/graders/submission.html.haml +++ b/app/views/graders/submission.html.haml @@ -1,6 +1,3 @@ -//%style{type: "text/css"} -// = @css_style - %h1= "Submission: #{@submission.id}" %textarea#data{style: "display:none;"} diff --git a/app/views/main/_compiler_message.html.erb b/app/views/main/_compiler_message.html.erb deleted file mode 100644 --- a/app/views/main/_compiler_message.html.erb +++ /dev/null @@ -1,15 +0,0 @@ - -<% if compiler_message == nil or compiler_message.chomp == '' %> - No message -<% else %> -
- (click to see) -
-
-
- <%=simple_format(compiler_message) %> -
-
-<% end %> diff --git a/app/views/main/_problem.html.haml b/app/views/main/_problem.html.haml --- a/app/views/main/_problem.html.haml +++ b/app/views/main/_problem.html.haml @@ -10,7 +10,7 @@ = link_to "[subs]", main_submission_path(problem.id) %td = render :partial => 'submission_short', - :locals => {:submission => @prob_submissions[problem.id][:submission], :problem_name => problem.name } + :locals => {:submission => @prob_submissions[problem.id][:submission], :problem_name => problem.name, :problem_id => problem.id } %td - if @prob_submissions[problem.id][:submission] = link_to 'Edit', direct_edit_submission_path(@prob_submissions[problem.id][:submission]), class: 'btn btn-success' diff --git a/app/views/main/_submission.html.haml b/app/views/main/_submission.html.haml deleted file mode 100644 --- a/app/views/main/_submission.html.haml +++ /dev/null @@ -1,26 +0,0 @@ - -%tr - %td{:align => "center"} - = submission_counter+1 - %td{:align => "center"} - = link_to "##{submission.id}", controller: :graders, action: :submission, id: submission.id - %td - = l submission.submitted_at, format: :long - = "( #{time_ago_in_words(submission.submitted_at)} ago)" - %td - = submission.source_filename - = " (#{submission.language.pretty_name}) " - = link_to('[load]',{:action => 'source', :id => submission.id}) - %td - - if submission.graded_at - = "Graded at #{format_short_time(submission.graded_at)}." - %br/ - = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score'] - = " [" - %tt - = submission.grader_comment - = "]" - %td - = render :partial => 'compiler_message', :locals => {:compiler_message => submission.compiler_message } - %td - = link_to 'Edit', direct_edit_submission_path(submission.id), class: 'btn btn-success' diff --git a/app/views/main/_submission_short.html.haml b/app/views/main/_submission_short.html.haml --- a/app/views/main/_submission_short.html.haml +++ b/app/views/main/_submission_short.html.haml @@ -24,4 +24,4 @@ = " | " = link_to("[#{t 'main.src_link'}]",{:action => 'source', :id => submission.id}) = " | " - = link_to "[#{t 'main.submissions_link'}]", :action => 'submission', :id => problem_name + = link_to "[#{t 'main.submissions_link'}]", problem_submissions_path(problem_id) diff --git a/app/views/report/_task_hof.html.haml b/app/views/report/_task_hof.html.haml --- a/app/views/report/_task_hof.html.haml +++ b/app/views/report/_task_hof.html.haml @@ -51,7 +51,7 @@ with #{@best[:runtime][:value] * 1000} milliseconds %br at submission - = link_to("#" + @best[:runtime][:sub_id].to_s, controller: 'graders', action: 'submission', id:@best[:runtime][:sub_id]) + = link_to "#" + @best[:runtime][:sub_id].to_s, submission_path(@best[:runtime][:sub_id]) %tr %td.info_param @@ -69,7 +69,7 @@ with #{number_with_delimiter(@best[:memory][:value])} kbytes %br at submission - = link_to("#" + @best[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id:@best[:memory][:sub_id]) + = link_to "#" + @best[:memory][:sub_id].to_s, submission_path(@best[:memory][:sub_id]) %tr %td.info_param Shortest Code @@ -81,7 +81,7 @@ with #{@best[:length][:value]} bytes %br at submission - = link_to("#" + @best[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:length][:sub_id]) + = link_to "#" + @best[:length][:sub_id].to_s, submission_path(@best[:length][:sub_id]) %tr %td.info_param First solver @@ -94,7 +94,7 @@ on #{@best[:first][:value]} %br at submission - = link_to("#" + @best[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: @best[:first][:sub_id]) + = link_to "#" + @best[:first][:sub_id].to_s, submission_path( @best[:first][:sub_id]) - else no first solver .col-md-8 @@ -115,22 +115,22 @@ %td = link_to value[:runtime][:user], controller: 'users', action: 'profile', id: value[:runtime][:user_id] %br - = "(#{(value[:runtime][:value] * 1000).to_i} @" - = "#{link_to("#" + value[:runtime][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:runtime][:sub_id])} )".html_safe + = "#{(value[:runtime][:value] * 1000).to_i} @" + = link_to "#" + value[:runtime][:sub_id].to_s, submission_path( value[:runtime][:sub_id]) %td = link_to value[:memory][:user], controller: 'users', action: 'profile', id: value[:memory][:user_id] %br - = "(#{number_with_delimiter(value[:memory][:value])} @" - = "#{link_to("#" + value[:memory][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:memory][:sub_id])} )".html_safe + = "#{number_with_delimiter(value[:memory][:value])} @" + = link_to "#" + value[:memory][:sub_id].to_s, submission_path(value[:memory][:sub_id]) %td = link_to value[:length][:user], controller: 'users', action: 'profile', id: value[:length][:user_id] %br - = "(#{value[:length][:value]} @" - = "#{link_to("#" + value[:length][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:length][:sub_id])} )".html_safe + = "#{value[:length][:value]} @" + = link_to "#" + value[:length][:sub_id].to_s, submission_path(value[:length][:sub_id]) %td - if value[:first][:user] != '(NULL)' #TODO: i know... this is wrong... = link_to value[:first][:user], controller: 'users', action: 'profile', id: value[:first][:user_id] %br - = "(#{value[:first][:value]} @" - = "#{link_to("#" + value[:first][:sub_id].to_s, controller: 'graders' , action: 'submission', id: value[:first][:sub_id])} )".html_safe + = "#{value[:first][:value]} @" + = link_to "#" + value[:first][:sub_id].to_s, submission_path( value[:first][:sub_id]) diff --git a/app/views/submissions/_form.html.haml b/app/views/submissions/_form.html.haml new file mode 100644 --- /dev/null +++ b/app/views/submissions/_form.html.haml @@ -0,0 +1,10 @@ += form_for @submission do |f| + - if @submission.errors.any? + #error_explanation + %h2= "#{pluralize(@submission.errors.count, "error")} prohibited this submission from being saved:" + %ul + - @submission.errors.full_messages.each do |msg| + %li= msg + + .actions + = f.submit 'Save' diff --git a/app/views/submissions/edit.html.haml b/app/views/submissions/edit.html.haml new file mode 100644 --- /dev/null +++ b/app/views/submissions/edit.html.haml @@ -0,0 +1,7 @@ +%h1 Editing submission + += render 'form' + += link_to 'Show', @submission +\| += link_to 'Back', submissions_path diff --git a/app/views/submissions/index.html.haml b/app/views/submissions/index.html.haml new file mode 100644 --- /dev/null +++ b/app/views/submissions/index.html.haml @@ -0,0 +1,29 @@ +.panel.panel-info + .panel-heading + Select Problems + .panel-body + .form-inline + = select 'submission', + 'problem_id', + @problems.collect {|p| ["[#{p.name}] #{p.full_name}", problem_submissions_url(p.id)]}, + { selected: (@problem ? problem_submissions_url(@problem) : -1) }, + { class: 'select2 form-control'} + %button.btn.btn-primary.btn-sm.go-button#problem_go{data: {source: '#submission_problem_id'}} Go + +- if @problem!=nil + %h2= "Task: #{@problem.full_name} (#{@problem.name})" + +- if @submissions!=nil + - if @submissions.length>0 + %table.table + %thead + %th No. + %th # + %th At + %th Source + %th Result + %th{:width => "300px"} Compiler message + %th + = render :partial => 'submission', :collection => @submissions + - else + No submission diff --git a/app/views/submissions/new.html.haml b/app/views/submissions/new.html.haml new file mode 100644 --- /dev/null +++ b/app/views/submissions/new.html.haml @@ -0,0 +1,5 @@ +%h1 New submission + += render 'form' + += link_to 'Back', submissions_path diff --git a/app/views/submissions/show.html.haml b/app/views/submissions/show.html.haml new file mode 100644 --- /dev/null +++ b/app/views/submissions/show.html.haml @@ -0,0 +1,84 @@ +%h1= "Submission: #{@submission.id}" + +%textarea#data{style: "display:none;"} + :preserve + #{@submission.source} + +//%div.highlight{:style => "border: 1px solid black;"} +//=@formatted_code.html_safe +.containter + .row + .col-md-7 + %h2 Source Code + .col-md-5 + %h2 Stat + .row + .col-md-7 + %div#editor{ style: "font-size: 14px; height: 400px; border-radius:5px;" } + :javascript + e = ace.edit("editor") + e.setOptions({ maxLines: Infinity }) + e.setValue($("#data").text()) + e.gotoLine(1) + e.getSession().setMode("#{get_ace_mode(@submission.language)}") + e.setReadOnly(true) + .col-md-5 + %table.table.table-striped + %tr + %td.text-right + %strong User + %td + - if @submission.user + = link_to "(#{@submission.user.login})", controller: "users", action: "profile", id: @submission.user + = @submission.user.full_name + - else + = "(n/a)" + %tr + %td.text-right + %strong Task + %td + - if @submission.problem!=nil + = link_to "(#{@submission.problem.name})", controller: "problems", action: "stat", id: @submission.problem + = @submission.problem.full_name + - else + = "(n/a)" + %tr + %td.text-right + %strong Tries + %td= @submission.number + %tr + %td.text-right + %strong Language + %td= @submission.language.pretty_name + %tr + %td.text-right + %strong Submitted + %td #{time_ago_in_words(@submission.submitted_at)} ago (at #{@submission.submitted_at.to_formatted_s(:long)}) + %tr + %td.text-right + %strong Graded + - if @submission.graded_at + %td #{time_ago_in_words(@submission.graded_at)} ago (at #{@submission.graded_at.to_formatted_s(:long)}) + - else + %td - + %tr + %td.text-right + %strong Points + %td #{@submission.points}/#{@submission.problem.full_score} + %tr + %td.text-right + %strong Comment + %td #{@submission.grader_comment} + %tr + %td.text-right + %strong Runtime (s) + %td #{@submission.max_runtime} + %tr + %td.text-right + %strong Memory (kb) + %td #{@submission.peak_memory} + - if session[:admin] + %tr + %td.text-right + %strong IP + %td #{@submission.ip_address} diff --git a/config/routes.rb b/config/routes.rb --- a/config/routes.rb +++ b/config/routes.rb @@ -34,6 +34,12 @@ end end + resources :submissions do + collection do + get 'prob/:problem_id', to: 'submissions#index', as: 'problem' + end + end + #source code edit get 'sources/direct_edit/:pid', to: 'sources#direct_edit', as: 'direct_edit' get 'sources/direct_edit_submission/:sid', to: 'sources#direct_edit_submission', as: 'direct_edit_submission' diff --git a/spec/controllers/submissions_controller_spec.rb b/spec/controllers/submissions_controller_spec.rb new file mode 100644 --- /dev/null +++ b/spec/controllers/submissions_controller_spec.rb @@ -0,0 +1,160 @@ +require 'spec_helper' + +# This spec was generated by rspec-rails when you ran the scaffold generator. +# It demonstrates how one might use RSpec to specify the controller code that +# was generated by Rails when you ran the scaffold generator. +# +# It assumes that the implementation code is generated by the rails scaffold +# generator. If you are using any extension libraries to generate different +# controller code, this generated spec may or may not pass. +# +# It only uses APIs available in rails and/or rspec-rails. There are a number +# of tools you can use to make these specs even more expressive, but we're +# sticking to rails and rspec-rails APIs to keep things simple and stable. +# +# Compared to earlier versions of this generator, there is very limited use of +# stubs and message expectations in this spec. Stubs are only used when there +# is no simpler way to get a handle on the object needed for the example. +# Message expectations are only used when there is no simpler way to specify +# that an instance is receiving a specific message. + +describe SubmissionsController do + + # This should return the minimal set of attributes required to create a valid + # Submission. As you add validations to Submission, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { } } + + # This should return the minimal set of values that should be in the session + # in order to pass any filters (e.g. authentication) defined in + # SubmissionsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all submissions as @submissions" do + submission = Submission.create! valid_attributes + get :index, {}, valid_session + assigns(:submissions).should eq([submission]) + end + end + + describe "GET show" do + it "assigns the requested submission as @submission" do + submission = Submission.create! valid_attributes + get :show, {:id => submission.to_param}, valid_session + assigns(:submission).should eq(submission) + end + end + + describe "GET new" do + it "assigns a new submission as @submission" do + get :new, {}, valid_session + assigns(:submission).should be_a_new(Submission) + end + end + + describe "GET edit" do + it "assigns the requested submission as @submission" do + submission = Submission.create! valid_attributes + get :edit, {:id => submission.to_param}, valid_session + assigns(:submission).should eq(submission) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Submission" do + expect { + post :create, {:submission => valid_attributes}, valid_session + }.to change(Submission, :count).by(1) + end + + it "assigns a newly created submission as @submission" do + post :create, {:submission => valid_attributes}, valid_session + assigns(:submission).should be_a(Submission) + assigns(:submission).should be_persisted + end + + it "redirects to the created submission" do + post :create, {:submission => valid_attributes}, valid_session + response.should redirect_to(Submission.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved submission as @submission" do + # Trigger the behavior that occurs when invalid params are submitted + Submission.any_instance.stub(:save).and_return(false) + post :create, {:submission => { }}, valid_session + assigns(:submission).should be_a_new(Submission) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Submission.any_instance.stub(:save).and_return(false) + post :create, {:submission => { }}, valid_session + response.should render_template("new") + end + end + end + + describe "PUT update" do + describe "with valid params" do + it "updates the requested submission" do + submission = Submission.create! valid_attributes + # Assuming there are no other submissions in the database, this + # specifies that the Submission created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Submission.any_instance.should_receive(:update_attributes).with({ "these" => "params" }) + put :update, {:id => submission.to_param, :submission => { "these" => "params" }}, valid_session + end + + it "assigns the requested submission as @submission" do + submission = Submission.create! valid_attributes + put :update, {:id => submission.to_param, :submission => valid_attributes}, valid_session + assigns(:submission).should eq(submission) + end + + it "redirects to the submission" do + submission = Submission.create! valid_attributes + put :update, {:id => submission.to_param, :submission => valid_attributes}, valid_session + response.should redirect_to(submission) + end + end + + describe "with invalid params" do + it "assigns the submission as @submission" do + submission = Submission.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Submission.any_instance.stub(:save).and_return(false) + put :update, {:id => submission.to_param, :submission => { }}, valid_session + assigns(:submission).should eq(submission) + end + + it "re-renders the 'edit' template" do + submission = Submission.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Submission.any_instance.stub(:save).and_return(false) + put :update, {:id => submission.to_param, :submission => { }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested submission" do + submission = Submission.create! valid_attributes + expect { + delete :destroy, {:id => submission.to_param}, valid_session + }.to change(Submission, :count).by(-1) + end + + it "redirects to the submissions list" do + submission = Submission.create! valid_attributes + delete :destroy, {:id => submission.to_param}, valid_session + response.should redirect_to(submissions_url) + end + end + +end diff --git a/spec/helpers/submissions_helper_spec.rb b/spec/helpers/submissions_helper_spec.rb new file mode 100644 --- /dev/null +++ b/spec/helpers/submissions_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the SubmissionsHelper. For example: +# +# describe SubmissionsHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +describe SubmissionsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/submissions_spec.rb b/spec/requests/submissions_spec.rb new file mode 100644 --- /dev/null +++ b/spec/requests/submissions_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Submissions" do + describe "GET /submissions" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get submissions_path + response.status.should be(200) + end + end +end diff --git a/spec/routing/submissions_routing_spec.rb b/spec/routing/submissions_routing_spec.rb new file mode 100644 --- /dev/null +++ b/spec/routing/submissions_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe SubmissionsController do + describe "routing" do + + it "routes to #index" do + get("/submissions").should route_to("submissions#index") + end + + it "routes to #new" do + get("/submissions/new").should route_to("submissions#new") + end + + it "routes to #show" do + get("/submissions/1").should route_to("submissions#show", :id => "1") + end + + it "routes to #edit" do + get("/submissions/1/edit").should route_to("submissions#edit", :id => "1") + end + + it "routes to #create" do + post("/submissions").should route_to("submissions#create") + end + + it "routes to #update" do + put("/submissions/1").should route_to("submissions#update", :id => "1") + end + + it "routes to #destroy" do + delete("/submissions/1").should route_to("submissions#destroy", :id => "1") + end + + end +end diff --git a/spec/views/submissions/edit.html.haml_spec.rb b/spec/views/submissions/edit.html.haml_spec.rb new file mode 100644 --- /dev/null +++ b/spec/views/submissions/edit.html.haml_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "submissions/edit" do + before(:each) do + @submission = assign(:submission, stub_model(Submission)) + end + + it "renders the edit submission form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", submission_path(@submission), "post" do + end + end +end diff --git a/spec/views/submissions/index.html.haml_spec.rb b/spec/views/submissions/index.html.haml_spec.rb new file mode 100644 --- /dev/null +++ b/spec/views/submissions/index.html.haml_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "submissions/index" do + before(:each) do + assign(:submissions, [ + stub_model(Submission), + stub_model(Submission) + ]) + end + + it "renders a list of submissions" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end diff --git a/spec/views/submissions/new.html.haml_spec.rb b/spec/views/submissions/new.html.haml_spec.rb new file mode 100644 --- /dev/null +++ b/spec/views/submissions/new.html.haml_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "submissions/new" do + before(:each) do + assign(:submission, stub_model(Submission).as_new_record) + end + + it "renders new submission form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", submissions_path, "post" do + end + end +end diff --git a/spec/views/submissions/show.html.haml_spec.rb b/spec/views/submissions/show.html.haml_spec.rb new file mode 100644 --- /dev/null +++ b/spec/views/submissions/show.html.haml_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe "submissions/show" do + before(:each) do + @submission = assign(:submission, stub_model(Submission)) + end + + it "renders attributes in

" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + end +end