AutoCommit Mon Aug 31 17:03:03 CEST 2015
This commit is contained in:
@@ -9,7 +9,6 @@ class FetprofilesController < ApplicationController
|
|||||||
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
|
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
|
||||||
@fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive"
|
@fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive"
|
||||||
|
|
||||||
|
|
||||||
@gremientabs = Gremium.tabs
|
@gremientabs = Gremium.tabs
|
||||||
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile
|
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ describe FetprofilesController, :type => :controller do
|
|||||||
subject(:action) { get :show, {:id => @fetprofile.to_param}}
|
subject(:action) { get :show, {:id => @fetprofile.to_param}}
|
||||||
it_behaves_like "it is success"
|
it_behaves_like "it is success"
|
||||||
it_behaves_like "it assigns object"
|
it_behaves_like "it assigns object"
|
||||||
|
it "renders the 'show' template" do
|
||||||
|
expect(action).to render_template("show")
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET new" do
|
describe "GET new" do
|
||||||
@@ -104,10 +108,18 @@ describe FetprofilesController, :type => :controller do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "POST create" do
|
describe "POST create" do
|
||||||
subject(:action){post :create, {:fetprofile => FactoryGirl.build(:fetprofile).attributes.slice(:vorname, :nachname,:desc)}}
|
subject(:action){post :create, {:fetprofile => FactoryGirl.attributes_for(:fetprofile)},:format=>:html}
|
||||||
|
|
||||||
login_fet_user
|
login_fet_user
|
||||||
describe "with valid params" do
|
describe "with valid params" do
|
||||||
|
# login_fet_user
|
||||||
|
it "uses valid params" do
|
||||||
|
expect(Fetprofile.new({:vorname => "sdfsdf", :nachname=>"sdfefw",:desc=>"sdfsdfe"}).save).to be true
|
||||||
|
end
|
||||||
|
# before(:each) do
|
||||||
|
# Fetprofile.any_instance.stub(:save).and_return(true)
|
||||||
|
# end
|
||||||
|
|
||||||
it "creates a new Fetprofile" do
|
it "creates a new Fetprofile" do
|
||||||
expect{action}.to change(Fetprofile, :count).by(1)
|
expect{action}.to change(Fetprofile, :count).by(1)
|
||||||
end
|
end
|
||||||
@@ -115,11 +127,11 @@ describe FetprofilesController, :type => :controller do
|
|||||||
it "assigns a newly created fetprofile as @fetprofile" do
|
it "assigns a newly created fetprofile as @fetprofile" do
|
||||||
action
|
action
|
||||||
expect(assigns(:fetprofile)).to be_a(Fetprofile)
|
expect(assigns(:fetprofile)).to be_a(Fetprofile)
|
||||||
assigns(:fetprofile).should be_persisted
|
expect(assigns(:fetprofile)).to be_persisted
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to the created fetprofile" do
|
it "redirects to the created fetprofile" do
|
||||||
expect(action).to redirect_to(Fetprofile.last)
|
expect(action).to redirect_to action: "show"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -129,6 +141,7 @@ describe FetprofilesController, :type => :controller do
|
|||||||
it "assigns a newly created but unsaved fetprofile as @fetprofile" do
|
it "assigns a newly created but unsaved fetprofile as @fetprofile" do
|
||||||
action
|
action
|
||||||
assigns(:fetprofile).should be_a_new(Fetprofile)
|
assigns(:fetprofile).should be_a_new(Fetprofile)
|
||||||
|
expect(assigns(:fetprofile)).not_to be_persisted
|
||||||
end
|
end
|
||||||
it "re-renders the 'new' template" do
|
it "re-renders the 'new' template" do
|
||||||
expect(action).to render_template("new")
|
expect(action).to render_template("new")
|
||||||
@@ -148,6 +161,12 @@ describe FetprofilesController, :type => :controller do
|
|||||||
it "updates the requested fetprofile" do
|
it "updates the requested fetprofile" do
|
||||||
expect { action }.to change{Fetprofile.find(@fetprofile.id).vorname}#.to("neuerName")
|
expect { action }.to change{Fetprofile.find(@fetprofile.id).vorname}#.to("neuerName")
|
||||||
end
|
end
|
||||||
|
it "assigns a created fetprofile as @fetprofile" do
|
||||||
|
action
|
||||||
|
expect(assigns(:fetprofile)).to be_a(Fetprofile)
|
||||||
|
expect(assigns(:fetprofile)).to be_persisted
|
||||||
|
end
|
||||||
|
|
||||||
it "redirects to the fetprofile" do
|
it "redirects to the fetprofile" do
|
||||||
expect(action).to redirect_to(@fetprofile)
|
expect(action).to redirect_to(@fetprofile)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,5 +9,7 @@ FactoryGirl.define do
|
|||||||
desc "MyText"
|
desc "MyText"
|
||||||
picture "MyString"
|
picture "MyString"
|
||||||
active false
|
active false
|
||||||
|
birth_month 4
|
||||||
|
birth_day 2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user