Sha256: 6fb46a655ec8c6aac52c6a4e394a3ae4e280ab7e79fb570b0eab2ab253803b55
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 KB
Contents
require 'rails_helper' RSpec.describe Admin::JobsController, :type => :controller do render_views before :each do # Why can't I do this shit in a helper like I do for requests? user = double('user') allow(request.env['warden']).to receive(:authenticate!) { user } allow(controller).to receive(:current_user) { user } end describe "GET index" do it "finds all Jobs" do r = Job.make! get :index response.status.should == 200 assigns(:jobs).include?(r).should == true end end describe "SHOW record" do it "finds the record" do r = Job.make! get :show, params: { id: r.id } response.status.should == 200 end end describe "NEW record" do it "renders the form for a new record" do get :new response.status.should == 200 end end describe "CREATE record" do it "creates the record" do r = Job.make post :create, params: { job: r.attributes } response.should redirect_to action: :show, id: Job.last.id Job.last.title.should == r.title end end describe "EDIT record" do it "renders the edit form for an existing record" do r = Job.make! get :edit, params: { id: r.id } response.status.should == 200 end end describe "UPDATE record" do it "updates the record" do r = Job.make! put :update, params: { id: r.id, job: { title: "New Name" } } response.should redirect_to action: :show, id: r.id Job.find(r.id).title.should == "New Name" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
introspective_admin-0.9.0 | spec/admin/job_admin_spec.rb |