Class: Betterspecs::RSpec
- Inherits:
-
Object
- Object
- Betterspecs::RSpec
- Includes:
- Capybara::DSL
- Defined in:
- lib/betterspecs/rspec.rb
Instance Attribute Summary collapse
-
#objects ⇒ Object
Returns the value of attribute objects.
Instance Method Summary collapse
- #dump(path, objects) ⇒ Object
- #fullpath(path) ⇒ Object
-
#initialize(path, options) ⇒ RSpec
constructor
A new instance of RSpec.
- #screenshot(path) ⇒ Object
Constructor Details
#initialize(path, options) ⇒ RSpec
Returns a new instance of RSpec.
9 10 11 12 |
# File 'lib/betterspecs/rspec.rb', line 9 def initialize(path,) @path = File.join "betterspecs", path.to_s @objects = .keys end |
Instance Attribute Details
#objects ⇒ Object
Returns the value of attribute objects.
7 8 9 |
# File 'lib/betterspecs/rspec.rb', line 7 def objects @objects end |
Instance Method Details
#dump(path, objects) ⇒ Object
20 21 22 23 24 |
# File 'lib/betterspecs/rspec.rb', line 20 def dump(path, objects) File.open(fullpath("#{path}.json"),"w") do |f| f.write(objects.to_json) end end |
#fullpath(path) ⇒ Object
14 15 16 17 18 |
# File 'lib/betterspecs/rspec.rb', line 14 def fullpath(path) path = File.join [@path, path].compact FileUtils.mkdir_p File.dirname(path) path end |
#screenshot(path) ⇒ Object
26 27 28 |
# File 'lib/betterspecs/rspec.rb', line 26 def screenshot(path) page.driver.save_screenshot fullpath("#{path}.jpg") end |