FAQ Database Discussion Community


let! in rspec association not accessing previously created let! variable

ruby,ruby-on-rails-3,associations,rspec2
I am using RSpec 2 and trying to load a few instance variables at the top of a model spec. They are associated, but the associations aren't coming through. The models are Column and Table -- this is not a problem the way we have it set up. Table has_many...

`require': cannot load such file — spec_helper (LoadError)

ruby,rspec,rspec2,rspec-rails,rspec3
I am creating bundler gem --test=rspec MyGem. in which i m getting reository structure. while i m runing rspec code i m getting error. `require': cannot load such file -- spec_helper (LoadError) I try to apply require relative still i m getting error like [email protected]:~/sheetal/spec$ rspec sheetal_spec.rb \/home/sheetal/.rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot...

Rspec test NameError: uninitialized constant trying to tie a class into a rspec test

ruby,rspec,rspec2
So I"m not too familiar with ruby or rspec, and I have an rspect test, and here is a code snippet from it: describe 'thingMagic' do let(:tester) { testClass.testing } it { expect(tester).to be whatever doesn't matter at this point So I wrote a class called testClass with a method...

Lost trying to make the rspec test pass

ruby-on-rails,ruby,testing,rspec,rspec2
I have this class: class Zombie < ActiveRecord::Base attr_accessible :iq validates :name, presence: true def genius? iq >= 3 end def self.genius where("iq >= ?", 3) end end And I am making the rspec test: describe Zombie do context "with high iq" do let!(:zombie) { Zombie.new(iq: 3, name: 'Anna') }...