BigW Consortium Gitlab

applications.rb 1.48 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
class Spinach::Features::AdminApplications < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedPaths
  include SharedAdmin

  step 'I click on new application button' do
    click_on 'New Application'
  end

  step 'I should see application form' do
11
    expect(page).to have_content "New application"
12 13 14 15 16 17 18 19 20
  end

  step 'I fill application form out and submit' do
    fill_in :doorkeeper_application_name, with: 'test'
    fill_in :doorkeeper_application_redirect_uri, with: 'https://test.com'
    click_on "Submit"
  end

  step 'I see application' do
21 22 23
    expect(page).to have_content "Application: test"
    expect(page).to have_content "Application Id"
    expect(page).to have_content "Secret"
24 25 26 27 28 29 30
  end

  step 'I click edit' do
    click_on "Edit"
  end

  step 'I see edit application form' do
31
    expect(page).to have_content "Edit application"
32 33 34
  end

  step 'I change name of application and submit' do
35
    expect(page).to have_content "Edit application"
36 37 38 39 40
    fill_in :doorkeeper_application_name, with: 'test_changed'
    click_on "Submit"
  end

  step 'I see that application was changed' do
41 42 43
    expect(page).to have_content "test_changed"
    expect(page).to have_content "Application Id"
    expect(page).to have_content "Secret"
44 45 46
  end

  step 'I click to remove application' do
47
    page.within '.oauth-applications' do
48 49 50 51 52
      click_on "Destroy"
    end
  end

  step "I see that application is removed" do
53
    expect(page.find(".oauth-applications")).not_to have_content "test_changed"
54 55
  end
end