-
rspec-rails 3 deprecation warnings scripts and fixes
Upon upgrading to rspec 2.99.0, I began to receive deprecation warnings for several things that had issues, and to do a few updates: Because the project was using its syntax and stub_model I needed to add that functionality back into rspec in the :test group of my Gemfile: # Support for its syntax gem ‘rspec-its’, ‘~>…
-
mkdir with intermediate directories and rails generate view spec
I’ve been running into a lot of cases where I need to build intermediate directories for a path. Apparently, the correct option is -p mkdir -p dir/tree/to/make From the mkdir man page: -p Create intermediate directories as required. If this option is not specified, the full path prefix of each operand must already exist. On…
-
rspec before(:all) is tempting but stubs don’t play nicely with it.
I was looking at an rspec test with multiple expectations in the same example. before(:all) do SpecialClient.any_instance.stub(:login).and_return { true } end # # MUCH SPACE # # WOW # it “does stuff successfully” do # preceding code, including controller action expect(result.valid?).to be_true expect(response.body).to match /All is happy/ expect(response.code).to eq “200” end I wanted to add…