Running the tests

Adam Laycock edited this page Jul 2, 2013 · 3 revisions

Adauth uses rspec for its tests, which can be run using rspec in the root directory.

Very few of the tests can be run without having a domain to test against, to run these use the command bundle exec rspec -t no_ad.

Before you run any tests make sure you have all the development gems installed by running bundle install in the root directory, this will install rspec, simplecov and rake (if you didn't have them already).


test_data.yml is the config file that contains everything Adauth needs to test itself. There is an example of this file in the spec/ folder that looks like this:

  port: 389
  base: "dc=example, dc=com"
  query_user: User.Name
  query_password: Password

The values in this file are the same as if you where Configuring Adauth for normal use, except none of them are optional.


Adauth WILL MAKE CHANGES on your domain as it runs its tests! Don't worry, anything it does change gets changed back straight away and as you can see from this test:

it "should allow for modification" do
    Adauth.add_field(Adauth::AdObjects::User, :phone, :homePhone)
    number =
    administrator.modify([[:replace, :homephone, "8765"]]) eq "8765"
    administrator.modify([[:replace, :homephone, number]]) eq number

the test would fail if it didn't