diff --git a/spec/views/fetprofiles/show.html.erb_spec.rb b/spec/views/fetprofiles/show.html.erb_spec.rb
index 7ddec66..3f289e4 100644
--- a/spec/views/fetprofiles/show.html.erb_spec.rb
+++ b/spec/views/fetprofiles/show.html.erb_spec.rb
@@ -20,15 +20,36 @@ describe "fetprofiles/show", :type => :view do
user.add_role(:fetuser)
# user.confirm!
@user=user
- @ability=Ability.new(@user)
+ @ability= Ability.new(@user)
+ # controller.stub(:current_ability) { @ability }
+ allow(view).to receive(:current_ability).and_return(@ability)
sign_in user
end
end
+ it "calls vorname on fetprofile" do
+ expect(@fetprofile).to receive(:vorname).at_least(1).times
+
+ render
+end
+
+ it "doesn't call users" do
+ Fetprofile.any_instance.should_not_receive(:users)
+ # expect(Fetprofile.any_instance).to receive(:vorname)
+ render
+end
+
+ it "doesn't call memberships" do
+ Fetprofile.any_instance.should_not_receive(:memberships)
+ render
+ end
+
+ it "doesn't call gremien" do
+ Fetprofile.any_instance.should_not_receive(:gremien)
+ render
+ end
it "renders public attributes" do
render
- # Run the generator again with the --webrat flag if you want to use webrat matchers
-# puts rendered
expect(rendered).to match(/#{@fetprofile.vorname}/)
expect(rendered).to match(/#{@fetprofile.nachname}/)
expect(rendered).to match(/#{@fetprofile.desc}/)
@@ -50,21 +71,17 @@ describe "fetprofiles/show", :type => :view do
describe "with fet user" do
login_fet_user
it "can see intern" do
- @ability = Object.new
- @ability.extend(CanCan::Ability)
- controller.stub(:current_ability) { @ability }
-
- allow(view).to receive(:current_ability).and_return(@ability)
-# view.stub!(:current_ability).and_return(@ability)
- expect(current_ability.can?(:seeintern,@fetprofile)).to be true
+ expect(@ability.can?(:seeintern,@fetprofile)).to be true
end
+let(:current_ability) {@ability}
it "renders secrets" do
- @ability.can(:seeintern,@fetprofile)
- allow(view).to receive(:current_ability).and_return(@ability)
-
- expect(rendered).to match(/#{@fetprofile.street}/)
-
+ render
+ expect(rendered).to match(/#{@fetprofile.street}/)
+ end
+ it "renders edit path" do
+ render
+ expect(rendered).to match(/#{edit_fetprofile_path(@fetprofile)}/)
end
end
end