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

Commit

Permalink
Crop spec and documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
arcticleo committed Aug 26, 2020
1 parent 88f892e commit a48ec86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ screenshot = Gastly.screenshot('http://google.com', selector: '#hplogo', timeout
image = screenshot.capture
```

You can resize or change the format of the screenshot:
You can resize, crop or change the format of the screenshot:

```ruby
image = screenshot.capture
image.crop(width: 250, height: 250, x: 10, y: 0) # Crop with an offset
image.resize(width: 110, height: 110) # Creates a preview of the web page
image.format('png')
image.save('output.png')
Expand Down
8 changes: 8 additions & 0 deletions spec/gastly/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
end
end

context '#crop' do
it 'invokes method #crop with arguments' do
width, height, x, y = 100, 100, 0, 0
expect_any_instance_of(MiniMagick::Image).to receive(:crop).with("#{width}x#{height}+#{x}+#{y}")
subject.crop(width: 100, height: 100, x: 0, y: 0)
end
end

context '#format' do
it 'invokes method #format' do
ext = 'png'
Expand Down

0 comments on commit a48ec86

Please sign in to comment.