View example_integration_test.rb
require 'integration/spec_helper' | |
feature 'New user sign up', :js => true do | |
pages :home_page, :registration_page, :registration_complete_page | |
let(:user_email) { 'matt@econsultancy.com' } | |
scenario %{ | |
User arrives on the home page, follows the sign up promotion, | |
fills in the form incorrectly, then corrects their mistakes, |
View application.rb
# insert within your Application | |
config.middleware.insert_before(0, Rack::CloudFlareFixup) |
View assign_locals_helper.rb
def assigns_local(key) | |
controller.instance_variable_get('@patched_locals')[key] | |
end | |
def patch_controller_render_to_support_locals(controller) | |
def controller.render(options = nil, extra_options = {}, &block) | |
[options, extra_options].select { |o| o.kind_of?(Hash) }.each do |option_hash| | |
if option_hash.include?(:locals) | |
@patched_locals = option_hash[:locals] | |
end |
View view_spec.rb
describe 'JSON view test' do | |
let(:partial) { 'admin/case_studies/_item.json' } | |
let(:case_study) { build_stubbed(:case_study) } | |
it 'should render item partial' do | |
JSON.parse(render_item_partial).should == { | |
id: case_study.id, | |
title: case_study.title, | |
whatever: case_study.title | |
} |
View gist:7374708
AccountService.sign_up | |
AccountService.sign_up_for_existing_membership | |
AccountService.leave_membership | |
AccountService.move_to_new_membership | |
sign_up = AccountService.sign_up | |
if sign_up.success | |
... | |
else | |
errors = sign_up.errors |
View rerun_rspec.rb
results = File.expand_path('../tmp/failing_specs.log', __FILE__) | |
if File.exists?(test_file) | |
tests = File.open(test_file).read.scan(/rspec .\/([^:]+:\d+)/) | |
if tests.present? | |
Dir.chdir(Rails.root) do | |
command = "bundle exec rspec #{tests.join(' ')}" | |
end | |
end | |
end |
View fiddle.html
<div>Ably Quickstart example</div> | |
<ul id="output"> | |
</ul> | |
Message: <input id="message" type="text" value="Hello"><br> | |
<input type="submit" id="publish" value="Publish the message"> | |
</html> |
View fiddle.css
body { | |
font-family: Helvetica, Verdana | |
} | |
p { | |
padding: 7px 10px; | |
} | |
#demo { | |
border: 1px solid #999; | |
} |
View fiddle.html
<div>Ably Quickstart example</div> | |
<ul id="output"> | |
</ul> | |
Message: <input id="message" type="text" value="Hello"><br> | |
<input type="submit" id="publish" value="Publish the message"> | |
</html> |
View somethingelse.vb
ASdsad |