Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Test feature setup #75

Open
pablorc opened this issue Feb 1, 2018 · 3 comments
Open

Test feature setup #75

pablorc opened this issue Feb 1, 2018 · 3 comments

Comments

@pablorc
Copy link
Member

pablorc commented Feb 1, 2018

I think we should create a test codebase to check that every recipe works. This is a nice to have when we update rails gems, or perform a refactor in the code.

I suggest:

  • A way to run the wizard in a headless mode to generate a valid app
  • Make simple tests to be sure that the dependencies are properly setted up (for example, that rspec doesn't fail, or /admin returns a 200 response for active_admin)

What do you think?

@xredo
Copy link
Member

xredo commented Feb 5, 2018

Testing manually is starting to be painful. I agree that we need to provide some kind of automated testing.

Running the wizard in a headless mode is easy. We only need to create tmp directories and work on these tmp directories.

Executing commands via Ruby is easy (also checking result codes). If we want to go low level, we can also read files (File.read) and check that some strings are added there.

@pablorc
Copy link
Member Author

pablorc commented Feb 5, 2018

Within the testing issue I took the time to add something in this line. The testing recipe generates these specs:

RSpec.describe 'Dependencies' do
  it('has rspec') { true == true }
  it('has FakeRedis') { expect(FakeRedis).to_not be nil }
  it('has DatabaseCleaner') { expect(DatabaseCleaner).to_not be nil }
  it('has shoulda_matchers') { expect(self).to respond_to :is_expected }
  it('has Faker') { expect(Faker::Robin.quote).to include 'Holy' }
end

RSpec.describe 'System', type: :system do
  it 'has integration tests' do
    visit('/404')
    expect(page).to have_content("The page you were looking for doesn't exist")
  end
end

In these cases I assume that they are both working specs, and also a bit of boilerplate to let the user see where specs should be written, and also what dependencies are installed (and indeed are working).

Something similar for the rest of features (we can discuss if export them as actually testing codebase in the new app or don't) would be nice. This way we'll have regression tests to update versions without fear. Also assert result codes for tasks could be useful. The approach may depend in the recipe itself, I think.

@xredo
Copy link
Member

xredo commented Feb 5, 2018

Great idea! However, we can include those tests only if we use a certain ENV variable. e.g. PATHFINDER_SPECS

That way we are not adding tests that are not valuable for the final user.

@xredo xredo added this to Inbox in PathFinder Oct 9, 2018
@xredo xredo moved this from Inbox to Accepted in PathFinder Oct 9, 2018
@xredo xredo moved this from Accepted to Planned in PathFinder Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
PathFinder
Planned
Development

No branches or pull requests

2 participants