Sha256: 196e47ef8093bda1144796a54a75f3cfac940840e9934a5636d266c06786758d
Contents?: true
Size: 1.42 KB
Versions: 8
Compression:
Stored size: 1.42 KB
Contents
require 'spec_helper' describe "profiles/edit" do fixtures :all before(:each) do @profile = assign(:profile, profiles(:admin)) assign(:user_groups, UserGroup.all) assign(:libraries, Library.all) assign(:roles, Role.all) assign(:available_languages, Language.available_languages) view.stub(:current_user).and_return(User.find('enjuadmin')) @ability = Object.new @ability.extend(CanCan::Ability) controller.stub(:current_ability) { @ability } end it "renders the edit user form" do render assert_select "form", :action => profiles_path(@profile), :method => "post" do assert_select "input#profile_user_number", :name => "profile[user_number]" end end describe "when logged in as librarian" do before(:each) do @profile = assign(:profile, profiles(:librarian2)) user = users(:librarian1) view.stub(:current_user).and_return(user) @ability = EnjuLeaf::Ability.new(user, '0.0.0.0') @ability.extend(CanCan::Ability) controller.stub(:current_ability) { @ability } end it "should not display 'delete' link" do render expect(rendered).not_to have_selector("a[href='#{profile_path(@profile.id)}'][data-method='delete']") end it "should disable role selection" do render expect(rendered).to have_selector("select#profile_user_attributes_user_has_role_attributes_role_id[disabled='disabled']") end end end
Version data entries
8 entries across 8 versions & 1 rubygems