penchant/features/gemfile.feature

124 lines
3.6 KiB
Gherkin
Raw Permalink Normal View History

@fakefs
Feature: Gemfiles
Scenario: When rebuilding for deployment, save the original state
Given I have the file "Gemfile.erb" with the content:
"""
this is content
"""
And I have the file "Gemfile" with the content:
"""
# generated by penchant, environment: local
"""
When I rebuild the Gemfile for "production" mode with deployment
Then the file "Gemfile" should have the following content:
"""
# generated by penchant, environment: production, deployment mode (was local)
this is content
"""
Scenario: When unbundling from deployment with an original state, switch to that state
Given I have the file "Gemfile.erb" with the content:
"""
this is content
"""
And I have the file "Gemfile" with the content:
"""
# generated by penchant, environment: production, deployment mode (was local)
"""
When I rebuild the Gemfile asking to switch back to the previous state
Then the file "Gemfile" should have the following content:
"""
# generated by penchant, environment: local
this is content
"""
Scenario: Simple env
Given I have the file "Gemfile.erb" with the content:
"""
2012-06-08 19:25:04 +00:00
gem 'test'
<% env :local do %>
gem 'test'
<% end %>
"""
When I rebuild the Gemfile for "local" mode
Then the file "Gemfile" should have the following stripped content:
"""
# generated by penchant, environment: local
gem 'test'
2012-06-08 19:25:04 +00:00
gem 'test'
"""
2012-06-08 19:25:04 +00:00
Scenario: Use placeholder expansion
Given I have the file "Gemfile.erb" with the content:
"""
<% env :local, :path => '../%s' do %>
gem 'test'
<% end %>
"""
When I rebuild the Gemfile for "local" mode
2012-06-05 12:20:48 +00:00
Then the file "Gemfile" should have the following stripped content:
"""
# generated by penchant, environment: local
gem 'test', {:path=>"../test"}
"""
Scenario: Use a gem list for an operation
Given I have the file "Gemfile.erb" with the content:
"""
2012-06-05 19:29:27 +00:00
<% gems 'test' do %>
<% env :local, :path => '../%s' do %>
<%= gem %>
<% end %>
<% end %>
"""
When I rebuild the Gemfile for "local" mode
2012-06-05 12:20:48 +00:00
Then the file "Gemfile" should have the following stripped content:
"""
# generated by penchant, environment: local
gem 'test', {:path=>"../test"}
"""
2012-06-05 11:50:33 +00:00
Scenario: Let gem get additional info
Given I have the file "Gemfile.erb" with the content:
"""
2012-06-05 19:29:27 +00:00
<% gems 'test' do %>
2012-06-05 11:50:33 +00:00
<%= gem :path => '../%s' %>
<% end %>
"""
When I rebuild the Gemfile for "local" mode
Then the file "Gemfile" should have the following content:
"""
# generated by penchant, environment: local
2012-06-05 19:29:27 +00:00
gem 'test', {:path=>"../test"}
2012-06-05 11:50:33 +00:00
"""
Scenario: Use a gem list without a block
Given I have the file "Gemfile.erb" with the content:
"""
2012-06-05 19:29:27 +00:00
<% gems 'test', :path => '../%s' %>
2012-06-05 11:50:33 +00:00
"""
When I rebuild the Gemfile for "local" mode
Then the file "Gemfile" should have the following content:
"""
# generated by penchant, environment: local
2012-06-05 19:29:27 +00:00
gem 'test', {:path=>"../test"}
2012-06-05 11:50:33 +00:00
"""
Scenario: Use a gem list with an array
Given I have the file "Gemfile.erb" with the content:
"""
<% gems [ 'test' ], :path => '../%s' %>
"""
When I rebuild the Gemfile for "local" mode
Then the file "Gemfile" should have the following content:
"""
# generated by penchant, environment: local
2012-06-05 19:29:27 +00:00
gem 'test', {:path=>"../test"}
2012-06-05 11:50:33 +00:00
"""