Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the use of matchers from multiple libs, for non rails projects. #714

Conversation

lucasdavila
Copy link
Contributor

  • It changes shoulda-matchers to allow the integration with multiple
    libraries like active_model and active_record.

    For example, in a non Rails project isn't possible to use both
    validate_presence_of and validate_uniqueness_of matchers, because they
    are from different libraries (one from active_model and the another from
    active_record respectively).

    This change allow the integration with multiple libraries.

    fixes Undefined method validate_uniqueness_of error on sinatra app #710


subject { run_rspec_suite }

context 'in a project that uses both active_record and active_model libraries' do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]

@mcmire
Copy link
Collaborator

mcmire commented May 7, 2015

Ah. Yes -- this totally makes sense and I don't know why I overlooked this when I was adding this.

@lucasdavila lucasdavila force-pushed the integrate-with-multiple-libs branch from 3bc9087 to ffff82a Compare May 7, 2015 12:51
expect(subject).to have_output('2 examples, 0 failures')
expect(subject).to have_output('should require name to be set')
expect(subject).to have_output(
'should require case sensitive unique value for name'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent the first parameter one step more than the previous line.

@lucasdavila lucasdavila force-pushed the integrate-with-multiple-libs branch from ffff82a to 3d99399 Compare May 7, 2015 12:54
@lucasdavila
Copy link
Contributor Author

@mcmire great, I just fixed the 🐶's review.

@@ -58,8 +59,8 @@ def no_test_frameworks_added?
@test_frameworks.empty? || !@test_frameworks.any?(&:present?)
end

def library_not_set?
@library.nil?
def libraries_empty?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about no_libraries_set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, it makes sense like no_test_frameworks_added?. I will rename it.

* It changes shoulda-matchers to allow the integration with multiple
  libraries like active_model and active_record.

  For example, in a non Rails project isn't possible to use both
  validate_presence_of and validate_uniqueness_of matchers, because they
  are from different libraries (one from active_model and the other from
  active_record respectively).

  This change allow the integration with multiple libraries. fixes thoughtbot#710
@mcmire
Copy link
Collaborator

mcmire commented Jun 1, 2015

Thanks! This was merged as 721900b.

@mcmire mcmire closed this Jun 1, 2015
@lucasdavila
Copy link
Contributor Author

@mcmire 👍 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined method validate_uniqueness_of error on sinatra app
3 participants