penchant/features/gemfile.feature

127 lines
3.6 KiB
Gherkin
Raw 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: 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
Then the file "Gemfile" should have the following 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:
"""
<% with_gem_list 'test' do %>
<% env :local, :path => '../%s' do %>
<%= gem %>
<% end %>
<% end %>
"""
When I rebuild the Gemfile for "local" mode
Then the file "Gemfile" should have the following 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:
"""
<% with_gem_list 'test' do %>
<%= 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
gem 'test', :path => %{../test}
"""
Scenario: Use a gem list without a block
Given I have the file "Gemfile.erb" with the content:
"""
<% with_gem_list '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
gem 'test', :path => %{../test}
"""
Scenario: Use a gem list with an array
Given I have the file "Gemfile.erb" with the content:
"""
<% with_gem_list [ '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
gem 'test', :path => %{../test}
"""
Scenario: Use another 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
gem 'test', :path => %{../test}
"""