require 'spec_helper'

describe 'editing a group' do
  it 'should edit the group and return to the index page' do
    customer = create :customer
    subtrade = create :subtrade
    group1 = create :group, customer: customer, subtrade: subtrade
    login_as_user customer
    click_link 'Get the Scoop'
    click_link 'Discussions'
    click_link "edit_group_#{group1.id}"

    fill_in 'group_name', with: 'wadusname'
    fill_in 'group_description', with: 'wadusdescription'
    click_button 'update_group_button'
    current_path.should eq customer_groups_path
    within '#groups_index' do
      page.should have_content 'wadusname'
    end
  end
end
