Source

main / spec / features / user_features_spec.rb

Full commit
require 'spec_helper'

describe "Users" do

  subject { page }
  let(:non_partner_institution) { FactoryGirl.create(:non_partner_institution) }

  describe "signup page" do

    before(:each) do
      User.delete_all
      visit new_user_path(institution_id: non_partner_institution.id)
    end

    let(:first_name) { 'TestFirstName' }
    let(:last_name) { 'TestLastName' }
    let(:username) { 'TestUserName' }
    let(:password) { 'TestPass1' }
    let(:email) { 'TestEmail@ucop.edu' }

    describe "should have the correct layout" do
      # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
      it { should have_selector('title', content: 'Create a DMPTool account') }
      it { should have_selector('h2', content: 'Create a DMPTool account') }
    end

    it "should be able to create a user with correct information" do
      fill_in 'user_first_name', with: first_name
      fill_in 'user_last_name', with: last_name
      fill_in 'user_login_id', with: username
      fill_in 'userpassword', with: password
      fill_in 'repeatuserpassword', with: password
      fill_in 'user_email', with: email

      expect { click_button('Create Account') }.to change(User, :count).by(1)
      #it { should have_selector('div.grid_5.head_right', "You are logged in as #{}")}

    end
  end
end