Skip to content

Commit

Permalink
LH-629 Ensure notifier is not considered a framework gem
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Morrison committed Mar 10, 2010
1 parent d6376fc commit 390df9b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
8 changes: 8 additions & 0 deletions features/rails.feature
Expand Up @@ -83,3 +83,11 @@ Feature: Install the Gem in a Rails application
| session | value: test |
| parameters | param: value |
| url | http://example.com:123/test/index?param=value |

Scenario: The gem should not be considered a framework gem
When I generate a new Rails application
And I configure the Hoptoad shim
And I configure my application to require the "hoptoad_notifier" gem
And I run "script/generate hoptoad -k myapikey"
And I run "rake gems"
Then I should see that "hoptoad_notifier" is not considered a framework gem
9 changes: 9 additions & 0 deletions features/step_definitions/rails_application_steps.rb
Expand Up @@ -97,6 +97,12 @@
end
end

Then /^I should not see "([^\"]*)"$/ do |unexpected_text|
if @terminal.output.include?(unexpected_text)
raise("Got terminal output:\n#{@terminal.output}\n\nDid not expect the following output:\n#{unexpected_text}")
end
end

When /^I uninstall the "([^\"]*)" gem$/ do |gem_name|
@terminal.uninstall_gem(gem_name)
end
Expand Down Expand Up @@ -202,3 +208,6 @@ def initialize(*args)
Then %{I should see "[Rails: #{rails_version}]"}
end

Then /^I should see that "([^\"]*)" is not considered a framework gem$/ do |gem_name|
Then %{I should not see "[R] #{gem_name}"}
end
15 changes: 11 additions & 4 deletions generators/hoptoad/templates/hoptoad_notifier_tasks.rake
@@ -1,5 +1,12 @@
Dir[File.join(RAILS_ROOT, 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier|
$: << File.join(vendored_notifier, 'lib')
end
# Don't load anything when running the gems:* tasks.
# Otherwise, hoptoad_notifier will be considered a framework gem.
# https://thoughtbot.lighthouseapp.com/projects/14221/tickets/629
unless ARGV.any? {|a| a =~ /^gems/}

Dir[File.join(RAILS_ROOT, 'vendor', 'gems', 'hoptoad_notifier-*')].each do |vendored_notifier|
$: << File.join(vendored_notifier, 'lib')
end

require 'hoptoad_notifier/tasks'
require 'hoptoad_notifier/tasks'

end

0 comments on commit 390df9b

Please sign in to comment.