forked from bofh/fetsite
AutoCommit Die Sep 1 12:03:25 CEST 2015
This commit is contained in:
@@ -20,15 +20,36 @@ describe "fetprofiles/show", :type => :view do
|
|||||||
user.add_role(:fetuser)
|
user.add_role(:fetuser)
|
||||||
# user.confirm!
|
# user.confirm!
|
||||||
@user=user
|
@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
|
sign_in user
|
||||||
end
|
end
|
||||||
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
|
it "renders public attributes" do
|
||||||
render
|
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.vorname}/)
|
||||||
expect(rendered).to match(/#{@fetprofile.nachname}/)
|
expect(rendered).to match(/#{@fetprofile.nachname}/)
|
||||||
expect(rendered).to match(/#{@fetprofile.desc}/)
|
expect(rendered).to match(/#{@fetprofile.desc}/)
|
||||||
@@ -50,21 +71,17 @@ describe "fetprofiles/show", :type => :view do
|
|||||||
describe "with fet user" do
|
describe "with fet user" do
|
||||||
login_fet_user
|
login_fet_user
|
||||||
it "can see intern" do
|
it "can see intern" do
|
||||||
@ability = Object.new
|
|
||||||
@ability.extend(CanCan::Ability)
|
|
||||||
controller.stub(:current_ability) { @ability }
|
|
||||||
|
|
||||||
|
expect(@ability.can?(:seeintern,@fetprofile)).to be true
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
let(:current_ability) {@ability}
|
||||||
it "renders secrets" do
|
it "renders secrets" do
|
||||||
@ability.can(:seeintern,@fetprofile)
|
render
|
||||||
allow(view).to receive(:current_ability).and_return(@ability)
|
|
||||||
|
|
||||||
expect(rendered).to match(/#{@fetprofile.street}/)
|
expect(rendered).to match(/#{@fetprofile.street}/)
|
||||||
|
end
|
||||||
|
it "renders edit path" do
|
||||||
|
render
|
||||||
|
expect(rendered).to match(/#{edit_fetprofile_path(@fetprofile)}/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user