forked from bofh/fetsite
AutoCommit Son Aug 30 17:03:01 CEST 2015
This commit is contained in:
@@ -18,21 +18,26 @@ require 'spec_helper'
|
|||||||
# Message expectations are only used when there is no simpler way to specify
|
# Message expectations are only used when there is no simpler way to specify
|
||||||
# that an instance is receiving a specific message.
|
# 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
|
# This should return the minimal set of attributes required to create a valid
|
||||||
# Fetprofile. As you add validations to Fetprofile, be sure to
|
# Fetprofile. As you add validations to Fetprofile, be sure to
|
||||||
# adjust the attributes here as well.
|
# 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
|
# 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
|
# in order to pass any filters (e.g. authentication) defined in
|
||||||
# FetprofilesController. Be sure to keep this updated too.
|
# FetprofilesController. Be sure to keep this updated too.
|
||||||
let(:valid_session) { {} }
|
let(:valid_session) { {locale: :de} }
|
||||||
|
|
||||||
describe "GET index" do
|
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
|
it "assigns all fetprofiles as @fetprofiles" do
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
fetprofile = FactoryGirl.create(:fetprofile)
|
||||||
get :index, {}, valid_session
|
get :index, {}, valid_session
|
||||||
assigns(:fetprofiles).should eq([fetprofile])
|
assigns(:fetprofiles).should eq([fetprofile])
|
||||||
end
|
end
|
||||||
@@ -40,7 +45,7 @@ describe FetprofilesController do
|
|||||||
|
|
||||||
describe "GET show" do
|
describe "GET show" do
|
||||||
it "assigns the requested fetprofile as @fetprofile" 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
|
get :show, {:id => fetprofile.to_param}, valid_session
|
||||||
assigns(:fetprofile).should eq(fetprofile)
|
assigns(:fetprofile).should eq(fetprofile)
|
||||||
end
|
end
|
||||||
@@ -55,7 +60,7 @@ describe FetprofilesController do
|
|||||||
|
|
||||||
describe "GET edit" do
|
describe "GET edit" do
|
||||||
it "assigns the requested fetprofile as @fetprofile" 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
|
get :edit, {:id => fetprofile.to_param}, valid_session
|
||||||
assigns(:fetprofile).should eq(fetprofile)
|
assigns(:fetprofile).should eq(fetprofile)
|
||||||
end
|
end
|
||||||
@@ -65,18 +70,18 @@ describe FetprofilesController do
|
|||||||
describe "with valid params" do
|
describe "with valid params" do
|
||||||
it "creates a new Fetprofile" do
|
it "creates a new Fetprofile" do
|
||||||
expect {
|
expect {
|
||||||
post :create, {:fetprofile => valid_attributes}, valid_session
|
post :create, {:fetprofile => FactoryGirl.create(:fetprofile).to_hash}, valid_session
|
||||||
}.to change(Fetprofile, :count).by(1)
|
}.to change(Fetprofile, :count).by(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "assigns a newly created fetprofile as @fetprofile" do
|
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_a(Fetprofile)
|
||||||
assigns(:fetprofile).should be_persisted
|
assigns(:fetprofile).should be_persisted
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to the created fetprofile" do
|
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)
|
response.should redirect_to(Fetprofile.last)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -85,7 +90,7 @@ describe FetprofilesController do
|
|||||||
it "assigns a newly created but unsaved fetprofile as @fetprofile" do
|
it "assigns a newly created but unsaved fetprofile as @fetprofile" do
|
||||||
# Trigger the behavior that occurs when invalid params are submitted
|
# Trigger the behavior that occurs when invalid params are submitted
|
||||||
Fetprofile.any_instance.stub(:save).and_return(false)
|
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)
|
assigns(:fetprofile).should be_a_new(Fetprofile)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -101,7 +106,7 @@ describe FetprofilesController do
|
|||||||
describe "PUT update" do
|
describe "PUT update" do
|
||||||
describe "with valid params" do
|
describe "with valid params" do
|
||||||
it "updates the requested fetprofile" 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
|
# Assuming there are no other fetprofiles in the database, this
|
||||||
# specifies that the Fetprofile created on the previous line
|
# specifies that the Fetprofile created on the previous line
|
||||||
# receives the :update_attributes message with whatever params are
|
# receives the :update_attributes message with whatever params are
|
||||||
@@ -111,13 +116,13 @@ describe FetprofilesController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "assigns the requested fetprofile as @fetprofile" do
|
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
|
put :update, {:id => fetprofile.to_param, :fetprofile => valid_attributes}, valid_session
|
||||||
assigns(:fetprofile).should eq(fetprofile)
|
assigns(:fetprofile).should eq(fetprofile)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to the fetprofile" do
|
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
|
put :update, {:id => fetprofile.to_param, :fetprofile => valid_attributes}, valid_session
|
||||||
response.should redirect_to(fetprofile)
|
response.should redirect_to(fetprofile)
|
||||||
end
|
end
|
||||||
@@ -125,7 +130,7 @@ describe FetprofilesController do
|
|||||||
|
|
||||||
describe "with invalid params" do
|
describe "with invalid params" do
|
||||||
it "assigns the fetprofile as @fetprofile" 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
|
# Trigger the behavior that occurs when invalid params are submitted
|
||||||
Fetprofile.any_instance.stub(:save).and_return(false)
|
Fetprofile.any_instance.stub(:save).and_return(false)
|
||||||
put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session
|
put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session
|
||||||
@@ -133,7 +138,7 @@ describe FetprofilesController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "re-renders the 'edit' template" do
|
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
|
# Trigger the behavior that occurs when invalid params are submitted
|
||||||
Fetprofile.any_instance.stub(:save).and_return(false)
|
Fetprofile.any_instance.stub(:save).and_return(false)
|
||||||
put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session
|
put :update, {:id => fetprofile.to_param, :fetprofile => { "vorname" => "invalid value" }}, valid_session
|
||||||
@@ -144,14 +149,14 @@ describe FetprofilesController do
|
|||||||
|
|
||||||
describe "DELETE destroy" do
|
describe "DELETE destroy" do
|
||||||
it "destroys the requested fetprofile" do
|
it "destroys the requested fetprofile" do
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
fetprofile = FactoryGirl.create(:fetprofile)
|
||||||
expect {
|
expect {
|
||||||
delete :destroy, {:id => fetprofile.to_param}, valid_session
|
delete :destroy, {:id => fetprofile.to_param}, valid_session
|
||||||
}.to change(Fetprofile, :count).by(-1)
|
}.to change(Fetprofile, :count).by(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "redirects to the fetprofiles list" do
|
it "redirects to the fetprofiles list" do
|
||||||
fetprofile = Fetprofile.create! valid_attributes
|
fetprofile = FactoryGirl.create(:fetprofile)
|
||||||
delete :destroy, {:id => fetprofile.to_param}, valid_session
|
delete :destroy, {:id => fetprofile.to_param}, valid_session
|
||||||
response.should redirect_to(fetprofiles_url)
|
response.should redirect_to(fetprofiles_url)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Survey::Choice, :type => :model do
|
RSpec.describe Survey::Choice, :type => :model do
|
||||||
|
pending "picture"
|
||||||
|
pending "icon"
|
||||||
|
pending "depended answer"
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
end
|
end
|
||||||
|
|||||||
7
spec/models/user_spec.rb
Normal file
7
spec/models/user_spec.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe User do
|
||||||
|
email "testuser@test.at"
|
||||||
|
password "password"
|
||||||
|
password_confirmation "password"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user