Skip to content

Instantly share code, notes, and snippets.

@TaniaSwan
TaniaSwan / webpack.rb
Created December 29, 2017 09:23 — forked from naps62/webpack.rb
Run webpacker before test suite, only if a test tagged with JS is selected
# spec/support/webpack.rb
module WebpackTestBuild
TS_FILE = Rails.root.join("tmp", "webpack-spec-timestamp")
class << self
attr_accessor :already_built
end
def self.run_webpack
puts "running webpack-test"
@TaniaSwan
TaniaSwan / capybara cheat sheet
Created December 29, 2017 08:53 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@TaniaSwan
TaniaSwan / rspec_rails_cheetsheet.rb
Created December 29, 2017 08:18 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet (include capybara matchers)
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
response.should render_template(:index)
#Redirecting
response.should redirect_to(movies_path)