docbrown/spec/features/user_updates_org_settings_spec.rb
rhymes e588fa7ece Code cleanups (#659)
* Initial automatic cleanup with rubocop

* Fix syntax error introduced by rubocop

* Cleanup seeds file

* Cleanup lib folder

* Exclude bin folder because it contains auto generated files

* Make Rubocop a little bit more chatty

* Block length should not include comments in the count

* Cleanup config folder

* Cleanup specs

* Updated Rubocop version and generated a todo file

* Fix broken ArticlesApi spec

* Fix tests

* Restored rubocop pre-commit hook
2018-08-07 11:00:13 -04:00

37 lines
1.4 KiB
Ruby

require "rails_helper"
RSpec.describe "Organization setting page(/settings/organization)", type: :feature, js: true do
let(:user) { create(:user) }
let(:organization) { create(:organization) }
before do
sign_in user
end
# rubocop:disable RSpec/ExampleLength
it "user creates an organization" do
visit "settings/organization"
fill_in "organization[name]", with: "Organization Name"
fill_in "organization[slug]", with: "Organization"
attach_file(
"organization_profile_image", "#{Rails.root}/app/assets/images/android-icon-36x36.png"
)
fill_in "Text color (hex)", with: "#ffffff"
fill_in "Background color (hex)", with: "#000000"
fill_in "organization[url]", with: "http://company.com"
fill_in "organization[summary]", with: "Summary"
fill_in "organization[proof]", with: "Proof"
click_button "SUBMIT"
expect(page).to have_text("Your organization was successfully created and you are an admin.")
end
it "remove user from organization" do
user.update_attributes(organization_id: organization.id, org_admin: true)
user2 = create(:user, username: "newuser", organization_id: organization.id)
visit "settings/organization"
click_button("Remove from org")
page.driver.browser.switch_to.alert.accept
expect(page).not_to have_text(user2.name)
end
# rubocop:enable RSpec/ExampleLength
end