Showing posts with label rspec. Show all posts
Showing posts with label rspec. Show all posts

Wednesday, 8 May 2013

regex to update from rspec 1 to rspec 2

Rspec 2 removes assign_to and replace it with assigns, here are the regex I'm using in sublime text 2 for the update:


should assign_to\((.*)\).with\(nil\)
assigns($1).should be_nil

should assign_to\(:(.+)\).with\((.+)\)
assigns(:$1).should == $2

should_not assign_to\(:(.*)\)
assigns(:$1).should be_nil

should assign_to\(:(.*)\)
assigns(:$1).should_not be_nil


Links to some doc here

Saturday, 23 February 2013

rspec, capybara and factorygirl hints

# spec_helper.rb

# this line will make rpsec end at the first failing test
RSpec.configure do |c|
  c.fail_fast = true
end
# in integration specs

# xpath can be copied from chrome, rx-click on the element (in the dev-tool)
page.should have_xpath("//a[contains(@href,'users')]"), count: num)

Saturday, 24 March 2012

Keeping the environment updated

Use with caution, anyway.
rvm get latest --auto
rvm install 1.9.3
gem update --system # 1.3.7 # that's it for downgrading
gem update bundler  # which I actually keep in my Gemfile
bundle update