From 9dd9c3cc488ca181ac6c7a6b16995d835daf5bec Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 30 Aug 2015 17:03:01 +0200 Subject: [PATCH] AutoCommit Son Aug 30 17:03:01 CEST 2015 --- .../fetprofiles_controller_spec.rb | 41 +++++++++++-------- spec/models/survey/choice_spec.rb | 3 ++ spec/models/user_spec.rb | 7 ++++ 3 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 spec/models/user_spec.rb diff --git a/spec/controllers/fetprofiles_controller_spec.rb b/spec/controllers/fetprofiles_controller_spec.rb index be40005..388b1f3 100644 --- a/spec/controllers/fetprofiles_controller_spec.rb +++ b/spec/controllers/fetprofiles_controller_spec.rb @@ -18,21 +18,26 @@ require 'spec_helper' # Message expectations are only used when there is no simpler way to specify # that an instance is receiving a specific message. -describe FetprofilesController do - +describe FetprofilesController, :type=> :controller do + include Devise::TestHelpers # This should return the minimal set of attributes required to create a valid # Fetprofile. As you add validations to Fetprofile, be sure to # adjust the attributes here as well. - let(:valid_attributes) { { "vorname" => "MyString" } } + 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 # FetprofilesController. Be sure to keep this updated too. - let(:valid_session) { {} } + let(:valid_session) { {locale: :de} } describe "GET index" do + it "has a 200 status code" do + get :index, {locale: "de"} + expect(response.status).to eq(200) + end + it "assigns all fetprofiles as @fetprofiles" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) get :index, {}, valid_session assigns(:fetprofiles).should eq([fetprofile]) end @@ -40,7 +45,7 @@ describe FetprofilesController do describe "GET show" do it "assigns the requested fetprofile as @fetprofile" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) get :show, {:id => fetprofile.to_param}, valid_session assigns(:fetprofile).should eq(fetprofile) end @@ -55,7 +60,7 @@ describe FetprofilesController do describe "GET edit" do it "assigns the requested fetprofile as @fetprofile" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) get :edit, {:id => fetprofile.to_param}, valid_session assigns(:fetprofile).should eq(fetprofile) end @@ -65,18 +70,18 @@ describe FetprofilesController do describe "with valid params" do it "creates a new Fetprofile" do expect { - post :create, {:fetprofile => valid_attributes}, valid_session + post :create, {:fetprofile => FactoryGirl.create(:fetprofile).to_hash}, valid_session }.to change(Fetprofile, :count).by(1) end it "assigns a newly created fetprofile as @fetprofile" do - post :create, {:fetprofile => valid_attributes}, valid_session + post :create, {:fetprofile => FactoryGirl.create(:fetprofile).to_hash}, valid_session assigns(:fetprofile).should be_a(Fetprofile) assigns(:fetprofile).should be_persisted end it "redirects to the created fetprofile" do - post :create, {:fetprofile => valid_attributes}, valid_session + post :create, {:fetprofile => FactoryGirl.create(:fetprofile).to_hash}, valid_session response.should redirect_to(Fetprofile.last) end end @@ -85,7 +90,7 @@ describe FetprofilesController do it "assigns a newly created but unsaved fetprofile as @fetprofile" do # Trigger the behavior that occurs when invalid params are submitted Fetprofile.any_instance.stub(:save).and_return(false) - post :create, {:fetprofile => { "vorname" => "invalid value" }}, valid_session + post :create, {:fetprofile => { "vorname" => "in", "nachname"=> "ssdf", "desc"=> "dffff" }}, valid_session assigns(:fetprofile).should be_a_new(Fetprofile) end @@ -101,7 +106,7 @@ describe FetprofilesController do describe "PUT update" do describe "with valid params" do it "updates the requested fetprofile" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) # Assuming there are no other fetprofiles in the database, this # specifies that the Fetprofile created on the previous line # receives the :update_attributes message with whatever params are @@ -111,13 +116,13 @@ describe FetprofilesController do end it "assigns the requested fetprofile as @fetprofile" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) put :update, {:id => fetprofile.to_param, :fetprofile => valid_attributes}, valid_session assigns(:fetprofile).should eq(fetprofile) end it "redirects to the fetprofile" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) put :update, {:id => fetprofile.to_param, :fetprofile => valid_attributes}, valid_session response.should redirect_to(fetprofile) end @@ -125,7 +130,7 @@ describe FetprofilesController do describe "with invalid params" do it "assigns the fetprofile as @fetprofile" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) # Trigger the behavior that occurs when invalid params are submitted Fetprofile.any_instance.stub(:save).and_return(false) put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session @@ -133,7 +138,7 @@ describe FetprofilesController do end it "re-renders the 'edit' template" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) # Trigger the behavior that occurs when invalid params are submitted Fetprofile.any_instance.stub(:save).and_return(false) put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session @@ -144,14 +149,14 @@ describe FetprofilesController do describe "DELETE destroy" do it "destroys the requested fetprofile" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) expect { delete :destroy, {:id => fetprofile.to_param}, valid_session }.to change(Fetprofile, :count).by(-1) end it "redirects to the fetprofiles list" do - fetprofile = Fetprofile.create! valid_attributes + fetprofile = FactoryGirl.create(:fetprofile) delete :destroy, {:id => fetprofile.to_param}, valid_session response.should redirect_to(fetprofiles_url) end diff --git a/spec/models/survey/choice_spec.rb b/spec/models/survey/choice_spec.rb index 31558cb..2923d52 100644 --- a/spec/models/survey/choice_spec.rb +++ b/spec/models/survey/choice_spec.rb @@ -1,5 +1,8 @@ require 'rails_helper' RSpec.describe Survey::Choice, :type => :model do + pending "picture" + pending "icon" + pending "depended answer" pending "add some examples to (or delete) #{__FILE__}" end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb new file mode 100644 index 0000000..29129ab --- /dev/null +++ b/spec/models/user_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' + +describe User do + email "testuser@test.at" + password "password" + password_confirmation "password" +end