docbrown/spec/features/user_updates_org_settings_spec.rb
Ben Halpern f073eb5754
Add badges and org cta (#324)
* Make org proof a required field

* Fix color picker and other minor org adjustments

* Add MVP of org add'l sidebar

* Add proof to org factory

* Fix org create action and fix tests

* Add new org fields to admin panel & lint

* Add proof to org edit for backward compatibility

* Add org info to edit preview

* Move preview edit notice to inside article div

* MVP of badge "final" steps

* Add info to user sidebar and clean up badge commit

* Modify sidebar for data

* Add organization decorator

* Add conditional so only users have new swipe nav, not orgs

* Add cloudinary prefix to badges

* Disallow duplicate badges
2018-05-17 18:22:37 -04:00

37 lines
1.3 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
login_via_session_as user
end
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.organization_id = organization.id
user.org_admin = true
user2 = create(:user, username: "newuser")
user2.organization_id = organization.id
user2.save
user.save
visit "settings/organization"
click_button("Remove from org")
page.driver.browser.switch_to.alert.accept
expect(page).not_to have_text(user2.name)
end
end