forked from bofh/fetsite
AutoCommit Die Sep 1 12:03:25 CEST 2015
This commit is contained in:
@@ -21,14 +21,35 @@ describe "fetprofiles/show", :type => :view do
|
||||
# user.confirm!
|
||||
@user=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)
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user