From b9079c0525a00966afb31d1df23b425e2eb68460 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Sun, 6 Sep 2015 21:03:06 +0200 Subject: [PATCH] AutoCommit Son Sep 6 21:03:06 CEST 2015 --- spec/controllers/gremien_controller_spec.rb | 47 ++++++--------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/spec/controllers/gremien_controller_spec.rb b/spec/controllers/gremien_controller_spec.rb index 6045afe..693e11d 100644 --- a/spec/controllers/gremien_controller_spec.rb +++ b/spec/controllers/gremien_controller_spec.rb @@ -1,48 +1,27 @@ 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 GremienController, :type => :view do + let(:valid_update_attributes) { { "name" => "MyString" } } -describe GremienController do - - # This should return the minimal set of attributes required to create a valid - # Gremium. As you add validations to Gremium, 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 - # GremienController. Be sure to keep this updated too. - let(:valid_session) { {} } + def self.create_gremium + before(:each) do + @gremium = FactoryGirl.create(:gremium) + end + end describe "GET index" do + create_gremium + subject(:action) { get :index, {} } it "assigns all gremien as @gremien" do - gremium = Gremium.create! valid_attributes - get :index, {}, valid_session - assigns(:gremien).should eq([gremium]) + expect(assigns(:gremien)).to eq([@gremium]) end end describe "GET show" do + create_gremium + subject(:action) {get :show, {:id => gremium.to_param}} it "assigns the requested gremium as @gremium" do - gremium = Gremium.create! valid_attributes - get :show, {:id => gremium.to_param}, valid_session - assigns(:gremium).should eq(gremium) + expect(assigns(:gremium)).to eq(gremium) end end