Skip to content

Instantly share code, notes, and snippets.

@wevtimoteo
Created April 27, 2017 11:34
Show Gist options
  • Save wevtimoteo/430fe8b9bb93062a59dd1517f7d782a9 to your computer and use it in GitHub Desktop.
Save wevtimoteo/430fe8b9bb93062a59dd1517f7d782a9 to your computer and use it in GitHub Desktop.
14o. FloripaOnRails - I want to test my code but how to do it
Feature: champion uses dragonfly to process images
In order to be a champion
A user uses dragonfly
Background:
Given we are using the app for images
Given a stored image "beach.png" with dimensions 200x100
Scenario: Go to url for original
When I go to the url for "beach.png", with format 'png'
Then the response should be OK
And the response should have mime-type 'image/png'
And the image should have width '200'
And the image should have height '100'
And the image should have format 'png'
Scenario: Go to url for changed format version
When I go to the url for "beach.png", with format 'gif'
Then the response should be OK
And the response should have mime-type 'image/gif'
And the image should have width '200'
And the image should have height '100'
And the image should have format 'gif'
class Calculator
def self.sum(a, b)
a + b
end
end
require 'minitest/autorun'
class CalculatorTest < Minitest::Unit::TestCase
def test_sum_with_positive_numbers
assert_equal(3, Calculator.sum(1, 2))
end
def test_sum_with_negative_numbers
assert_equal(1, Calculator.sum(-1, 2))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment