README.md in so_many_devices-0.2.0 vs README.md in so_many_devices-1.0.0

- old
+ new

@@ -74,10 +74,14 @@ ```ruby config.before(:each, type: :system, js: true) do driven_by :selenium_chrome_with_download_headless # or non-headless version end +config.after(:each, type: :system, js: true) do + clear_downloads +end + config.include SoManyDevices::DownloadsHelper, type: :system ``` and in your test (just an example...): @@ -85,15 +89,39 @@ it 'can download a file', :js do visit funny_page_path click_link 'Download PDF' wait_for_download expect(downloads.length).to eq(1) - expect(download).to match(/.*\.pdf/) + expect(last_download).to match(/.*\.pdf/) + last_pdf = File.read(last_download) end ``` +If you prefer to use this driver only on selected tests, you can use the following: +```ruby +config.before(:each, type: :system, js: true, with_downloads: true) do + driven_by :selenium_chrome_with_download_headless +end + +config.after(:each, type: :system, js: true, with_downloads: true) do + clear_downloads +end + +config.include SoManyDevices::DownloadsHelper, type: :system +``` + +and in your test (just an example...): + +```ruby +it 'can download a file', :js, :with_downloads do +end +``` + +The call to `clear_downloads` makes sure that all the downloads are removed from the downloads folder. +All downloads are performed in the `tmp/downloads` folder of your project. + ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. @@ -102,11 +130,11 @@ which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at <https://github.com/renuo/so_many_devices>. -This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/renuo/so_many_devices/blob/master/CODE_OF_CONDUCT.md). +This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/renuo/so_many_devices/blob/main/CODE_OF_CONDUCT.md). Do you think our devices are not that many? 😡 Please contribute by adding more devices to the list, so that they can be even more...many...😕...and the next person coming cannot say "they are not that many..." @@ -114,10 +142,10 @@ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct -Everyone interacting in the SoManyDevices project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/renuo/so_many_devices/blob/master/CODE_OF_CONDUCT.md). +Everyone interacting in the SoManyDevices project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/renuo/so_many_devices/blob/main/CODE_OF_CONDUCT.md). ## Special Thanks [![Renuo AG](./logo/renuo.png)](https://www.renuo.ch)