Collapse feature steps for brevity

This commit is contained in:
Joseph Wynn 2014-12-07 13:14:40 +00:00
parent 6f9f13e62f
commit 93890f5ee0
3 changed files with 20 additions and 42 deletions

View File

@ -4,10 +4,7 @@ Feature: Jekyll responsive_image_block tag
In order to dynamically generate my responsive images In order to dynamically generate my responsive images
Scenario: Simple image tag Scenario: Simple image tag
Given I have a responsive_image configuration with: Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
"""
template: _includes/responsive-image.html
"""
And I have a file "index.html" with: And I have a file "index.html" with:
""" """
{% assign path = 'assets/test.png' %} {% assign path = 'assets/test.png' %}
@ -23,10 +20,7 @@ Feature: Jekyll responsive_image_block tag
Then I should see "<img alt=\"Lorem ipsum\" src=\"/assets/test.png\" title=\"Magic rainbow adventure!\"" in "_site/index.html" Then I should see "<img alt=\"Lorem ipsum\" src=\"/assets/test.png\" title=\"Magic rainbow adventure!\"" in "_site/index.html"
Scenario: More complex logic in the block tag Scenario: More complex logic in the block tag
Given I have a responsive_image configuration with: Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
"""
template: _includes/responsive-image.html
"""
And I have a file "index.html" with: And I have a file "index.html" with:
""" """
{% assign path = 'assets/test.png' %} {% assign path = 'assets/test.png' %}

View File

@ -4,38 +4,23 @@ Feature: Jekyll responsive_image tag
In order to best cater for devices of all sizes In order to best cater for devices of all sizes
Scenario: Simple image tag Scenario: Simple image tag
Given I have a responsive_image configuration with: Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
""" And I have a file "index.html" with "{% responsive_image path: assets/test.png alt: Foobar %}"
template: _includes/responsive-image.html
"""
And I have a file "index.html" with:
"""
{% responsive_image path: assets/test.png alt: Foobar %}
"""
When I run Jekyll When I run Jekyll
Then I should see "<img alt=\"Foobar\" src=\"/assets/test.png\"" in "_site/index.html" Then I should see "<img alt=\"Foobar\" src=\"/assets/test.png\"" in "_site/index.html"
Scenario: Adding custom attributes Scenario: Adding custom attributes
Given I have a responsive_image configuration with: Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
"""
template: _includes/responsive-image.html
"""
And I have a file "index.html" with: And I have a file "index.html" with:
""" """
{% responsive_image path: assets/test.png alt: Foobar title: "Lorem Ipsum" %} {% responsive_image path: assets/test.png alt: 'Foobar bazbar' title: "Lorem Ipsum" %}
""" """
When I run Jekyll When I run Jekyll
Then I should see "<img alt=\"Foobar\" src=\"/assets/test.png\" title=\"Lorem Ipsum\"" in "_site/index.html" Then I should see "<img alt=\"Foobar bazbar\" src=\"/assets/test.png\" title=\"Lorem Ipsum\"" in "_site/index.html"
Scenario: UTF-8 attributes Scenario: UTF-8 attributes
Given I have a responsive_image configuration with: Given I have a responsive_image configuration with "template" set to "_includes/responsive-image.html"
""" And I have a file "index.html" with "{% responsive_image path: assets/test.png alt: ' ' %}"
template: _includes/responsive-image.html
"""
And I have a file "index.html" with:
"""
{% responsive_image path: assets/test.png alt: " " %}
"""
When I run Jekyll When I run Jekyll
Then I should see "<img alt=\" \" src=\"/assets/test.png\"" in "_site/index.html" Then I should see "<img alt=\" \" src=\"/assets/test.png\"" in "_site/index.html"
@ -47,10 +32,7 @@ Feature: Jekyll responsive_image tag
- width: 100 - width: 100
- width: 200 - width: 200
""" """
And I have a file "index.html" with: And I have a file "index.html" with "{% responsive_image path: assets/test.png %}"
"""
{% responsive_image path: assets/test.png %}
"""
When I run Jekyll When I run Jekyll
Then I should see "<img alt=\"\" src=\"/assets/test.png\"" in "_site/index.html" Then I should see "<img alt=\"\" src=\"/assets/test.png\"" in "_site/index.html"
And I should see "/assets/resized/test-100x50.png 100w" in "_site/index.html" And I should see "/assets/resized/test-100x50.png 100w" in "_site/index.html"
@ -68,10 +50,7 @@ Feature: Jekyll responsive_image tag
- width: 200 - width: 200
- width: 300 - width: 300
""" """
And I have a file "index.html" with: And I have a file "index.html" with "{% responsive_image path: assets/test.png template: _includes/custom-template.html %}"
"""
{% responsive_image path: assets/test.png template: _includes/custom-template.html %}
"""
When I run Jekyll When I run Jekyll
Then I should see "[100, 200, 300]" in "_site/index.html" Then I should see "[100, 200, 300]" in "_site/index.html"
@ -83,10 +62,7 @@ Feature: Jekyll responsive_image tag
sizes: sizes:
- width: 100 - width: 100
""" """
And I have a file "index.html" with: And I have a file "index.html" with "{% responsive_image path: assets/test.png %}"
"""
{% responsive_image path: assets/test.png %}
"""
When I run Jekyll When I run Jekyll
Then I should see "/assets/test.png-resized/100/test-50.png 100w" in "_site/index.html" Then I should see "/assets/test.png-resized/100/test-50.png 100w" in "_site/index.html"
And the file "assets/test.png-resized/100/test-50.png" should exist And the file "assets/test.png-resized/100/test-50.png" should exist

View File

@ -6,10 +6,18 @@ Given /^I have a responsive_image configuration with:$/ do |config|
write_file('_config.yml', "responsive_image:\n#{config}") write_file('_config.yml', "responsive_image:\n#{config}")
end end
Given /^I have a responsive_image configuration with "(.+)" set to "(.+)"$/ do |config, value|
write_file('_config.yml', "responsive_image:\n #{config}: #{value}")
end
Given /^I have a file "(.+)" with:$/ do |path, contents| Given /^I have a file "(.+)" with:$/ do |path, contents|
write_file(path, "---\n---\n#{contents}") write_file(path, "---\n---\n#{contents}")
end end
Given /^I have a file "(.+)" with "(.+)"$/ do |path, contents|
write_file(path, "---\n---\n#{contents}")
end
Then /^I should see "(.+)" in "(.*)"$/ do |text, file| Then /^I should see "(.+)" in "(.*)"$/ do |text, file|
assert_match(Regexp.new(text), File.open(file).readlines.join) assert_match(Regexp.new(text), File.open(file).readlines.join)
end end