diff --git a/app/assets/javascripts/attachments.js.coffee b/app/assets/javascripts/attachments.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/attachments.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/fragen.js.coffee b/app/assets/javascripts/fragen.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/fragen.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/themen.js.coffee b/app/assets/javascripts/themen.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/themen.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/javascripts/themengruppen.js.coffee b/app/assets/javascripts/themengruppen.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/themengruppen.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/attachments.css.scss b/app/assets/stylesheets/attachments.css.scss new file mode 100644 index 0000000..544b428 --- /dev/null +++ b/app/assets/stylesheets/attachments.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the attachments controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/fragen.css.scss b/app/assets/stylesheets/fragen.css.scss new file mode 100644 index 0000000..cb8ec54 --- /dev/null +++ b/app/assets/stylesheets/fragen.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the fragen controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/themen.css.scss b/app/assets/stylesheets/themen.css.scss new file mode 100644 index 0000000..daecefa --- /dev/null +++ b/app/assets/stylesheets/themen.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the themen controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/assets/stylesheets/themengruppen.css.scss b/app/assets/stylesheets/themengruppen.css.scss new file mode 100644 index 0000000..074b60a --- /dev/null +++ b/app/assets/stylesheets/themengruppen.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the themengruppen controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb new file mode 100644 index 0000000..aa8ec7c --- /dev/null +++ b/app/controllers/attachments_controller.rb @@ -0,0 +1,83 @@ +class AttachmentsController < ApplicationController + # GET /attachments + # GET /attachments.json + def index + @attachments = Attachment.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @attachments } + end + end + + # GET /attachments/1 + # GET /attachments/1.json + def show + @attachment = Attachment.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @attachment } + end + end + + # GET /attachments/new + # GET /attachments/new.json + def new + @attachment = Attachment.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @attachment } + end + end + + # GET /attachments/1/edit + def edit + @attachment = Attachment.find(params[:id]) + end + + # POST /attachments + # POST /attachments.json + def create + @attachment = Attachment.new(params[:attachment]) + + respond_to do |format| + if @attachment.save + format.html { redirect_to @attachment, notice: 'Attachment was successfully created.' } + format.json { render json: @attachment, status: :created, location: @attachment } + else + format.html { render action: "new" } + format.json { render json: @attachment.errors, status: :unprocessable_entity } + end + end + end + + # PUT /attachments/1 + # PUT /attachments/1.json + def update + @attachment = Attachment.find(params[:id]) + + respond_to do |format| + if @attachment.update_attributes(params[:attachment]) + format.html { redirect_to @attachment, notice: 'Attachment was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @attachment.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /attachments/1 + # DELETE /attachments/1.json + def destroy + @attachment = Attachment.find(params[:id]) + @attachment.destroy + + respond_to do |format| + format.html { redirect_to attachments_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/fragen_controller.rb b/app/controllers/fragen_controller.rb new file mode 100644 index 0000000..7f3ac25 --- /dev/null +++ b/app/controllers/fragen_controller.rb @@ -0,0 +1,83 @@ +class FragenController < ApplicationController + # GET /fragen + # GET /fragen.json + def index + @fragen = Frage.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @fragen } + end + end + + # GET /fragen/1 + # GET /fragen/1.json + def show + @frage = Frage.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @frage } + end + end + + # GET /fragen/new + # GET /fragen/new.json + def new + @frage = Frage.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @frage } + end + end + + # GET /fragen/1/edit + def edit + @frage = Frage.find(params[:id]) + end + + # POST /fragen + # POST /fragen.json + def create + @frage = Frage.new(params[:frage]) + + respond_to do |format| + if @frage.save + format.html { redirect_to @frage, notice: 'Frage was successfully created.' } + format.json { render json: @frage, status: :created, location: @frage } + else + format.html { render action: "new" } + format.json { render json: @frage.errors, status: :unprocessable_entity } + end + end + end + + # PUT /fragen/1 + # PUT /fragen/1.json + def update + @frage = Frage.find(params[:id]) + + respond_to do |format| + if @frage.update_attributes(params[:frage]) + format.html { redirect_to @frage, notice: 'Frage was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @frage.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /fragen/1 + # DELETE /fragen/1.json + def destroy + @frage = Frage.find(params[:id]) + @frage.destroy + + respond_to do |format| + format.html { redirect_to fragen_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/themen_controller.rb b/app/controllers/themen_controller.rb new file mode 100644 index 0000000..bb9235e --- /dev/null +++ b/app/controllers/themen_controller.rb @@ -0,0 +1,83 @@ +class ThemenController < ApplicationController + # GET /themen + # GET /themen.json + def index + @themen = Thema.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @themen } + end + end + + # GET /themen/1 + # GET /themen/1.json + def show + @thema = Thema.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @thema } + end + end + + # GET /themen/new + # GET /themen/new.json + def new + @thema = Thema.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @thema } + end + end + + # GET /themen/1/edit + def edit + @thema = Thema.find(params[:id]) + end + + # POST /themen + # POST /themen.json + def create + @thema = Thema.new(params[:thema]) + + respond_to do |format| + if @thema.save + format.html { redirect_to @thema, notice: 'Thema was successfully created.' } + format.json { render json: @thema, status: :created, location: @thema } + else + format.html { render action: "new" } + format.json { render json: @thema.errors, status: :unprocessable_entity } + end + end + end + + # PUT /themen/1 + # PUT /themen/1.json + def update + @thema = Thema.find(params[:id]) + + respond_to do |format| + if @thema.update_attributes(params[:thema]) + format.html { redirect_to @thema, notice: 'Thema was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @thema.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /themen/1 + # DELETE /themen/1.json + def destroy + @thema = Thema.find(params[:id]) + @thema.destroy + + respond_to do |format| + format.html { redirect_to themen_url } + format.json { head :no_content } + end + end +end diff --git a/app/controllers/themengruppen_controller.rb b/app/controllers/themengruppen_controller.rb new file mode 100644 index 0000000..46fa1d4 --- /dev/null +++ b/app/controllers/themengruppen_controller.rb @@ -0,0 +1,83 @@ +class ThemengruppenController < ApplicationController + # GET /themengruppen + # GET /themengruppen.json + def index + @themengruppen = Themengruppe.all + + respond_to do |format| + format.html # index.html.erb + format.json { render json: @themengruppen } + end + end + + # GET /themengruppen/1 + # GET /themengruppen/1.json + def show + @themagruppen = Themengruppe.find(params[:id]) + + respond_to do |format| + format.html # show.html.erb + format.json { render json: @themagruppen } + end + end + + # GET /themengruppen/new + # GET /themengruppen/new.json + def new + @themagruppen = Themengruppe.new + + respond_to do |format| + format.html # new.html.erb + format.json { render json: @themagruppen } + end + end + + # GET /themengruppen/1/edit + def edit + @themagruppen = Themengruppe.find(params[:id]) + end + + # POST /themengruppen + # POST /themengruppen.json + def create + @themagruppen = Themengruppe.new(params[:themagruppen]) + + respond_to do |format| + if @themagruppen.save + format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully created.' } + format.json { render json: @themagruppen, status: :created, location: @themagruppen } + else + format.html { render action: "new" } + format.json { render json: @themagruppen.errors, status: :unprocessable_entity } + end + end + end + + # PUT /themengruppen/1 + # PUT /themengruppen/1.json + def update + @themagruppen = Themengruppe.find(params[:id]) + + respond_to do |format| + if @themagruppen.update_attributes(params[:themagruppen]) + format.html { redirect_to @themagruppen, notice: 'Themengruppe was successfully updated.' } + format.json { head :no_content } + else + format.html { render action: "edit" } + format.json { render json: @themagruppen.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /themengruppen/1 + # DELETE /themengruppen/1.json + def destroy + @themagruppen = Themengruppe.find(params[:id]) + @themagruppen.destroy + + respond_to do |format| + format.html { redirect_to themengruppen_url } + format.json { head :no_content } + end + end +end diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb new file mode 100644 index 0000000..3c961c9 --- /dev/null +++ b/app/helpers/attachments_helper.rb @@ -0,0 +1,2 @@ +module AttachmentsHelper +end diff --git a/app/helpers/fragen_helper.rb b/app/helpers/fragen_helper.rb new file mode 100644 index 0000000..062e2a8 --- /dev/null +++ b/app/helpers/fragen_helper.rb @@ -0,0 +1,2 @@ +module FragenHelper +end diff --git a/app/helpers/themen_helper.rb b/app/helpers/themen_helper.rb new file mode 100644 index 0000000..4a30030 --- /dev/null +++ b/app/helpers/themen_helper.rb @@ -0,0 +1,2 @@ +module ThemenHelper +end diff --git a/app/helpers/themengruppen_helper.rb b/app/helpers/themengruppen_helper.rb new file mode 100644 index 0000000..c9eab59 --- /dev/null +++ b/app/helpers/themengruppen_helper.rb @@ -0,0 +1,2 @@ +module ThemengruppenHelper +end diff --git a/app/models/attachment.rb b/app/models/attachment.rb new file mode 100644 index 0000000..fe3d597 --- /dev/null +++ b/app/models/attachment.rb @@ -0,0 +1,8 @@ +class Attachment < ActiveRecord::Base + has_paper_trail + attr_accessible :name + belongs_to :thema + + validates :thema, :presence => true + validates :name, :presence => true +end diff --git a/app/models/attachment.rb~ b/app/models/attachment.rb~ new file mode 100644 index 0000000..f433a3b --- /dev/null +++ b/app/models/attachment.rb~ @@ -0,0 +1,4 @@ +class Attachment < ActiveRecord::Base + attr_accessible :name + belongs_to :thema +end diff --git a/app/models/frage.rb b/app/models/frage.rb new file mode 100644 index 0000000..8a47df4 --- /dev/null +++ b/app/models/frage.rb @@ -0,0 +1,10 @@ +class Frage < ActiveRecord::Base + has_paper_trail + attr_accessible :text, :title + belongs_to :thema + + validates :thema, :presence => true + validates :title, :prescece => true + + translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true +end diff --git a/app/models/frage.rb~ b/app/models/frage.rb~ new file mode 100644 index 0000000..27bc8c4 --- /dev/null +++ b/app/models/frage.rb~ @@ -0,0 +1,3 @@ +class Frage < ActiveRecord::Base + attr_accessible :text, :title +end diff --git a/app/models/lva.rb~ b/app/models/lva.rb~ new file mode 100755 index 0000000..f4668a9 --- /dev/null +++ b/app/models/lva.rb~ @@ -0,0 +1,52 @@ +## +# Author:: Andreas Stephanides +# License:: GPL +# Dieses Model repräsentiert eine LVA. Die notwendigen Informationen können mit TISS (dem Online System der TU Wien) synchronisiert werden + +class Lva < ActiveRecord::Base + has_paper_trail # Versionsver + attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids + has_and_belongs_to_many :moduls + has_and_belongs_to_many :semester + translates :desc, :fallbacks_for_empty_translations => true + has_many :beispiele , :class_name => "Beispiel" + after_initialize :load_tissdata +## +# Lade den Hash aus TISS und speichere diesen in @hash +# + def hash + url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W" + @hash=Hash.from_xml(open(url).read) + end + + def objective + @hash["course"]["objective"][I18n.locale.to_s] + end + def techingContent + @hash["course"]["teachingContent"][I18n.locale.to_s] + end + def person +@person +end + +private + +def load_tissdata + url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W" + begin + @hash=Hash.from_xml(open(url).read)["tuvienna"] + @person=[] + if @hash["course"]["lecturers"]["oid"].is_a? String + @person = @hash["course"]["lecturers"]["oid"] + else + @hash["course"]["lecturers"]["oid"].each do |pid| + @person << Hash.from_xml(open("https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/" + pid.to_s + ".xml").read)["tuvienna"]["person"] + end + end + rescue OpenURI::HTTPError => e + end +end + + + +end diff --git a/app/models/modulgruppe.rb~ b/app/models/modulgruppe.rb~ new file mode 100755 index 0000000..2c06647 --- /dev/null +++ b/app/models/modulgruppe.rb~ @@ -0,0 +1,28 @@ +# == Schema Information +# +# Table name: modulgruppen +# +# id :integer not null, primary key +# typ :string(255) +# phase :integer +# name :string(255) +# desc :text +# studium_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# + +class Modulgruppe < ActiveRecord::Base + attr_accessible :name, :phase, :typ,:desc, :studium_id + belongs_to :studium, :foreign_key => "studium_id" + has_and_belongs_to_many :moduls + + resourcify + + validates :studium_id, :presence => true # Bei der Abfrage ist student_id entscheidend + #validates :studium, :presence => true # Wird gesetzt, um das richtige Feld zu melden bei Fehlern + validates :name, :uniqueness =>{:scope => :studium_id}, :presence=>true # Pro Studium darf ein Name nur einmal vorkommen + validates :phase, :inclusion => {:in => [1, 2, 3, 4]} + validates :typ, :inclusion => {:in => ["Pflicht","Vertiefungspflicht","Wahl"] } + translates :desc, :versioning =>true,:fallbacks_for_empty_translations => true +end diff --git a/app/models/thema.rb b/app/models/thema.rb new file mode 100644 index 0000000..71edf91 --- /dev/null +++ b/app/models/thema.rb @@ -0,0 +1,10 @@ +class Thema < ActiveRecord::Base + has_paper_trail + attr_accessible :text, :title + has_many :fragen + has_many :attachments + belongs_to :themengruppe + + validates :themengruppe, :presence => true + validates :title, :presence => true +end diff --git a/app/models/thema.rb~ b/app/models/thema.rb~ new file mode 100644 index 0000000..fd3bc93 --- /dev/null +++ b/app/models/thema.rb~ @@ -0,0 +1,5 @@ +class Thema < ActiveRecord::Base + attr_accessible :text, :title + has_many :fragen + belongs_to :themengruppe +end diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb new file mode 100644 index 0000000..95cf797 --- /dev/null +++ b/app/models/themengruppe.rb @@ -0,0 +1,8 @@ +class Themengruppe < ActiveRecord::Base + has_paper_trail + attr_accessible :text, :title + has_many :themen + has_many :fragen, through: :themen + + validates :title, :presence => true +end diff --git a/app/models/themengruppe.rb~ b/app/models/themengruppe.rb~ new file mode 100644 index 0000000..c96a7c5 --- /dev/null +++ b/app/models/themengruppe.rb~ @@ -0,0 +1,3 @@ +class Themengruppe < ActiveRecord::Base + attr_accessible :text, :title +end diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb new file mode 100644 index 0000000..75bc493 --- /dev/null +++ b/app/views/attachments/_form.html.erb @@ -0,0 +1,9 @@ +<%= semantic_form_for @attachment do |f| %> + <%= f.inputs do %> + <%= f.input :name %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/attachments/edit.html.erb b/app/views/attachments/edit.html.erb new file mode 100644 index 0000000..b2a2cfe --- /dev/null +++ b/app/views/attachments/edit.html.erb @@ -0,0 +1,6 @@ +
| Name | ++ | + | + |
|---|---|---|---|
| <%= attachment.name %> | +<%= link_to 'Show', attachment %> | +<%= link_to 'Edit', edit_attachment_path(attachment) %> | +<%= link_to 'Destroy', attachment, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Name: + <%= @attachment.name %> +
+ + +<%= link_to 'Edit', edit_attachment_path(@attachment) %> | +<%= link_to 'Back', attachments_path %> diff --git a/app/views/fragen/_form.html.erb b/app/views/fragen/_form.html.erb new file mode 100644 index 0000000..bd59b87 --- /dev/null +++ b/app/views/fragen/_form.html.erb @@ -0,0 +1,10 @@ +<%= semantic_form_for @frage do |f| %> + <%= f.inputs do %> + <%= f.input :title %> + <%= f.input :text %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/fragen/edit.html.erb b/app/views/fragen/edit.html.erb new file mode 100644 index 0000000..e754df9 --- /dev/null +++ b/app/views/fragen/edit.html.erb @@ -0,0 +1,6 @@ +| Title | +Text | ++ | + | + |
|---|---|---|---|---|
| <%= frage.title %> | +<%= frage.text %> | +<%= link_to 'Show', frage %> | +<%= link_to 'Edit', edit_frage_path(frage) %> | +<%= link_to 'Destroy', frage, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Title: + <%= @frage.title %> +
+ ++ Text: + <%= @frage.text %> +
+ + +<%= link_to 'Edit', edit_frage_path(@frage) %> | +<%= link_to 'Back', fragen_path %> diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb new file mode 100644 index 0000000..060b29b --- /dev/null +++ b/app/views/themen/_form.html.erb @@ -0,0 +1,10 @@ +<%= semantic_form_for @thema do |f| %> + <%= f.inputs do %> + <%= f.input :title %> + <%= f.input :text %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/themen/edit.html.erb b/app/views/themen/edit.html.erb new file mode 100644 index 0000000..9230c28 --- /dev/null +++ b/app/views/themen/edit.html.erb @@ -0,0 +1,6 @@ +| Title | +Text | ++ | + | + |
|---|---|---|---|---|
| <%= thema.title %> | +<%= thema.text %> | +<%= link_to 'Show', thema %> | +<%= link_to 'Edit', edit_thema_path(thema) %> | +<%= link_to 'Destroy', thema, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Title: + <%= @thema.title %> +
+ ++ Text: + <%= @thema.text %> +
+ + +<%= link_to 'Edit', edit_thema_path(@thema) %> | +<%= link_to 'Back', themen_path %> diff --git a/app/views/themengruppen/_form.html.erb b/app/views/themengruppen/_form.html.erb new file mode 100644 index 0000000..c81d3ff --- /dev/null +++ b/app/views/themengruppen/_form.html.erb @@ -0,0 +1,10 @@ +<%= semantic_form_for @themengruppe do |f| %> + <%= f.inputs do %> + <%= f.input :title %> + <%= f.input :text %> + <% end %> + + <%= f.actions do %> + <%= f.action :submit, :as => :input %> + <% end %> +<% end %> diff --git a/app/views/themengruppen/edit.html.erb b/app/views/themengruppen/edit.html.erb new file mode 100644 index 0000000..8247722 --- /dev/null +++ b/app/views/themengruppen/edit.html.erb @@ -0,0 +1,6 @@ +| Title | +Text | ++ | + | + |
|---|---|---|---|---|
| <%= themagruppen.title %> | +<%= themagruppen.text %> | +<%= link_to 'Show', themagruppen %> | +<%= link_to 'Edit', edit_themagruppen_path(themagruppen) %> | +<%= link_to 'Destroy', themagruppen, method: :delete, data: { confirm: 'Are you sure?' } %> | +
<%= notice %>
+ ++ Title: + <%= @themagruppen.title %> +
+ ++ Text: + <%= @themagruppen.text %> +
+ + +<%= link_to 'Edit', edit_themagruppen_path(@themagruppen) %> | +<%= link_to 'Back', themengruppen_path %> diff --git a/config/environments/development.rb~ b/config/environments/development.rb~ new file mode 100644 index 0000000..583fc8b --- /dev/null +++ b/config/environments/development.rb~ @@ -0,0 +1,37 @@ +Fetsite::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false + + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false +config.action_mailer.default_url_options = { :host => 'glonass.htu.tuwien.ac.at' } + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Raise exception on mass assignment protection for Active Record models + config.active_record.mass_assignment_sanitizer = :strict + + # Log the query plan for queries taking more than this (works + # with SQLite, MySQL, and PostgreSQL) + config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Do not compress assets + config.assets.compress = false + + # Expands the lines which load the assets + config.assets.debug = true +end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 33683aa..f8522e4 100755 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -25,4 +25,10 @@ inflect.plural 'rubrik', 'rubriken' inflect.singular 'rubriken', 'rubrik' inflect.plural 'beispiel', 'beispiele' inflect.singular 'beispiele', 'beispiel' +inflect.plural 'themengruppe', 'themengruppen' +inflect.singular 'themengruppen', 'themengruppe' +inflect.plural 'thema', 'themen' +inflect.singular 'themen', 'thema' +inflect.plural 'frage', 'fragen' +inflect.singular 'fragen', 'frage' end diff --git a/config/initializers/inflections.rb~ b/config/initializers/inflections.rb~ new file mode 100755 index 0000000..da3eb47 --- /dev/null +++ b/config/initializers/inflections.rb~ @@ -0,0 +1,35 @@ +# Be sure to restart your server when you modify this file. + +# Add new inflection rules using the following format +# (all these examples are active by default): +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.plural /^(ox)$/i, '\1en' +# inflect.singular /^(ox)en/i, '\1' +# inflect.irregular 'person', 'people' +# inflect.uncountable %w( fish sheep ) +# end +# +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections do |inflect| +# inflect.acronym 'RESTful' +# end +ActiveSupport::Inflector.inflections do |inflect| +inflect.plural 'studium', 'studien' +inflect.singular 'studien', 'studium' +inflect.plural 'neuigkeit', 'neuigkeiten' +inflect.singular 'neuigkeiten', 'neuigkeit' +inflect.plural 'modulgruppe', 'modulgruppen' +inflect.singular 'modulgruppen', 'modulgruppe' +inflect.irregular 'modulgruppe', 'modulgruppen' +inflect.plural 'rubrik', 'rubriken' +inflect.singular 'rubriken', 'rubrik' +inflect.plural 'beispiel', 'beispiele' +inflect.singular 'beispiele', 'beispiel' +inflect.plural 'themengruppe', 'themengruppen' +inflect.singular 'themengruppen', 'themengruppe' +inflect.plural 'thema', 'themen' +inflect.singular 'themen', 'thema' +inflect.plural 'frage', 'fragen' +inflect.singular 'fragen', 'frage' + +end diff --git a/config/routes.rb b/config/routes.rb index 2603420..fea68e1 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,17 @@ Fetsite::Application.routes.draw do + resources :fragen + + + resources :attachments + + + resources :themen + + + resources :themengruppen + + devise_for :users resources :home, :only=>[:index] #get 'home',:controller=>home,:action=>:index,:as=>"home_index" diff --git a/db/migrate/20130729085446_create_lva_semester_join_table.rb~ b/db/migrate/20130729085446_create_lva_semester_join_table.rb~ new file mode 100644 index 0000000..c4f8ea4 --- /dev/null +++ b/db/migrate/20130729085446_create_lva_semester_join_table.rb~ @@ -0,0 +1,21 @@ +class CreateLvaSemesterJoinTable < ActiveRecord::Migration + def self.up + create_table :lvas_semesters, :id=>false do |t| + t.integer :lva_id + t.integer :semester_id + end + add_index :lva_semesters, [:lva_id, :semester_id] + add_index :lva_semesters, :semester_id + end + def change + create_table :lvas_semesters, :id=>false do |t| + t.integer :lva_id + t.integer :semester_id + end + add_index :lva_semesters, [:lva_id, :semester_id] + add_index :lva_semesters, :semester_id + end + def self.down + drop_table :lva_semesters + end +end diff --git a/db/migrate/20130805143616_create_themengruppen.rb b/db/migrate/20130805143616_create_themengruppen.rb new file mode 100644 index 0000000..d4a737e --- /dev/null +++ b/db/migrate/20130805143616_create_themengruppen.rb @@ -0,0 +1,10 @@ +class CreateThemengruppen < ActiveRecord::Migration + def change + create_table :themengruppen do |t| + t.string :title + t.text :text + + t.timestamps + end + end +end diff --git a/db/migrate/20130805143719_create_themen.rb b/db/migrate/20130805143719_create_themen.rb new file mode 100644 index 0000000..b2fbaac --- /dev/null +++ b/db/migrate/20130805143719_create_themen.rb @@ -0,0 +1,10 @@ +class CreateThemen < ActiveRecord::Migration + def change + create_table :themen do |t| + t.string :title + t.text :text + + t.timestamps + end + end +end diff --git a/db/migrate/20130805143839_create_attachments.rb b/db/migrate/20130805143839_create_attachments.rb new file mode 100644 index 0000000..dbead07 --- /dev/null +++ b/db/migrate/20130805143839_create_attachments.rb @@ -0,0 +1,9 @@ +class CreateAttachments < ActiveRecord::Migration + def change + create_table :attachments do |t| + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20130805143919_create_fragen.rb b/db/migrate/20130805143919_create_fragen.rb new file mode 100644 index 0000000..5697dc4 --- /dev/null +++ b/db/migrate/20130805143919_create_fragen.rb @@ -0,0 +1,10 @@ +class CreateFragen < ActiveRecord::Migration + def change + create_table :fragen do |t| + t.string :title + t.text :text + + t.timestamps + end + end +end diff --git a/spec/controllers/attachments_controller_spec.rb b/spec/controllers/attachments_controller_spec.rb new file mode 100644 index 0000000..412c78b --- /dev/null +++ b/spec/controllers/attachments_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 AttachmentsController do + + # This should return the minimal set of attributes required to create a valid + # Attachment. As you add validations to Attachment, 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 + # AttachmentsController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all attachments as @attachments" do + attachment = Attachment.create! valid_attributes + get :index, {}, valid_session + assigns(:attachments).should eq([attachment]) + end + end + + describe "GET show" do + it "assigns the requested attachment as @attachment" do + attachment = Attachment.create! valid_attributes + get :show, {:id => attachment.to_param}, valid_session + assigns(:attachment).should eq(attachment) + end + end + + describe "GET new" do + it "assigns a new attachment as @attachment" do + get :new, {}, valid_session + assigns(:attachment).should be_a_new(Attachment) + end + end + + describe "GET edit" do + it "assigns the requested attachment as @attachment" do + attachment = Attachment.create! valid_attributes + get :edit, {:id => attachment.to_param}, valid_session + assigns(:attachment).should eq(attachment) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Attachment" do + expect { + post :create, {:attachment => valid_attributes}, valid_session + }.to change(Attachment, :count).by(1) + end + + it "assigns a newly created attachment as @attachment" do + post :create, {:attachment => valid_attributes}, valid_session + assigns(:attachment).should be_a(Attachment) + assigns(:attachment).should be_persisted + end + + it "redirects to the created attachment" do + post :create, {:attachment => valid_attributes}, valid_session + response.should redirect_to(Attachment.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved attachment as @attachment" do + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + post :create, {:attachment => { "name" => "invalid value" }}, valid_session + assigns(:attachment).should be_a_new(Attachment) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + post :create, {:attachment => { "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 attachment" do + attachment = Attachment.create! valid_attributes + # Assuming there are no other attachments in the database, this + # specifies that the Attachment created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Attachment.any_instance.should_receive(:update_attributes).with({ "name" => "MyString" }) + put :update, {:id => attachment.to_param, :attachment => { "name" => "MyString" }}, valid_session + end + + it "assigns the requested attachment as @attachment" do + attachment = Attachment.create! valid_attributes + put :update, {:id => attachment.to_param, :attachment => valid_attributes}, valid_session + assigns(:attachment).should eq(attachment) + end + + it "redirects to the attachment" do + attachment = Attachment.create! valid_attributes + put :update, {:id => attachment.to_param, :attachment => valid_attributes}, valid_session + response.should redirect_to(attachment) + end + end + + describe "with invalid params" do + it "assigns the attachment as @attachment" do + attachment = Attachment.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + put :update, {:id => attachment.to_param, :attachment => { "name" => "invalid value" }}, valid_session + assigns(:attachment).should eq(attachment) + end + + it "re-renders the 'edit' template" do + attachment = Attachment.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Attachment.any_instance.stub(:save).and_return(false) + put :update, {:id => attachment.to_param, :attachment => { "name" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested attachment" do + attachment = Attachment.create! valid_attributes + expect { + delete :destroy, {:id => attachment.to_param}, valid_session + }.to change(Attachment, :count).by(-1) + end + + it "redirects to the attachments list" do + attachment = Attachment.create! valid_attributes + delete :destroy, {:id => attachment.to_param}, valid_session + response.should redirect_to(attachments_url) + end + end + +end diff --git a/spec/controllers/fragen_controller_spec.rb b/spec/controllers/fragen_controller_spec.rb new file mode 100644 index 0000000..f69659a --- /dev/null +++ b/spec/controllers/fragen_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 FragenController do + + # This should return the minimal set of attributes required to create a valid + # Frage. As you add validations to Frage, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "title" => "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 + # FragenController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all fragenn as @fragenn" do + frage = Frage.create! valid_attributes + get :index, {}, valid_session + assigns(:fragen).should eq([frage]) + end + end + + describe "GET show" do + it "assigns the requested frage as @frage" do + frage = Frage.create! valid_attributes + get :show, {:id => frage.to_param}, valid_session + assigns(:frage).should eq(frage) + end + end + + describe "GET new" do + it "assigns a new frage as @frage" do + get :new, {}, valid_session + assigns(:frage).should be_a_new(Frage) + end + end + + describe "GET edit" do + it "assigns the requested frage as @frage" do + frage = Frage.create! valid_attributes + get :edit, {:id => frage.to_param}, valid_session + assigns(:frage).should eq(frage) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Frage" do + expect { + post :create, {:frage => valid_attributes}, valid_session + }.to change(Frage, :count).by(1) + end + + it "assigns a newly created frage as @frage" do + post :create, {:frage => valid_attributes}, valid_session + assigns(:frage).should be_a(Frage) + assigns(:frage).should be_persisted + end + + it "redirects to the created frage" do + post :create, {:frage => valid_attributes}, valid_session + response.should redirect_to(Frage.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved frage as @frage" do + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + post :create, {:frage => { "title" => "invalid value" }}, valid_session + assigns(:frage).should be_a_new(Frage) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + post :create, {:frage => { "title" => "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 frage" do + frage = Frage.create! valid_attributes + # Assuming there are no other fragen in the database, this + # specifies that the Frage created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Frage.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" }) + put :update, {:id => frage.to_param, :frage => { "title" => "MyString" }}, valid_session + end + + it "assigns the requested frage as @frage" do + frage = Frage.create! valid_attributes + put :update, {:id => frage.to_param, :frage => valid_attributes}, valid_session + assigns(:frage).should eq(frage) + end + + it "redirects to the frage" do + frage = Frage.create! valid_attributes + put :update, {:id => frage.to_param, :frage => valid_attributes}, valid_session + response.should redirect_to(frage) + end + end + + describe "with invalid params" do + it "assigns the frage as @frage" do + frage = Frage.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + put :update, {:id => frage.to_param, :frage => { "title" => "invalid value" }}, valid_session + assigns(:frage).should eq(frage) + end + + it "re-renders the 'edit' template" do + frage = Frage.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Frage.any_instance.stub(:save).and_return(false) + put :update, {:id => frage.to_param, :frage => { "title" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested frage" do + frage = Frage.create! valid_attributes + expect { + delete :destroy, {:id => frage.to_param}, valid_session + }.to change(Frage, :count).by(-1) + end + + it "redirects to the fragen list" do + frage = Frage.create! valid_attributes + delete :destroy, {:id => frage.to_param}, valid_session + response.should redirect_to(fragen_url) + end + end + +end diff --git a/spec/controllers/themen_controller_spec.rb b/spec/controllers/themen_controller_spec.rb new file mode 100644 index 0000000..534e17e --- /dev/null +++ b/spec/controllers/themen_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 ThemenController do + + # This should return the minimal set of attributes required to create a valid + # Thema. As you add validations to Thema, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "title" => "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 + # ThemenController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all themen as @themen" do + thema = Thema.create! valid_attributes + get :index, {}, valid_session + assigns(:themen).should eq([thema]) + end + end + + describe "GET show" do + it "assigns the requested thema as @thema" do + thema = Thema.create! valid_attributes + get :show, {:id => thema.to_param}, valid_session + assigns(:thema).should eq(thema) + end + end + + describe "GET new" do + it "assigns a new thema as @thema" do + get :new, {}, valid_session + assigns(:thema).should be_a_new(Thema) + end + end + + describe "GET edit" do + it "assigns the requested thema as @thema" do + thema = Thema.create! valid_attributes + get :edit, {:id => thema.to_param}, valid_session + assigns(:thema).should eq(thema) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Thema" do + expect { + post :create, {:thema => valid_attributes}, valid_session + }.to change(Thema, :count).by(1) + end + + it "assigns a newly created thema as @thema" do + post :create, {:thema => valid_attributes}, valid_session + assigns(:thema).should be_a(Thema) + assigns(:thema).should be_persisted + end + + it "redirects to the created thema" do + post :create, {:thema => valid_attributes}, valid_session + response.should redirect_to(Thema.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved thema as @thema" do + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + post :create, {:thema => { "title" => "invalid value" }}, valid_session + assigns(:thema).should be_a_new(Thema) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + post :create, {:thema => { "title" => "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 thema" do + thema = Thema.create! valid_attributes + # Assuming there are no other themen in the database, this + # specifies that the Thema created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Thema.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" }) + put :update, {:id => thema.to_param, :thema => { "title" => "MyString" }}, valid_session + end + + it "assigns the requested thema as @thema" do + thema = Thema.create! valid_attributes + put :update, {:id => thema.to_param, :thema => valid_attributes}, valid_session + assigns(:thema).should eq(thema) + end + + it "redirects to the thema" do + thema = Thema.create! valid_attributes + put :update, {:id => thema.to_param, :thema => valid_attributes}, valid_session + response.should redirect_to(thema) + end + end + + describe "with invalid params" do + it "assigns the thema as @thema" do + thema = Thema.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + put :update, {:id => thema.to_param, :thema => { "title" => "invalid value" }}, valid_session + assigns(:thema).should eq(thema) + end + + it "re-renders the 'edit' template" do + thema = Thema.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Thema.any_instance.stub(:save).and_return(false) + put :update, {:id => thema.to_param, :thema => { "title" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested thema" do + thema = Thema.create! valid_attributes + expect { + delete :destroy, {:id => thema.to_param}, valid_session + }.to change(Thema, :count).by(-1) + end + + it "redirects to the themen list" do + thema = Thema.create! valid_attributes + delete :destroy, {:id => thema.to_param}, valid_session + response.should redirect_to(themen_url) + end + end + +end diff --git a/spec/controllers/themengruppen_controller_spec.rb b/spec/controllers/themengruppen_controller_spec.rb new file mode 100644 index 0000000..5619bdf --- /dev/null +++ b/spec/controllers/themengruppen_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 ThemengruppenController do + + # This should return the minimal set of attributes required to create a valid + # Themengruppe. As you add validations to Themengruppe, be sure to + # adjust the attributes here as well. + let(:valid_attributes) { { "title" => "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 + # ThemengruppenController. Be sure to keep this updated too. + let(:valid_session) { {} } + + describe "GET index" do + it "assigns all themengruppenn as @themengruppenn" do + themengruppe = Themengruppe.create! valid_attributes + get :index, {}, valid_session + assigns(:themengruppen).should eq([themengruppe]) + end + end + + describe "GET show" do + it "assigns the requested themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + get :show, {:id => themengruppe.to_param}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + end + + describe "GET new" do + it "assigns a new themengruppe as @themengruppe" do + get :new, {}, valid_session + assigns(:themengruppe).should be_a_new(Themengruppe) + end + end + + describe "GET edit" do + it "assigns the requested themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + get :edit, {:id => themengruppe.to_param}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + end + + describe "POST create" do + describe "with valid params" do + it "creates a new Themengruppe" do + expect { + post :create, {:themengruppe => valid_attributes}, valid_session + }.to change(Themengruppe, :count).by(1) + end + + it "assigns a newly created themengruppe as @themengruppe" do + post :create, {:themengruppe => valid_attributes}, valid_session + assigns(:themengruppe).should be_a(Themengruppe) + assigns(:themengruppe).should be_persisted + end + + it "redirects to the created themengruppe" do + post :create, {:themengruppe => valid_attributes}, valid_session + response.should redirect_to(Themengruppe.last) + end + end + + describe "with invalid params" do + it "assigns a newly created but unsaved themengruppe as @themengruppe" do + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + post :create, {:themengruppe => { "title" => "invalid value" }}, valid_session + assigns(:themengruppe).should be_a_new(Themengruppe) + end + + it "re-renders the 'new' template" do + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + post :create, {:themengruppe => { "title" => "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 themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + # Assuming there are no other themengruppen in the database, this + # specifies that the Themengruppe created on the previous line + # receives the :update_attributes message with whatever params are + # submitted in the request. + Themengruppe.any_instance.should_receive(:update_attributes).with({ "title" => "MyString" }) + put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "MyString" }}, valid_session + end + + it "assigns the requested themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + put :update, {:id => themengruppe.to_param, :themengruppe => valid_attributes}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + + it "redirects to the themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + put :update, {:id => themengruppe.to_param, :themengruppe => valid_attributes}, valid_session + response.should redirect_to(themengruppe) + end + end + + describe "with invalid params" do + it "assigns the themengruppe as @themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "invalid value" }}, valid_session + assigns(:themengruppe).should eq(themengruppe) + end + + it "re-renders the 'edit' template" do + themengruppe = Themengruppe.create! valid_attributes + # Trigger the behavior that occurs when invalid params are submitted + Themengruppe.any_instance.stub(:save).and_return(false) + put :update, {:id => themengruppe.to_param, :themengruppe => { "title" => "invalid value" }}, valid_session + response.should render_template("edit") + end + end + end + + describe "DELETE destroy" do + it "destroys the requested themengruppe" do + themengruppe = Themengruppe.create! valid_attributes + expect { + delete :destroy, {:id => themengruppe.to_param}, valid_session + }.to change(Themengruppe, :count).by(-1) + end + + it "redirects to the themengruppen list" do + themengruppe = Themengruppe.create! valid_attributes + delete :destroy, {:id => themengruppe.to_param}, valid_session + response.should redirect_to(themengruppen_url) + end + end + +end diff --git a/spec/factories/attachments.rb b/spec/factories/attachments.rb new file mode 100644 index 0000000..9c31968 --- /dev/null +++ b/spec/factories/attachments.rb @@ -0,0 +1,7 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :attachment do + name "MyString" + end +end diff --git a/spec/factories/fragen.rb b/spec/factories/fragen.rb new file mode 100644 index 0000000..eedcbcc --- /dev/null +++ b/spec/factories/fragen.rb @@ -0,0 +1,8 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :frage do + title "MyString" + text "MyText" + end +end diff --git a/spec/factories/studien.rb~ b/spec/factories/studien.rb~ new file mode 100644 index 0000000..071a60e --- /dev/null +++ b/spec/factories/studien.rb~ @@ -0,0 +1,12 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + + +FactoryGirl.define do + factory :studium do + zahl "066.506" + name "Automatisierung" + desc "TEST DESC" + typ "Master" + end + +end diff --git a/spec/factories/themen.rb b/spec/factories/themen.rb new file mode 100644 index 0000000..30c74c4 --- /dev/null +++ b/spec/factories/themen.rb @@ -0,0 +1,8 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :thema do + title "MyString" + text "MyText" + end +end diff --git a/spec/factories/themengruppen.rb b/spec/factories/themengruppen.rb new file mode 100644 index 0000000..868dca7 --- /dev/null +++ b/spec/factories/themengruppen.rb @@ -0,0 +1,8 @@ +# Read about factories at https://github.com/thoughtbot/factory_girl + +FactoryGirl.define do + factory :themagruppen, :class => 'Themengruppe' do + title "MyString" + text "MyText" + end +end diff --git a/spec/helpers/attachments_helper_spec.rb b/spec/helpers/attachments_helper_spec.rb new file mode 100644 index 0000000..38799ea --- /dev/null +++ b/spec/helpers/attachments_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the AttachmentsHelper. For example: +# +# describe AttachmentsHelper 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 AttachmentsHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/fragen_helper_spec.rb b/spec/helpers/fragen_helper_spec.rb new file mode 100644 index 0000000..d74ca7b --- /dev/null +++ b/spec/helpers/fragen_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the FragenHelper. For example: +# +# describe FragenHelper 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 FragenHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/themen_helper_spec.rb b/spec/helpers/themen_helper_spec.rb new file mode 100644 index 0000000..db8890f --- /dev/null +++ b/spec/helpers/themen_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ThemenHelper. For example: +# +# describe ThemenHelper 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 ThemenHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/helpers/themengruppen_helper_spec.rb b/spec/helpers/themengruppen_helper_spec.rb new file mode 100644 index 0000000..bf60a8c --- /dev/null +++ b/spec/helpers/themengruppen_helper_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +# Specs in this file have access to a helper object that includes +# the ThemengruppenHelper. For example: +# +# describe ThemengruppenHelper 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 ThemengruppenHelper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/attachment_spec.rb b/spec/models/attachment_spec.rb new file mode 100644 index 0000000..9981316 --- /dev/null +++ b/spec/models/attachment_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Attachment do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/frage_spec.rb b/spec/models/frage_spec.rb new file mode 100644 index 0000000..101f7ce --- /dev/null +++ b/spec/models/frage_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Frage do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/thema_spec.rb b/spec/models/thema_spec.rb new file mode 100644 index 0000000..b006262 --- /dev/null +++ b/spec/models/thema_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Thema do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/themengruppe_spec.rb b/spec/models/themengruppe_spec.rb new file mode 100644 index 0000000..cf5341f --- /dev/null +++ b/spec/models/themengruppe_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe Themengruppe do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/requests/attachments_spec.rb b/spec/requests/attachments_spec.rb new file mode 100644 index 0000000..725ca17 --- /dev/null +++ b/spec/requests/attachments_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Attachments" do + describe "GET /attachments" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get attachments_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/fragen_spec.rb b/spec/requests/fragen_spec.rb new file mode 100644 index 0000000..33a136e --- /dev/null +++ b/spec/requests/fragen_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Frages" do + describe "GET /fragen" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get fragen_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/themen_spec.rb b/spec/requests/themen_spec.rb new file mode 100644 index 0000000..698db99 --- /dev/null +++ b/spec/requests/themen_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Themas" do + describe "GET /themen" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get themen_path + response.status.should be(200) + end + end +end diff --git a/spec/requests/themengruppen_spec.rb b/spec/requests/themengruppen_spec.rb new file mode 100644 index 0000000..f7416d9 --- /dev/null +++ b/spec/requests/themengruppen_spec.rb @@ -0,0 +1,11 @@ +require 'spec_helper' + +describe "Themengruppes" do + describe "GET /themengruppen" do + it "works! (now write some real specs)" do + # Run the generator again with the --webrat flag if you want to use webrat methods/matchers + get themengruppen_path + response.status.should be(200) + end + end +end diff --git a/spec/routing/attachments_routing_spec.rb b/spec/routing/attachments_routing_spec.rb new file mode 100644 index 0000000..8827b56 --- /dev/null +++ b/spec/routing/attachments_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe AttachmentsController do + describe "routing" do + + it "routes to #index" do + get("/attachments").should route_to("attachments#index") + end + + it "routes to #new" do + get("/attachments/new").should route_to("attachments#new") + end + + it "routes to #show" do + get("/attachments/1").should route_to("attachments#show", :id => "1") + end + + it "routes to #edit" do + get("/attachments/1/edit").should route_to("attachments#edit", :id => "1") + end + + it "routes to #create" do + post("/attachments").should route_to("attachments#create") + end + + it "routes to #update" do + put("/attachments/1").should route_to("attachments#update", :id => "1") + end + + it "routes to #destroy" do + delete("/attachments/1").should route_to("attachments#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/fragen_routing_spec.rb b/spec/routing/fragen_routing_spec.rb new file mode 100644 index 0000000..aadd707 --- /dev/null +++ b/spec/routing/fragen_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe FragenController do + describe "routing" do + + it "routes to #index" do + get("/fragen").should route_to("fragen#index") + end + + it "routes to #new" do + get("/fragen/new").should route_to("fragen#new") + end + + it "routes to #show" do + get("/fragen/1").should route_to("fragen#show", :id => "1") + end + + it "routes to #edit" do + get("/fragen/1/edit").should route_to("fragen#edit", :id => "1") + end + + it "routes to #create" do + post("/fragen").should route_to("fragen#create") + end + + it "routes to #update" do + put("/fragen/1").should route_to("fragen#update", :id => "1") + end + + it "routes to #destroy" do + delete("/fragen/1").should route_to("fragen#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/themen_routing_spec.rb b/spec/routing/themen_routing_spec.rb new file mode 100644 index 0000000..e0ee364 --- /dev/null +++ b/spec/routing/themen_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe ThemenController do + describe "routing" do + + it "routes to #index" do + get("/themen").should route_to("themen#index") + end + + it "routes to #new" do + get("/themen/new").should route_to("themen#new") + end + + it "routes to #show" do + get("/themen/1").should route_to("themen#show", :id => "1") + end + + it "routes to #edit" do + get("/themen/1/edit").should route_to("themen#edit", :id => "1") + end + + it "routes to #create" do + post("/themen").should route_to("themen#create") + end + + it "routes to #update" do + put("/themen/1").should route_to("themen#update", :id => "1") + end + + it "routes to #destroy" do + delete("/themen/1").should route_to("themen#destroy", :id => "1") + end + + end +end diff --git a/spec/routing/themengruppen_routing_spec.rb b/spec/routing/themengruppen_routing_spec.rb new file mode 100644 index 0000000..3ccfa91 --- /dev/null +++ b/spec/routing/themengruppen_routing_spec.rb @@ -0,0 +1,35 @@ +require "spec_helper" + +describe ThemengruppenController do + describe "routing" do + + it "routes to #index" do + get("/themengruppen").should route_to("themengruppen#index") + end + + it "routes to #new" do + get("/themengruppen/new").should route_to("themengruppen#new") + end + + it "routes to #show" do + get("/themengruppen/1").should route_to("themengruppen#show", :id => "1") + end + + it "routes to #edit" do + get("/themengruppen/1/edit").should route_to("themengruppen#edit", :id => "1") + end + + it "routes to #create" do + post("/themengruppen").should route_to("themengruppen#create") + end + + it "routes to #update" do + put("/themengruppen/1").should route_to("themengruppen#update", :id => "1") + end + + it "routes to #destroy" do + delete("/themengruppen/1").should route_to("themengruppen#destroy", :id => "1") + end + + end +end diff --git a/spec/views/attachments/edit.html.erb_spec.rb b/spec/views/attachments/edit.html.erb_spec.rb new file mode 100644 index 0000000..d1edac7 --- /dev/null +++ b/spec/views/attachments/edit.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "attachments/edit" do + before(:each) do + @attachment = assign(:attachment, stub_model(Attachment, + :name => "MyString" + )) + end + + it "renders the edit attachment form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", attachment_path(@attachment), "post" do + assert_select "input#attachment_name[name=?]", "attachment[name]" + end + end +end diff --git a/spec/views/attachments/index.html.erb_spec.rb b/spec/views/attachments/index.html.erb_spec.rb new file mode 100644 index 0000000..22fab49 --- /dev/null +++ b/spec/views/attachments/index.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "attachments/index" do + before(:each) do + assign(:attachments, [ + stub_model(Attachment, + :name => "Name" + ), + stub_model(Attachment, + :name => "Name" + ) + ]) + end + + it "renders a list of attachments" 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 + end +end diff --git a/spec/views/attachments/new.html.erb_spec.rb b/spec/views/attachments/new.html.erb_spec.rb new file mode 100644 index 0000000..4e88f23 --- /dev/null +++ b/spec/views/attachments/new.html.erb_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' + +describe "attachments/new" do + before(:each) do + assign(:attachment, stub_model(Attachment, + :name => "MyString" + ).as_new_record) + end + + it "renders new attachment form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", attachments_path, "post" do + assert_select "input#attachment_name[name=?]", "attachment[name]" + end + end +end diff --git a/spec/views/attachments/show.html.erb_spec.rb b/spec/views/attachments/show.html.erb_spec.rb new file mode 100644 index 0000000..6b97687 --- /dev/null +++ b/spec/views/attachments/show.html.erb_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe "attachments/show" do + before(:each) do + @attachment = assign(:attachment, stub_model(Attachment, + :name => "Name" + )) + 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/) + end +end diff --git a/spec/views/fragen/edit.html.erb_spec.rb b/spec/views/fragen/edit.html.erb_spec.rb new file mode 100644 index 0000000..098b318 --- /dev/null +++ b/spec/views/fragen/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "fragen/edit" do + before(:each) do + @frage = assign(:frage, stub_model(Frage, + :title => "MyString", + :text => "MyText" + )) + end + + it "renders the edit frage form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", frage_path(@frage), "post" do + assert_select "input#frage_title[name=?]", "frage[title]" + assert_select "textarea#frage_text[name=?]", "frage[text]" + end + end +end diff --git a/spec/views/fragen/index.html.erb_spec.rb b/spec/views/fragen/index.html.erb_spec.rb new file mode 100644 index 0000000..5bb8475 --- /dev/null +++ b/spec/views/fragen/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "fragen/index" do + before(:each) do + assign(:fragen, [ + stub_model(Frage, + :title => "Title", + :text => "MyText" + ), + stub_model(Frage, + :title => "Title", + :text => "MyText" + ) + ]) + end + + it "renders a list of fragen" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Title".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/fragen/new.html.erb_spec.rb b/spec/views/fragen/new.html.erb_spec.rb new file mode 100644 index 0000000..6e1a25c --- /dev/null +++ b/spec/views/fragen/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "fragen/new" do + before(:each) do + assign(:frage, stub_model(Frage, + :title => "MyString", + :text => "MyText" + ).as_new_record) + end + + it "renders new frage form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", fragen_path, "post" do + assert_select "input#frage_title[name=?]", "frage[title]" + assert_select "textarea#frage_text[name=?]", "frage[text]" + end + end +end diff --git a/spec/views/fragen/show.html.erb_spec.rb b/spec/views/fragen/show.html.erb_spec.rb new file mode 100644 index 0000000..fd93018 --- /dev/null +++ b/spec/views/fragen/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "fragen/show" do + before(:each) do + @frage = assign(:frage, stub_model(Frage, + :title => "Title", + :text => "MyText" + )) + 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(/Title/) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/themen/edit.html.erb_spec.rb b/spec/views/themen/edit.html.erb_spec.rb new file mode 100644 index 0000000..eb389ac --- /dev/null +++ b/spec/views/themen/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themen/edit" do + before(:each) do + @thema = assign(:thema, stub_model(Thema, + :title => "MyString", + :text => "MyText" + )) + end + + it "renders the edit thema form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", thema_path(@thema), "post" do + assert_select "input#thema_title[name=?]", "thema[title]" + assert_select "textarea#thema_text[name=?]", "thema[text]" + end + end +end diff --git a/spec/views/themen/index.html.erb_spec.rb b/spec/views/themen/index.html.erb_spec.rb new file mode 100644 index 0000000..587c0c7 --- /dev/null +++ b/spec/views/themen/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "themen/index" do + before(:each) do + assign(:themen, [ + stub_model(Thema, + :title => "Title", + :text => "MyText" + ), + stub_model(Thema, + :title => "Title", + :text => "MyText" + ) + ]) + end + + it "renders a list of themen" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Title".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/themen/new.html.erb_spec.rb b/spec/views/themen/new.html.erb_spec.rb new file mode 100644 index 0000000..531b5a0 --- /dev/null +++ b/spec/views/themen/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themen/new" do + before(:each) do + assign(:thema, stub_model(Thema, + :title => "MyString", + :text => "MyText" + ).as_new_record) + end + + it "renders new thema form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", themen_path, "post" do + assert_select "input#thema_title[name=?]", "thema[title]" + assert_select "textarea#thema_text[name=?]", "thema[text]" + end + end +end diff --git a/spec/views/themen/show.html.erb_spec.rb b/spec/views/themen/show.html.erb_spec.rb new file mode 100644 index 0000000..2eedcc9 --- /dev/null +++ b/spec/views/themen/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "themen/show" do + before(:each) do + @thema = assign(:thema, stub_model(Thema, + :title => "Title", + :text => "MyText" + )) + 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(/Title/) + rendered.should match(/MyText/) + end +end diff --git a/spec/views/themengruppen/edit.html.erb_spec.rb b/spec/views/themengruppen/edit.html.erb_spec.rb new file mode 100644 index 0000000..6fbf646 --- /dev/null +++ b/spec/views/themengruppen/edit.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themengruppen/edit" do + before(:each) do + @themengruppe = assign(:themengruppe, stub_model(Themengruppe, + :title => "MyString", + :text => "MyText" + )) + end + + it "renders the edit themengruppe form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", themengruppe_path(@themengruppe), "post" do + assert_select "input#themengruppe_title[name=?]", "themengruppe[title]" + assert_select "textarea#themengruppe_text[name=?]", "themengruppe[text]" + end + end +end diff --git a/spec/views/themengruppen/index.html.erb_spec.rb b/spec/views/themengruppen/index.html.erb_spec.rb new file mode 100644 index 0000000..524c49a --- /dev/null +++ b/spec/views/themengruppen/index.html.erb_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe "themengruppen/index" do + before(:each) do + assign(:themengruppen, [ + stub_model(Themengruppe, + :title => "Title", + :text => "MyText" + ), + stub_model(Themengruppe, + :title => "Title", + :text => "MyText" + ) + ]) + end + + it "renders a list of themengruppen" do + render + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "tr>td", :text => "Title".to_s, :count => 2 + assert_select "tr>td", :text => "MyText".to_s, :count => 2 + end +end diff --git a/spec/views/themengruppen/new.html.erb_spec.rb b/spec/views/themengruppen/new.html.erb_spec.rb new file mode 100644 index 0000000..d73fbf3 --- /dev/null +++ b/spec/views/themengruppen/new.html.erb_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +describe "themengruppen/new" do + before(:each) do + assign(:themengruppe, stub_model(Themengruppe, + :title => "MyString", + :text => "MyText" + ).as_new_record) + end + + it "renders new themengruppe form" do + render + + # Run the generator again with the --webrat flag if you want to use webrat matchers + assert_select "form[action=?][method=?]", themengruppen_path, "post" do + assert_select "input#themengruppe_title[name=?]", "themengruppe[title]" + assert_select "textarea#themengruppe_text[name=?]", "themengruppe[text]" + end + end +end diff --git a/spec/views/themengruppen/show.html.erb_spec.rb b/spec/views/themengruppen/show.html.erb_spec.rb new file mode 100644 index 0000000..14d2e3b --- /dev/null +++ b/spec/views/themengruppen/show.html.erb_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe "themengruppen/show" do + before(:each) do + @themengruppe = assign(:themengruppe, stub_model(Themengruppe, + :title => "Title", + :text => "MyText" + )) + 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(/Title/) + rendered.should match(/MyText/) + end +end