Skip to content

Enhance test experience from external engines#1527

Merged
beagleknight merged 7 commits intomasterfrom
enhance/test-experience
Jun 26, 2017
Merged

Enhance test experience from external engines#1527
beagleknight merged 7 commits intomasterfrom
enhance/test-experience

Conversation

@beagleknight
Copy link
Copy Markdown
Contributor

🎩 What? Why?

This adds a few improvements to the test suite:

  • decidim:generate_test_app task is available to external engines so you can run it to create the test app in your spec folder.
  • The dummy_test_app path was hardcoded so it was impossible to test external engines. Now it must be set in your spec_helper using the Decidim::Dev.dummy_app_path= method.

Kudos to @josepjaume helping me with this 😄 .

📌 Related Issues

📋 Subtasks

None

📷 Screenshots (optional)

None

👻 GIF

@beagleknight beagleknight self-assigned this Jun 23, 2017
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 23, 2017

Codecov Report

Merging #1527 into master will decrease coverage by 23.52%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           master    #1527       +/-   ##
===========================================
- Coverage   96.94%   73.41%   -23.53%     
===========================================
  Files         496      144      -352     
  Lines        8404     2355     -6049     
===========================================
- Hits         8147     1729     -6418     
- Misses        257      626      +369

1 similar comment
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 23, 2017

Codecov Report

Merging #1527 into master will decrease coverage by 23.52%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           master    #1527       +/-   ##
===========================================
- Coverage   96.94%   73.41%   -23.53%     
===========================================
  Files         496      144      -352     
  Lines        8404     2355     -6049     
===========================================
- Hits         8147     1729     -6418     
- Misses        257      626      +369

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 23, 2017

Codecov Report

Merging #1527 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1527      +/-   ##
==========================================
+ Coverage   96.94%   96.96%   +0.01%     
==========================================
  Files         496      494       -2     
  Lines        8404     8391      -13     
==========================================
- Hits         8147     8136      -11     
+ Misses        257      255       -2

@oriolgual
Copy link
Copy Markdown
Contributor

/cc @amaia


require "letter_opener_web"
require "decidim/dev/railtie"
# require "letter_opener_web"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Argh.. that was just a test sorry.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Actually.. I need to remove those lines.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we need it?

require "letter_opener_web"
require "decidim/dev/railtie"
# require "letter_opener_web"
# require "decidim/dev/railtie"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

??


# Public: Get the dummy application path and raises an error if it is not set.
def self.dummy_app_path
raise StandardError, "You need to define the `dummy_app_path` first." unless @dummy_app_path
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a more helpful message. SOmething like:

"Please, add Decidim::Dev::dummy_app_path = File.expand_path(File.join("..", "spec", "decidim_dummy_app")) to your spec helper with the path to generate the dummy app"

require "premailer/rails"
require "nokogiri"
require "geocoder"
require "letter_opener_web"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this a development only dependency? Why do we need to load it in core?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, we should only load this in development. The best way would probably be to load it in decidim-dev's railtie.rb.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well.. I'm not sure where I can include this 😄 . It crashes if I try to include it on decidim-dev/lib/dev/dev.rb. It was there in the first place but I needed to move it since I made those changes. Any idea?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably in decidim/dev/railtie.rb

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@josepjaume Tried it.. not working.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure, but I could try it later.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To clarify... if I put the require on decidim/lib/decidim/dev.rb (the original file) I cannot run the generate_test_app from an external engine.

Copy link
Copy Markdown
Contributor Author

@beagleknight beagleknight Jun 23, 2017

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes! 🎉

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

@beagleknight Nice, this is great! And will make @amaia happy! :)

@amaia
Copy link
Copy Markdown
Contributor

amaia commented Jun 23, 2017

Thanks for taking care of this! 😄


# Public: Get the dummy application path and raises an error if it is not set.
def self.dummy_app_path
unless @dummy_app_path
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dummy_app_path || raise ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It doesn't bork. It raises a syntax error :/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

😕 ok then

@beagleknight beagleknight merged commit 1d4b630 into master Jun 26, 2017
@beagleknight beagleknight deleted the enhance/test-experience branch June 26, 2017 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants