Sha256: df7d41701b8f4d8711edcd7c36bbb51037ab2e8adf9886146421fcc09666b76c

Contents?: true

Size: 1.96 KB

Versions: 12

Compression:

Stored size: 1.96 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper' ))

module IntegrationTests
  class EditUserTest < ActionController::IntegrationTest
    def setup
      super
      @site = use_site! 'site with pages'
    end
    
    test "setting all global roles for a user with no global role on site, yet" do
      login_as_superuser
      visit_edit_user_form
      
      assert_select "input[name=?][checked=?]", "user[roles_attributes][0][selected]", "checked", :count => 0
      assert_select "input[name=?][checked=?]", "user[roles_attributes][1][selected]", "checked", :count => 0
      assert_select "input[name=?][checked=?]", "user[roles_attributes][2][selected]", "checked", :count => 0
      assert_select "input[name=?][checked=?]", "user[roles_attributes][3][selected]", "checked", :count => 0
      assert_select "input[name=?][checked=?]", "user[roles_attributes][4][selected]", "checked", :count => 0      
      
      check 'user[roles_attributes][0][selected]'
      check 'user[roles_attributes][1][selected]'
      check 'user[roles_attributes][2][selected]'
      check 'user[roles_attributes][3][selected]'
      check 'user[roles_attributes][4][selected]'
      
      click_button 'commit'
      
      visit_edit_user_form
      
      assert_select "input[name=?][checked=?]", "user[roles_attributes][0][selected]", "checked"
      assert_select "input[name=?][checked=?]", "user[roles_attributes][1][selected]", "checked"
      assert_select "input[name=?][checked=?]", "user[roles_attributes][2][selected]", "checked"
      assert_select "input[name=?][checked=?]", "user[roles_attributes][3][selected]", "checked"
      assert_select "input[name=?][checked=?]", "user[roles_attributes][4][selected]", "checked"                  
    end
    
    def visit_edit_user_form
      moderator = User.find_by_first_name('a moderator')
      visit "/admin/sites/#{@site.id}/users/#{moderator.id}/edit"
      renders_template "admin/users/edit"
    end
    
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
adva-0.2.4 test/integration/edit_user_test.rb
adva-0.2.3 test/integration/edit_user_test.rb
adva-0.2.2 test/integration/edit_user_test.rb
adva-0.2.1 test/integration/edit_user_test.rb
adva-0.2.0 test/integration/edit_user_test.rb
adva-0.1.4 test/integration/edit_user_test.rb
adva-0.1.3 test/integration/edit_user_test.rb
adva-0.1.2 test/integration/edit_user_test.rb
adva-0.1.1 test/integration/edit_user_test.rb
adva-0.1.0 test/integration/edit_user_test.rb
adva_user-0.0.1 test/integration/edit_user_test.rb
adva-0.0.1 adva_user/test/integration/edit_user_test.rb