Skip to content
This repository has been archived by the owner on Oct 12, 2018. It is now read-only.

Commit

Permalink
Revert "Move common integration test methods into the helper"
Browse files Browse the repository at this point in the history
This reverts commit d59942c.

These methods are specific to the api test.  We don't want to be
spinning up a server for every integration test.
  • Loading branch information
alext committed Aug 2, 2012
1 parent fc5bf0c commit ba08399
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
16 changes: 15 additions & 1 deletion test/integration/api_test.rb
Expand Up @@ -2,9 +2,23 @@
require 'gds_api/panopticon'

class ApiAcceptanceTest < ActionDispatch::IntegrationTest
def server
@server ||= startup_server
end

def startup_server
server = Capybara::Server.new(Capybara.app)
server.boot
server
end

def create_test_user
FactoryGirl.create(:user, name: "Test", email: "test@example.com", uid: 123)
end

test "Can create an artefact via the api" do
create_test_user
api_client = GdsApi::Panopticon.new(nil, endpoint_url: @server.url(""), timeout: 5)
api_client = GdsApi::Panopticon.new(nil, endpoint_url: server.url(""), timeout: 5)
artefact_fixture = {slug: "foo", name: "Foo", owning_app: "Test", kind: "custom-application", need_id: 1}

created = nil
Expand Down
12 changes: 0 additions & 12 deletions test/integration_test_helper.rb
Expand Up @@ -14,24 +14,12 @@ def setup

WebMock.allow_net_connect!
stub_request(:get, /assets\.test\.gov\.uk/).to_return(status: 404)

@server = startup_server
end

def teardown
DatabaseCleaner.clean
WebMock.reset! # Not entirely sure whether this happens anyway
end

def startup_server
server = Capybara::Server.new(Capybara.app)
server.boot
server
end

def create_test_user
FactoryGirl.create(:user, name: "Test", email: "test@example.com", uid: 123)
end
end

Capybara.app = Rack::Builder.new do
Expand Down

1 comment on commit ba08399

@jystewart
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I remember it, these tests are now redundant as we're not using this panopticon API any more. Seems best to make sure the API is gone and remove the tests?

Please sign in to comment.