Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[Semaphoreapp]All Shoulda specs fails on random branches #221

Closed
regedarek opened this Issue · 19 comments

5 participants

@regedarek

I`m using shoulda and locally it works excellent.

But I dont know why when im pushing branches(it happens on random branches but on some this problem didn`t occurs) all my shoulda specs fails.

I reported that issue to their support. They noticed that issue in other apps too.

They sent me link to similar problem: #203

But problem still occurs. So they sent me gist which should helps me. But it isn`t.

https://gist.github.com/3754805

Last response was:

I absolutely agree it's annoying. Can you file an issue for shoulda? At this point I'm quite sure that it's something they're doing is not 100% solid. 

This is part of my Gemfile.

group :development, :test do
  gem 'rspec-rails'                         # BDD framework for ruby
  gem 'faker'                               # create fake data
  gem 'dalli'
  gem 'mocha'
end

group :development do
  gem 'rack-mini-profiler'
end

group :test do
  gem 'shoulda-matchers',            require: false
  gem 'database_cleaner'
  gem 'spork'                               # drb server
  gem 'guard-rspec'
  gem 'guard-spork'
  gem 'guard-bundler'
  gem 'factory_girl_rails', require: false
  gem 'fakeredis'
  gem 'webmock'
...
end

My Gemfile.lock -> https://gist.github.com/f36422023862cc074b87
My spec_helper -> https://gist.github.com/980fed2e82aadf566291

@gabebw
Owner

What error message are you getting?

@regedarek

All my shoulda specs fails:


  31) Link 
     Failure/Error: it { should belong_to(:app) }
     NoMethodError:
       undefined method `belong_to' for #<RSpec::Core::ExampleGroup::Nested_12:0x00000008b7a950>
     # ./spec/models/link_spec.rb:20:in `block (2 levels) in <top (required)>'

  32) Link 
     Failure/Error: it { should have_many(:link_clicks) }
     NoMethodError:
       undefined method `has_many?' for #<Link:0x00000008b8b6d8>
     # ./spec/models/link_spec.rb:21:in `block (2 levels) in <top (required)>'

  33) Link 
     Failure/Error: it { should have_many(:link_votes) }
     NoMethodError:
       undefined method `has_many?' for #<Link:0x00000008db0cd8>
     # ./spec/models/link_spec.rb:22:in `block (2 levels) in <top (required)>'

  34) Link 
     Failure/Error: it { should_not allow_mass_assignment_of(:user_id) }
     NoMethodError:
       undefined method `allow_mass_assignment_of' for #<RSpec::Core::ExampleGroup::Nested_12:0x00000008db8aa0>
     # ./spec/models/link_spec.rb:23:in `block (2 levels) in <top (required)>'

  35) Link 
     Failure/Error: it { should allow_mass_assignment_of(:title) }
     NoMethodError:
       undefined method `allow_mass_assignment_of' for #<RSpec::Core::ExampleGroup::Nested_12:0x00000008dc1920>
     # ./spec/models/link_spec.rb:24:in `block (2 levels) in <top (required)>'

  36) Link 
     Failure/Error: it { should allow_mass_assignment_of(:url) }
     NoMethodError:
       undefined method `allow_mass_assignment_of' for #<RSpec::Core::ExampleGroup::Nested_12:0x00000008dcb6f0>
     # ./spec/models/link_spec.rb:25:in `block (2 levels) in <top (required)>'

  37) Link 
     Failure/Error: it { should allow_mass_assignment_of(:app_id) }
     NoMethodError:
       undefined method `allow_mass_assignment_of' for #<RSpec::Core::ExampleGroup::Nested_12:0x00000008de1158>
     # ./spec/models/link_spec.rb:26:in `block (2 levels) in <top (required)>'

Rest of specs passes.

@damonatbrightroll

I've seen this problem as well. When running the set of specs as any of bundle exec rspec or bundle exec rake spec or rspec or rake spec, I see similar errors. If, however, I run a single spec in isolation, it works without throwing these errors.

E.g.,

1) Activation associations 
     Failure/Error: it { should belong_to(:line_item) }
     NoMethodError:
       undefined method `belong_to' for #<RSpec::Core::ExampleGroup::Nested_2::Nested_1:0x007fe4c7a23a38>
     # ./spec/models/activation_spec.rb:7:in `block (3 levels) in <top (required)>'

2) Activation validations 
     Failure/Error: it { should validate_presence_of(:line_item_id) }
     NoMethodError:
     undefined method `validate_presence_of' for #<RSpec::Core::ExampleGroup::Nested_2::Nested_2:0x007fe4c79a85b8>
     # ./spec/models/activation_spec.rb:15:in `block (3 levels) in <top (required)>'

3) Activation validations 
     Failure/Error: it { should validate_presence_of(:msg_id) }
     NoMethodError:
       undefined method `validate_presence_of' for #<RSpec::Core::ExampleGroup::Nested_2::Nested_2:0x007fe4c79a5cf0>
     # ./spec/models/activation_spec.rb:17:in `block (3 levels) in <top (required)>'

4) Activation validations 
     Failure/Error: it { should ensure_length_of(:msg_id).is_at_most(Activation::MAXIMUM_LENGTH_OF_MSG_ID) }
     NoMethodError:
       undefined method `ensure_length_of' for #<RSpec::Core::ExampleGroup::Nested_2::Nested_2:0x007fe4c79ab3f8>
     # ./spec/models/activation_spec.rb:18:in `block (3 levels) in <top (required)>'

etc.

@gabebw
Owner

@damonatbrightroll : Is this in the context of CI (semaphore app) or in normal local usage?

@damonatbrightroll

@gabebw Normal local usage.

@gabebw
Owner

@damonatbrightroll : Can you open another issue? I think yours is separate. Please include your Gemfile as well. Thanks!

@damonatbrightroll

@gabebw Opened as issue #224.

@gabebw
Owner

Thanks!

@damonatbrightroll

I am seeing this in the context of CI (Jenkins) now as well. I opened a separate ticket at thoughtbot/shoulda-matchers#174 as well.

@thibaudgg

We also get this issue on the Semaphore CI, have you been able to fix it? Thanks!

@gabebw
Owner

Does this still fail if you remove Spork?

@damonatbrightroll

I was seeing the issue without using Spork.

@gabebw
Owner

@damonatbrightroll, @regedarek, I've just merged thoughtbot/shoulda-matchers#204 into master a few seconds ago. If you use the shoulda-matchers from HEAD, does that fix your problem?

# Gemfile
gem "shoulda-matchers", :git => "git://github.com/thoughtbot/shoulda-matchers.git",
  :ref => "cc03053"
@gabebw
Owner

Just to confirm - that does fix your problem?

@regedarek

Yes. Thanks.

@gabebw
Owner

I'm going to close this. I'm glad your issue got fixed.

Happy holidays to me and @drapergeek, only 1 issue remaining on this project :)

@gabebw gabebw closed this
@damonatbrightroll

@gabebw, I confirmed that this fixes my problem. Thanks to you and @regedarek for the help. I'm looking forward to seeing this released as a versioned update!

@kurko

For anyone having problems with this, Shoulda is fine on 3.3.2, but it depends on should-matchers 1.4.1, which is bugged. I defined 1.4.2 in my Gemfile and things are working again.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.