<%= tinymce_assets %>
<%= semantic_form_for @studium do |f| %>
+<<<<<<< HEAD
<%= f.inputs do %>
+=======
+
+ <%= f.inputs do %>
+
+>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
<%= f.input :name,:append=>"NAME" %>
@@ -17,12 +23,19 @@
<%= f.input :desc, :as=>:tinymce_text %>
+<<<<<<< HEAD
+=======
+>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
<% end %>
<%= tinymce %>
<%= f.actions do %>
<%= f.action :submit, :as => :input %>
<% end %>
+<<<<<<< HEAD
+=======
+
+>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
<% end %>
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 2e2ca1e..0a24057 100755
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -105,6 +105,7 @@ de:
blank: "Geben Sie den Namen des Studiums ein"
taken: "Der Name ist bereits vergeben"
typ:
+<<<<<<< HEAD
inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
modul:
attributes:
@@ -125,3 +126,202 @@ de:
array:
two_words_connector: ', '
+=======
+ inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
+
+ date:
+ abbr_day_names:
+ - So
+ - Mo
+ - Di
+ - Mi
+ - Do
+ - Fr
+ - Sa
+ abbr_month_names:
+ -
+ - Jan
+ - Feb
+ - Mär
+ - Apr
+ - Mai
+ - Jun
+ - Jul
+ - Aug
+ - Sep
+ - Okt
+ - Nov
+ - Dez
+ day_names:
+ - Sonntag
+ - Montag
+ - Dienstag
+ - Mittwoch
+ - Donnerstag
+ - Freitag
+ - Samstag
+ formats:
+ default: ! '%d.%m.%Y'
+ long: ! '%e. %B %Y'
+ short: ! '%e. %b'
+ month_names:
+ -
+ - Januar
+ - Februar
+ - März
+ - April
+ - Mai
+ - Juni
+ - Juli
+ - August
+ - September
+ - Oktober
+ - November
+ - Dezember
+ order:
+ - :day
+ - :month
+ - :year
+ datetime:
+ distance_in_words:
+ about_x_hours:
+ one: etwa eine Stunde
+ other: etwa %{count} Stunden
+ about_x_months:
+ one: etwa ein Monat
+ other: etwa %{count} Monate
+ about_x_years:
+ one: etwa ein Jahr
+ other: etwa %{count} Jahre
+ almost_x_years:
+ one: fast ein Jahr
+ other: fast %{count} Jahre
+ half_a_minute: eine halbe Minute
+ less_than_x_minutes:
+ one: weniger als eine Minute
+ other: weniger als %{count} Minuten
+ less_than_x_seconds:
+ one: weniger als eine Sekunde
+ other: weniger als %{count} Sekunden
+ over_x_years:
+ one: mehr als ein Jahr
+ other: mehr als %{count} Jahre
+ x_days:
+ one: ein Tag
+ other: ! '%{count} Tage'
+ x_minutes:
+ one: eine Minute
+ other: ! '%{count} Minuten'
+ x_months:
+ one: ein Monat
+ other: ! '%{count} Monate'
+ x_seconds:
+ one: eine Sekunde
+ other: ! '%{count} Sekunden'
+ prompts:
+ day: Tag
+ hour: Stunden
+ minute: Minuten
+ month: Monat
+ second: Sekunden
+ year: Jahr
+ errors:
+ format: ! '%{attribute} %{message}'
+ messages:
+ accepted: muss akzeptiert werden
+ blank: muss ausgefüllt werden
+ confirmation: stimmt nicht mit der Bestätigung überein
+ empty: muss ausgefüllt werden
+ equal_to: muss genau %{count} sein
+ even: muss gerade sein
+ exclusion: ist nicht verfügbar
+ greater_than: muss größer als %{count} sein
+ greater_than_or_equal_to: muss größer oder gleich %{count} sein
+ inclusion: ist kein gültiger Wert
+ invalid: ist nicht gültig
+ less_than: muss kleiner als %{count} sein
+ less_than_or_equal_to: muss kleiner oder gleich %{count} sein
+ not_a_number: ist keine Zahl
+ not_an_integer: muss ganzzahlig sein
+ odd: muss ungerade sein
+ record_invalid: ! 'Gültigkeitsprüfung ist fehlgeschlagen: %{errors}'
+ taken: ist bereits vergeben
+ too_long: ist zu lang (nicht mehr als %{count} Zeichen)
+ too_short: ist zu kurz (nicht weniger als %{count} Zeichen)
+ wrong_length: hat die falsche Länge (muss genau %{count} Zeichen haben)
+ template:
+ body: ! 'Bitte überprüfen Sie die folgenden Felder:'
+ header:
+ one: ! 'Konnte %{model} nicht speichern: ein Fehler.'
+ other: ! 'Konnte %{model} nicht speichern: %{count} Fehler.'
+ helpers:
+ select:
+ prompt: Bitte wählen
+ submit:
+ create: ! '%{model} erstellen'
+ submit: ! '%{model} speichern'
+ update: ! '%{model} aktualisieren'
+ number:
+ currency:
+ format:
+ delimiter: .
+ format: ! '%n %u'
+ precision: 2
+ separator: ! ','
+ significant: false
+ strip_insignificant_zeros: false
+ unit: €
+ format:
+ delimiter: .
+ precision: 2
+ separator: ! ','
+ significant: false
+ strip_insignificant_zeros: false
+ human:
+ decimal_units:
+ format: ! '%n %u'
+ units:
+ billion:
+ one: Milliarde
+ other: Milliarden
+ million: Millionen
+ quadrillion:
+ one: Billiarde
+ other: Billiarden
+ thousand: Tausend
+ trillion: Billionen
+ unit: ''
+ format:
+ delimiter: ''
+ precision: 1
+ significant: true
+ strip_insignificant_zeros: true
+ storage_units:
+ format: ! '%n %u'
+ units:
+ byte:
+ one: Byte
+ other: Bytes
+ gb: GB
+ kb: KB
+ mb: MB
+ tb: TB
+ percentage:
+ format:
+ delimiter: ''
+ precision:
+ format:
+ delimiter: ''
+ support:
+ array:
+ last_word_connector: ! ' und '
+ two_words_connector: ! ' und '
+ words_connector: ! ', '
+ time:
+ am: vormittags
+ formats:
+ default: ! '%d.%m.%Y, %H:%M Uhr'
+ long: ! '%A, %d. %B %Y, %H:%M Uhr'
+ short: ! '%d.%m.%Y, %H:%M Uhr'
+ pm: nachmittags
+>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
diff --git a/config/routes.rb b/config/routes.rb
index 61b6b42..46911fd 100755
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
Fetsite::Application.routes.draw do
devise_for :users
@@ -106,3 +107,116 @@
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end
+=======
+Fetsite::Application.routes.draw do
+
+ resources :calendars
+
+
+ resources :calentries
+
+
+ devise_for :users
+ resources :home, :only=>[:index]
+ #get 'home',:controller=>home,:action=>:index,:as=>"home_index"
+ scope '(:locale)/admin' do
+ resources :users
+ get 'config',:controller=>:config,:action=>:index , :as => 'config'
+ get 'config/get_git_update',:controller=>:config,:action=>:get_git_update, :as=>'config_getgitupdate'
+ get 'config/get_git_update',:controller=>:config,:action=>:get_git_update
+ end
+
+ devise_for :users
+
+ resources :pages, :except => [:index] do
+ member do
+ post 'preview'
+ end
+ end
+ get 'pages', :to =>'pages#show'
+ scope '(:locale)' do
+
+ resources :studien, :only=>[:show,:new,:edit,:update,:destroy]
+ resources :modulgruppen,:only =>[:create,:index]
+
+ resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do
+ resources :modulgruppen, :path => "(:locale)/modulgruppen"
+
+ end
+ get 'studien/:id/semesteransicht', :controller=>:studien, :action=>:semesteransicht, :as=>'studium_semesteransicht'
+ resources :semesters
+ resources :moduls
+ resources :lvas
+ resources :neuigkeiten
+ get 'rubriken/verwalten', :controller=>:rubriken, :action=>:alle_verwalten, :as=>'alle_verwalten_rubrik'
+
+ resources :rubriken do
+ resources :neuigkeiten, :only=>[:new, :show]
+ end
+ put 'rubriken/(:id)/addmoderator',:controller=>:rubriken,:action=>:addmoderator
+ get 'rubriken/:id/verwalten',:controller=>:rubriken,:action=>:verwalten, :as=>'verwalten_rubrik'
+ resources :home, :only=>[:index]
+ get 'home/dev', :controller=>:home, :action=>:dev, :as=>'home_dev'
+ resources :beispiele
+
+ end
+
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
+
+ # Sample of regular route:
+ # match 'products/:id' => 'catalog#view'
+ # Keep in mind you can assign values other than :controller and :action
+
+ # Sample of named route:
+ # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
+ # This route can be invoked with purchase_url(:id => product.id)
+
+ # Sample resource route (maps HTTP verbs to controller actions automatically):
+ # resources :products
+
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
+
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
+
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', :on => :collection
+ # end
+ # end
+
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
+
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+
+ root :to => 'home#index'
+
+ # See how all your routes lay out with "rake routes"
+
+ # This is a legacy wild controller route that's not recommended for RESTful applications.
+ # Note: This route will make all actions in every controller accessible via GET requests.
+ # match ':controller(/:action(/:id))(.:format)'
+end
+>>>>>>> a5a02e065a319d162c5a280605c2c0d3c15643ca
diff --git a/db/migrate/20130805191709_create_calentries.rb b/db/migrate/20130805191709_create_calentries.rb
new file mode 100644
index 0000000..c4ece84
--- /dev/null
+++ b/db/migrate/20130805191709_create_calentries.rb
@@ -0,0 +1,12 @@
+class CreateCalentries < ActiveRecord::Migration
+ def change
+ create_table :calentries do |t|
+ t.timestamp :start
+ t.timestamp :ende
+ t.string :summary
+ t.integer :typ
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20130805191817_create_calendars.rb b/db/migrate/20130805191817_create_calendars.rb
new file mode 100644
index 0000000..bc12669
--- /dev/null
+++ b/db/migrate/20130805191817_create_calendars.rb
@@ -0,0 +1,10 @@
+class CreateCalendars < ActiveRecord::Migration
+ def change
+ create_table :calendars do |t|
+ t.string :name
+ t.boolean :public
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20130808062732_create_calendar_calentries_join_table.rb b/db/migrate/20130808062732_create_calendar_calentries_join_table.rb
new file mode 100644
index 0000000..bbf0362
--- /dev/null
+++ b/db/migrate/20130808062732_create_calendar_calentries_join_table.rb
@@ -0,0 +1,13 @@
+class CreateCalendarCalentriesJoinTable < ActiveRecord::Migration
+ def up
+ create_table :calendars_calentries, :id=>false do |t|
+ t.integer :calentry_id
+ t.integer :calendar_id
+ end
+ add_index :calendars_calentries, [:calentry_id, :calendar_id]
+ add_index :calendars_calentries, :calendar_id
+ end
+
+ def down
+ end
+end
diff --git a/db/migrate/20130810214456_add_picture_to_calendars.rb b/db/migrate/20130810214456_add_picture_to_calendars.rb
new file mode 100644
index 0000000..d1b4b44
--- /dev/null
+++ b/db/migrate/20130810214456_add_picture_to_calendars.rb
@@ -0,0 +1,5 @@
+class AddPictureToCalendars < ActiveRecord::Migration
+ def change
+ add_column :calendars, :picture, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6a96d37..b8d0781 100755
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,23 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130729085446) do
+ActiveRecord::Schema.define(:version => 20130810214456) do
+
+ create_table "attachments", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "beispiel_translations", :force => true do |t|
+ t.string "locale"
+ t.text "desc"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "beispiele_id"
+ end
+
+ add_index "beispiel_translations", ["locale"], :name => "index_beispiel_translations_on_locale"
create_table "beispiele", :force => true do |t|
t.string "name"
@@ -22,6 +38,38 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.string "beispieldatei"
end
+ create_table "calendars", :force => true do |t|
+ t.string "name"
+ t.boolean "public"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.string "picture"
+ end
+
+ create_table "calendars_calentries", :id => false, :force => true do |t|
+ t.integer "calentry_id"
+ t.integer "calendar_id"
+ end
+
+ add_index "calendars_calentries", ["calendar_id"], :name => "index_calendars_calentries_on_calendar_id"
+ add_index "calendars_calentries", ["calentry_id", "calendar_id"], :name => "index_calendars_calentries_on_calentry_id_and_calendar_id"
+
+ create_table "calentries", :force => true do |t|
+ t.datetime "start"
+ t.datetime "ende"
+ t.string "summary"
+ t.integer "typ"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "fragen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "lva_translations", :force => true do |t|
t.integer "lva_id"
t.string "locale"
@@ -50,11 +98,14 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
t.integer "modul_id"
end
- create_table "lvas_semesters", :force => true do |t|
+ create_table "lvas_semesters", :id => false, :force => true do |t|
t.integer "lva_id"
t.integer "semester_id"
end
+ add_index "lvas_semesters", ["lva_id", "semester_id"], :name => "index_lvas_semesters_on_lva_id_and_semester_id"
+ add_index "lvas_semesters", ["semester_id"], :name => "index_lvas_semesters_on_semester_id"
+
create_table "modul_translations", :force => true do |t|
t.integer "modul_id"
t.string "locale"
@@ -161,6 +212,20 @@ ActiveRecord::Schema.define(:version => 20130729085446) do
add_index "studium_translations", ["locale"], :name => "index_studium_translations_on_locale"
+ create_table "themen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "themengruppen", :force => true do |t|
+ t.string "title"
+ t.text "text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
diff --git a/spec/controllers/calendars_controller_spec.rb b/spec/controllers/calendars_controller_spec.rb
new file mode 100644
index 0000000..65fc3e7
--- /dev/null
+++ b/spec/controllers/calendars_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 CalendarsController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Calendar. As you add validations to Calendar, be sure to
+ # adjust the attributes here as well.
+ let(:valid_attributes) { { "name" => "MyString" } }
+
+ # 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
+ # CalendarsController. Be sure to keep this updated too.
+ let(:valid_session) { {} }
+
+ describe "GET index" do
+ it "assigns all calendars as @calendars" do
+ calendar = Calendar.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:calendars).should eq([calendar])
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ get :show, {:id => calendar.to_param}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new calendar as @calendar" do
+ get :new, {}, valid_session
+ assigns(:calendar).should be_a_new(Calendar)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ get :edit, {:id => calendar.to_param}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+ end
+
+ describe "POST create" do
+ describe "with valid params" do
+ it "creates a new Calendar" do
+ expect {
+ post :create, {:calendar => valid_attributes}, valid_session
+ }.to change(Calendar, :count).by(1)
+ end
+
+ it "assigns a newly created calendar as @calendar" do
+ post :create, {:calendar => valid_attributes}, valid_session
+ assigns(:calendar).should be_a(Calendar)
+ assigns(:calendar).should be_persisted
+ end
+
+ it "redirects to the created calendar" do
+ post :create, {:calendar => valid_attributes}, valid_session
+ response.should redirect_to(Calendar.last)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved calendar as @calendar" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ post :create, {:calendar => { "name" => "invalid value" }}, valid_session
+ assigns(:calendar).should be_a_new(Calendar)
+ end
+
+ it "re-renders the 'new' template" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ post :create, {:calendar => { "name" => "invalid value" }}, valid_session
+ response.should render_template("new")
+ end
+ end
+ end
+
+ describe "PUT update" do
+ describe "with valid params" do
+ it "updates the requested calendar" do
+ calendar = Calendar.create! valid_attributes
+ # Assuming there are no other calendars in the database, this
+ # specifies that the Calendar created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ Calendar.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" })
+ put :update, {:id => calendar.to_param, :calendar => { "name" => "MyString" }}, valid_session
+ end
+
+ it "assigns the requested calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+
+ it "redirects to the calendar" do
+ calendar = Calendar.create! valid_attributes
+ put :update, {:id => calendar.to_param, :calendar => valid_attributes}, valid_session
+ response.should redirect_to(calendar)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns the calendar as @calendar" do
+ calendar = Calendar.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session
+ assigns(:calendar).should eq(calendar)
+ end
+
+ it "re-renders the 'edit' template" do
+ calendar = Calendar.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calendar.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calendar.to_param, :calendar => { "name" => "invalid value" }}, valid_session
+ response.should render_template("edit")
+ end
+ end
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested calendar" do
+ calendar = Calendar.create! valid_attributes
+ expect {
+ delete :destroy, {:id => calendar.to_param}, valid_session
+ }.to change(Calendar, :count).by(-1)
+ end
+
+ it "redirects to the calendars list" do
+ calendar = Calendar.create! valid_attributes
+ delete :destroy, {:id => calendar.to_param}, valid_session
+ response.should redirect_to(calendars_url)
+ end
+ end
+
+end
diff --git a/spec/controllers/calentries_controller_spec.rb b/spec/controllers/calentries_controller_spec.rb
new file mode 100644
index 0000000..63605e7
--- /dev/null
+++ b/spec/controllers/calentries_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 CalentriesController do
+
+ # This should return the minimal set of attributes required to create a valid
+ # Calentry. As you add validations to Calentry, be sure to
+ # adjust the attributes here as well.
+ let(:valid_attributes) { { "start" => "2013-08-05 21:17:10" } }
+
+ # 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
+ # CalentriesController. Be sure to keep this updated too.
+ let(:valid_session) { {} }
+
+ describe "GET index" do
+ it "assigns all calentries as @calentries" do
+ calentry = Calentry.create! valid_attributes
+ get :index, {}, valid_session
+ assigns(:calentries).should eq([calentry])
+ end
+ end
+
+ describe "GET show" do
+ it "assigns the requested calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ get :show, {:id => calentry.to_param}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+ end
+
+ describe "GET new" do
+ it "assigns a new calentry as @calentry" do
+ get :new, {}, valid_session
+ assigns(:calentry).should be_a_new(Calentry)
+ end
+ end
+
+ describe "GET edit" do
+ it "assigns the requested calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ get :edit, {:id => calentry.to_param}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+ end
+
+ describe "POST create" do
+ describe "with valid params" do
+ it "creates a new Calentry" do
+ expect {
+ post :create, {:calentry => valid_attributes}, valid_session
+ }.to change(Calentry, :count).by(1)
+ end
+
+ it "assigns a newly created calentry as @calentry" do
+ post :create, {:calentry => valid_attributes}, valid_session
+ assigns(:calentry).should be_a(Calentry)
+ assigns(:calentry).should be_persisted
+ end
+
+ it "redirects to the created calentry" do
+ post :create, {:calentry => valid_attributes}, valid_session
+ response.should redirect_to(Calentry.last)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns a newly created but unsaved calentry as @calentry" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ post :create, {:calentry => { "start" => "invalid value" }}, valid_session
+ assigns(:calentry).should be_a_new(Calentry)
+ end
+
+ it "re-renders the 'new' template" do
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ post :create, {:calentry => { "start" => "invalid value" }}, valid_session
+ response.should render_template("new")
+ end
+ end
+ end
+
+ describe "PUT update" do
+ describe "with valid params" do
+ it "updates the requested calentry" do
+ calentry = Calentry.create! valid_attributes
+ # Assuming there are no other calentries in the database, this
+ # specifies that the Calentry created on the previous line
+ # receives the :update_attributes message with whatever params are
+ # submitted in the request.
+ Calentry.any_instance.should_receive(:update_attributes).with({ "start" => "2013-08-05 21:17:10" })
+ put :update, {:id => calentry.to_param, :calentry => { "start" => "2013-08-05 21:17:10" }}, valid_session
+ end
+
+ it "assigns the requested calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+
+ it "redirects to the calentry" do
+ calentry = Calentry.create! valid_attributes
+ put :update, {:id => calentry.to_param, :calentry => valid_attributes}, valid_session
+ response.should redirect_to(calentry)
+ end
+ end
+
+ describe "with invalid params" do
+ it "assigns the calentry as @calentry" do
+ calentry = Calentry.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session
+ assigns(:calentry).should eq(calentry)
+ end
+
+ it "re-renders the 'edit' template" do
+ calentry = Calentry.create! valid_attributes
+ # Trigger the behavior that occurs when invalid params are submitted
+ Calentry.any_instance.stub(:save).and_return(false)
+ put :update, {:id => calentry.to_param, :calentry => { "start" => "invalid value" }}, valid_session
+ response.should render_template("edit")
+ end
+ end
+ end
+
+ describe "DELETE destroy" do
+ it "destroys the requested calentry" do
+ calentry = Calentry.create! valid_attributes
+ expect {
+ delete :destroy, {:id => calentry.to_param}, valid_session
+ }.to change(Calentry, :count).by(-1)
+ end
+
+ it "redirects to the calentries list" do
+ calentry = Calentry.create! valid_attributes
+ delete :destroy, {:id => calentry.to_param}, valid_session
+ response.should redirect_to(calentries_url)
+ end
+ end
+
+end
diff --git a/spec/factories/calendars.rb b/spec/factories/calendars.rb
new file mode 100644
index 0000000..f5cafa0
--- /dev/null
+++ b/spec/factories/calendars.rb
@@ -0,0 +1,8 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :calendar do
+ name "MyString"
+ public false
+ end
+end
diff --git a/spec/factories/calentries.rb b/spec/factories/calentries.rb
new file mode 100644
index 0000000..3e2d9b9
--- /dev/null
+++ b/spec/factories/calentries.rb
@@ -0,0 +1,10 @@
+# Read about factories at https://github.com/thoughtbot/factory_girl
+
+FactoryGirl.define do
+ factory :calentry do
+ start "2013-08-05 21:17:10"
+ ende "2013-08-05 21:17:10"
+ summary "MyString"
+ typ 1
+ end
+end
diff --git a/spec/helpers/calendars_helper_spec.rb b/spec/helpers/calendars_helper_spec.rb
new file mode 100644
index 0000000..67df5e7
--- /dev/null
+++ b/spec/helpers/calendars_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the CalendarsHelper. For example:
+#
+# describe CalendarsHelper 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 CalendarsHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/helpers/calentries_helper_spec.rb b/spec/helpers/calentries_helper_spec.rb
new file mode 100644
index 0000000..b496788
--- /dev/null
+++ b/spec/helpers/calentries_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the CalentriesHelper. For example:
+#
+# describe CalentriesHelper 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 CalentriesHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb
new file mode 100644
index 0000000..f4477ee
--- /dev/null
+++ b/spec/models/calendar_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Calendar do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/calentry_spec.rb b/spec/models/calentry_spec.rb
new file mode 100644
index 0000000..02e654e
--- /dev/null
+++ b/spec/models/calentry_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe Calentry do
+ it "should be valid with full data" do
+ e = FactoryGirl.build(:calentry)
+ c = FactoryGirl.create(:calendar)
+ e.calendars<
nil)
+ c=FactoryGirl.create(:calendar)
+ e.calendars< "1")
+ end
+
+ it "routes to #edit" do
+ get("/calendars/1/edit").should route_to("calendars#edit", :id => "1")
+ end
+
+ it "routes to #create" do
+ post("/calendars").should route_to("calendars#create")
+ end
+
+ it "routes to #update" do
+ put("/calendars/1").should route_to("calendars#update", :id => "1")
+ end
+
+ it "routes to #destroy" do
+ delete("/calendars/1").should route_to("calendars#destroy", :id => "1")
+ end
+
+ end
+end
diff --git a/spec/routing/calentries_routing_spec.rb b/spec/routing/calentries_routing_spec.rb
new file mode 100644
index 0000000..214c524
--- /dev/null
+++ b/spec/routing/calentries_routing_spec.rb
@@ -0,0 +1,35 @@
+require "spec_helper"
+
+describe CalentriesController do
+ describe "routing" do
+
+ it "routes to #index" do
+ get("/calentries").should route_to("calentries#index")
+ end
+
+ it "routes to #new" do
+ get("/calentries/new").should route_to("calentries#new")
+ end
+
+ it "routes to #show" do
+ get("/calentries/1").should route_to("calentries#show", :id => "1")
+ end
+
+ it "routes to #edit" do
+ get("/calentries/1/edit").should route_to("calentries#edit", :id => "1")
+ end
+
+ it "routes to #create" do
+ post("/calentries").should route_to("calentries#create")
+ end
+
+ it "routes to #update" do
+ put("/calentries/1").should route_to("calentries#update", :id => "1")
+ end
+
+ it "routes to #destroy" do
+ delete("/calentries/1").should route_to("calentries#destroy", :id => "1")
+ end
+
+ end
+end
diff --git a/spec/views/calendars/edit.html.erb_spec.rb b/spec/views/calendars/edit.html.erb_spec.rb
new file mode 100644
index 0000000..1332e40
--- /dev/null
+++ b/spec/views/calendars/edit.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calendars/edit" do
+ before(:each) do
+ @calendar = assign(:calendar, stub_model(Calendar,
+ :name => "MyString",
+ :public => false
+ ))
+ end
+
+ it "renders the edit calendar form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calendar_path(@calendar), "post" do
+ assert_select "input#calendar_name[name=?]", "calendar[name]"
+ assert_select "input#calendar_public[name=?]", "calendar[public]"
+ end
+ end
+end
diff --git a/spec/views/calendars/index.html.erb_spec.rb b/spec/views/calendars/index.html.erb_spec.rb
new file mode 100644
index 0000000..2d35f2d
--- /dev/null
+++ b/spec/views/calendars/index.html.erb_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe "calendars/index" do
+ before(:each) do
+ assign(:calendars, [
+ stub_model(Calendar,
+ :name => "Name",
+ :public => false
+ ),
+ stub_model(Calendar,
+ :name => "Name",
+ :public => false
+ )
+ ])
+ end
+
+ it "renders a list of calendars" do
+ render
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "tr>td", :text => "Name".to_s, :count => 2
+ assert_select "tr>td", :text => false.to_s, :count => 2
+ end
+end
diff --git a/spec/views/calendars/new.html.erb_spec.rb b/spec/views/calendars/new.html.erb_spec.rb
new file mode 100644
index 0000000..026c0fd
--- /dev/null
+++ b/spec/views/calendars/new.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calendars/new" do
+ before(:each) do
+ assign(:calendar, stub_model(Calendar,
+ :name => "MyString",
+ :public => false
+ ).as_new_record)
+ end
+
+ it "renders new calendar form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calendars_path, "post" do
+ assert_select "input#calendar_name[name=?]", "calendar[name]"
+ assert_select "input#calendar_public[name=?]", "calendar[public]"
+ end
+ end
+end
diff --git a/spec/views/calendars/show.html.erb_spec.rb b/spec/views/calendars/show.html.erb_spec.rb
new file mode 100644
index 0000000..53cecc6
--- /dev/null
+++ b/spec/views/calendars/show.html.erb_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe "calendars/show" do
+ before(:each) do
+ @calendar = assign(:calendar, stub_model(Calendar,
+ :name => "Name",
+ :public => false
+ ))
+ end
+
+ it "renders attributes in " do
+ render
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ rendered.should match(/Name/)
+ rendered.should match(/false/)
+ end
+end
diff --git a/spec/views/calentries/edit.html.erb_spec.rb b/spec/views/calentries/edit.html.erb_spec.rb
new file mode 100644
index 0000000..72b00fd
--- /dev/null
+++ b/spec/views/calentries/edit.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calentries/edit" do
+ before(:each) do
+ @calentry = assign(:calentry, stub_model(Calentry,
+ :summary => "MyString",
+ :typ => 1
+ ))
+ end
+
+ it "renders the edit calentry form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calentry_path(@calentry), "post" do
+ assert_select "input#calentry_summary[name=?]", "calentry[summary]"
+ assert_select "input#calentry_typ[name=?]", "calentry[typ]"
+ end
+ end
+end
diff --git a/spec/views/calentries/index.html.erb_spec.rb b/spec/views/calentries/index.html.erb_spec.rb
new file mode 100644
index 0000000..cd488a9
--- /dev/null
+++ b/spec/views/calentries/index.html.erb_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe "calentries/index" do
+ before(:each) do
+ assign(:calentries, [
+ stub_model(Calentry,
+ :summary => "Summary",
+ :typ => 1
+ ),
+ stub_model(Calentry,
+ :summary => "Summary",
+ :typ => 1
+ )
+ ])
+ end
+
+ it "renders a list of calentries" do
+ render
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "tr>td", :text => "Summary".to_s, :count => 2
+ assert_select "tr>td", :text => 1.to_s, :count => 2
+ end
+end
diff --git a/spec/views/calentries/new.html.erb_spec.rb b/spec/views/calentries/new.html.erb_spec.rb
new file mode 100644
index 0000000..32e477b
--- /dev/null
+++ b/spec/views/calentries/new.html.erb_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+describe "calentries/new" do
+ before(:each) do
+ assign(:calentry, stub_model(Calentry,
+ :summary => "MyString",
+ :typ => 1
+ ).as_new_record)
+ end
+
+ it "renders new calentry form" do
+ render
+
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ assert_select "form[action=?][method=?]", calentries_path, "post" do
+ assert_select "input#calentry_summary[name=?]", "calentry[summary]"
+ assert_select "input#calentry_typ[name=?]", "calentry[typ]"
+ end
+ end
+end
diff --git a/spec/views/calentries/show.html.erb_spec.rb b/spec/views/calentries/show.html.erb_spec.rb
new file mode 100644
index 0000000..588baec
--- /dev/null
+++ b/spec/views/calentries/show.html.erb_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+describe "calentries/show" do
+ before(:each) do
+ @calentry = assign(:calentry, stub_model(Calentry,
+ :summary => "Summary",
+ :typ => 1
+ ))
+ end
+
+ it "renders attributes in
" do
+ render
+ # Run the generator again with the --webrat flag if you want to use webrat matchers
+ rendered.should match(/Summary/)
+ rendered.should match(/1/)
+ end
+end