bcardarella / valid_attribute

Minimalist validation BDD for ActiveModel specs
178 stars 18 forks source link

Gemfile: valid_attribute and rspec #5

Closed tapajos closed 13 years ago

tapajos commented 13 years ago

If you add gem 'valid_attribute' before rspec gem the defined?(RSpec) will be nil but you still want to use RSpec.

Maybe the best option is use gem 'valid_attribute', :require => false

bcardarella commented 13 years ago

Can you change the pull request to remove b5753c5

tapajos commented 13 years ago

Brian,

git remote add tapajos git@github.com:tapajos/valid_attribute.git git fetch tapajos git cherry-pick -s 390950ed52c15f43c6f0

tapajos commented 13 years ago

Brian,

The require 'valid_attribute' is not necessary because bundler always do it.

bcardarella commented 13 years ago

@tapajos yup, I understand that. I want to merge on Github itself and won't do so until b5753c5 is removed. If you could please update the commit range on the pull request I'd be happy to accept.

tapajos commented 13 years ago

Brian,

I removed b5753c5 from my repository.

BTW, I really don't agree with keep .rvmrc into the repository. I don't want to use the same rvmrc that you are using. All developers should be able to use your .rvmrc.

bcardarella commented 13 years ago

@tapajos

I completely disagree. Thanks for the pull request.

tapajos commented 13 years ago

Brian,

The require 'valid_attribute' is not necessary because bundler always do it. I have some suggestions:

1 - Add ':require => false' to Readme. 2 - Remove spec_helper require from Readme 3 - Keep require 'valid_attribute' spec_require and remove this code

if defined?(RSpec)
  require 'valid_attribute/rspec'
else
  require 'valid_attribute/test_unit'
end
bcardarella commented 13 years ago

@tapajos

That depends upon how you are loading your test environment. require 'valid_attribute' doesn't take anything away from your load time.

tapajos commented 13 years ago

I'm sure that depends of the test environment but for the environment described in Readme file it is not necessary.

I'm trying to help.

bcardarella commented 13 years ago

Oh, I see your point now. So the issue here is covering all the bases for people. The spec_helper.rb file may not be calling Bundler.setup at any point. If you are using rspec-rails it would, but ValidAttribute it not tied to Rails at all. After developing multiple gems the best course of action for the READMEs is to always give install instructions that allow the best chance of the gem working almost everywhere. :)