Reputation: 674
I have a gem installed on my rails 3 application that runs smoothly, But when I run the cucumber tests, that gem is missing to get the user atributes. And actually it is the way it should be because of the security management. ( no login == no information )
So, I am wondering if there is any way to disable this gem while I am running the cucumber test ? so that i get no error based on this gem.
thanks in advance !
Upvotes: 1
Views: 1157
Reputation: 674
After checking the problem with my colleague, we decided on the solution that seems almost OK to do it in this way,
Since we dont want the specific gem function to get into play during the test process, we decided to use
acts_as_specificgem(do this do that) unless Rails.env == "test"
No need to repeat ourselves at test scenarios and looks more clean.
cheers!
Upvotes: 0
Reputation: 2682
In your gemfile, you can add the gem in a particular environment. i.e.
group :development, :production do
gem 'yahoo-weather'
end
This gem will only be added in the development and production env only. It wont be present in the testing environment.
Upvotes: 4