Class: Visdiff::TestRun
- Inherits:
-
Object
- Object
- Visdiff::TestRun
- Defined in:
- lib/visdiff/test_run.rb
Instance Attribute Summary collapse
-
#enabled ⇒ Object
(also: #enabled?)
Returns the value of attribute enabled.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
Instance Method Summary collapse
- #enable ⇒ Object
-
#initialize ⇒ TestRun
constructor
A new instance of TestRun.
- #observe_page(identifier, page) ⇒ Object
- #revision_from_git! ⇒ Object
- #submit! ⇒ Object
Constructor Details
Instance Attribute Details
#enabled ⇒ Object Also known as: enabled?
Returns the value of attribute enabled.
5 6 7 |
# File 'lib/visdiff/test_run.rb', line 5 def enabled @enabled end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
4 5 6 |
# File 'lib/visdiff/test_run.rb', line 4 def revision @revision end |
Instance Method Details
#enable ⇒ Object
24 25 26 |
# File 'lib/visdiff/test_run.rb', line 24 def enable self.enabled = true end |
#observe_page(identifier, page) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/visdiff/test_run.rb', line 35 def observe_page(identifier, page) return false unless enabled? tmppath = "tmp/visdiff/#{SecureRandom.hex}.png" page.driver.render(tmppath, full: true) revision.add_image identifier, tmppath end |
#revision_from_git! ⇒ Object
28 29 30 31 32 33 |
# File 'lib/visdiff/test_run.rb', line 28 def revision_from_git! git_sha, git_desc = `git rev-list --format=%B --max-count=1 HEAD`.split("\n") git_sha.gsub!(/\Acommit /, '') self.identifier = git_sha self.description = git_desc end |
#submit! ⇒ Object
18 19 20 21 22 |
# File 'lib/visdiff/test_run.rb', line 18 def submit! return false unless enabled? revision.submit! end |