<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dean Marano on Medium]]></title>
        <description><![CDATA[Stories by Dean Marano on Medium]]></description>
        <link>https://medium.com/@deanmarano?source=rss-5affaac2c1aa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*EfkR_QcBTDtxjCL4.jpg</url>
            <title>Stories by Dean Marano on Medium</title>
            <link>https://medium.com/@deanmarano?source=rss-5affaac2c1aa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 16:41:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@deanmarano/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Testing Your Jekyll Site, The Ruby Way]]></title>
            <link>https://medium.com/espark-engineering-blog/testing-your-jekyll-site-the-ruby-way-ccfa386a8318?source=rss-5affaac2c1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccfa386a8318</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Dean Marano]]></dc:creator>
            <pubDate>Thu, 07 Jul 2016 15:55:32 GMT</pubDate>
            <atom:updated>2016-07-07T15:58:27.365Z</atom:updated>
            <content:encoded><![CDATA[<p>Here at eSpark Learning, we use <a href="https://jekyllrb.com/">Jekyll</a> to host our marketing site, <a href="https://www.esparklearning.com/">https://www.esparklearning.com</a>. At eSpark Engineering, we love automated testing — most of our codebases require a passing test suite for all changes. As we add more javascript to our Jekyll site, we wanted to add a test framework that would give us real world tests — testing that the HTML was valid was no longer enough.</p><h3>Acceptance Testing with RSpec, Capybara, and Selenium</h3><p>To create real world acceptance tests for our site, we used a few technologies we were familiar with:</p><ul><li><a href="http://rspec.info/">RSpec</a> — Behavior Driven Development for Ruby</li><li><a href="https://github.com/jnicklas/capybara">Capybara</a> — Testing of web applications via simulation of a real user’s interaction with your app</li><li><a href="http://www.seleniumhq.org/">Selenium</a> — Browser automation</li></ul><p>This trifecta sets up a way to write tests (RSpec) and drive the browser (Selenium) using a acceptance test API (Capybara). This gets us most of the way there, but we’re left with one problem — how do we serve the static site, so we can actually test it?</p><h3>Enter Rack-Jekyll</h3><p>Most popular Ruby applications (such as Ruby on Rails and Sinatra) use the <a href="http://rack.github.io/">Rack</a> interface to connect web requests to Ruby code. Since Jekyll generates static pages, it doesn’t have a Rack interface by default — however R<a href="https://github.com/adaoraul/rack-jekyll">ack-Jekyll</a> is a gem that bridges the gap, and allows us to serve our pages to Selenium so we can test it using the browser.</p><h3>Testing Jekyll, From Scratch</h3><p>Starting from a Jekyll site, we’ll walk through the steps in getting setup with your first test. For the purposes of this example, we’ll start with a clean Jekyll site.</p><pre>jekyll new tested-jekyll<br>cd tested-jekyll</pre><h3>Setting Up Your Gemfile</h3><p>If you don’t already have one, we’re going to create a Gemfile so we can include additional gems.</p><p>Gemfile</p><pre>source &#39;https://rubygems.org&#39;</pre><pre>gem &quot;jekyll&quot;</pre><pre>group :development, :test do<br>  gem &quot;rspec&quot;<br>  gem &quot;selenium-webdriver&quot;<br>  gem &quot;chromedriver-helper&quot;<br>  gem &quot;capybara&quot;<br>  gem &quot;rack-jekyll&quot;<br>  gem &quot;pry&quot;<br>end</pre><p>Note: <a href="http://pryrepl.org/">Pry</a> is a debugger that we use for debugging Ruby, and <a href="https://github.com/flavorjones/chromedriver-helper">chromedriver-helper</a> allows us to use the Google Chrome browser instead of the default Firefox browser.</p><p>After you’ve created this, run bundle install to install the gems.</p><h3>Setting Up RSpec</h3><p>Next, we’ll generate the necessary configuration files for RSpec using rspec — init.</p><pre>$ rspec --init<br>  create   .rspec<br>  create   spec/spec_helper.rb</pre><p>This creates two files — .rspec is a configuration file for RSpec output, and spec/spec_helper.rb is the file that loads your tests and configures the environment. To setup RSpec to use Capybara and Rack-Jekyll, we’ll need to modify this file as noted:</p><p>spec/spec_helper.rb</p><pre># Require all of the necessary gems<br>require &#39;rspec&#39;<br>require &#39;capybara/rspec&#39;<br>require &#39;rack/jekyll&#39;<br>require &#39;rack/test&#39;<br>require &#39;pry&#39;</pre><pre>RSpec.configure do |config|<br>  config.expect_with :rspec do |expectations|<br>    expectations.include_chain_clauses_in_custom_matcher_descriptions = true<br>  end</pre><pre>  config.mock_with :rspec do |mocks|<br>    mocks.verify_partial_doubles = true<br>  end</pre><pre>  # Configure Capybara to use Selenium.<br>  Capybara.register_driver :selenium do |app|<br>    # Configure selenium to use Chrome.<br>    Capybara::Selenium::Driver.new(app, :browser =&gt; :chrome)<br>  end</pre><pre>  # Configure Capybara to load the website through rack-jekyll.<br>  # (force_build: true) builds the site before the tests are run,<br>  # so our tests are always running against the latest version<br>  # of our jekyll site.<br>  Capybara.app = Rack::Jekyll.new(force_build: true)<br>end</pre><p>Note: For brevity, all generated comments have been removed</p><h3>Writing Your First Test</h3><p>Create a file in the spec/ directory called sample_spec.rb. The *_spec.rb suffix is needed for all files you want RSpec to run automatically.</p><p>spec/sample_spec.rb</p><pre>describe &quot;sample&quot;, type: :feature, js: true do<br>  it &quot;has the page title&quot; do<br>    visit &#39;/&#39;<br>    # `binding.pry` is useful for crafting the right selector<br>    # or checking the actual state of the page<br>    binding.pry # test will pause here<br>    expect(find(&#39;.post-link&#39;).text).to eq(&#39;Welcome to Jekyll!&#39;)<br>  end<br>end</pre><p>Then run bundle exec rspec. This will</p><ul><li>Build your Jekyll site</li><li>Open a Chrome browser</li><li>Run your tests</li><li>Pause after the page loads.</li></ul><pre>$ bundle exec rspec<br>Configuration file: /Users/dean/github/espark/tested-jekyll/_config.yml<br>Generating site: /Users/dean/github/espark/tested-jekyll -&gt; /Users/dean/github/espark/tested-jekyll/_site</pre><pre>From: /Users/dean/github/espark/tested-jekyll/spec/sample_spec.rb @ line 4 :</pre><pre>    1: describe &quot;sample&quot;, type: :feature, js: true do<br>    2:   it &quot;has the page title&quot; do<br>    3:     visit &#39;/&#39;<br> =&gt; 4:     binding.pry<br>    5:     expect(find(&#39;.post-link&#39;).text).to eq(&#39;Welcome to Jekyll!&#39;)<br>    6:   end<br>    7: end</pre><pre>[1] pry(#&lt;RSpec::ExampleGroups::Sample&gt;)&gt; exit<br>.</pre><pre>Finished in 4.16 seconds (files took 0.88228 seconds to load)<br>1 example, 0 failures</pre><p>I’ve left a binding.pry debugger point, which will allow you to interact with the page using Capybara’s find, find_all, click, etc. For more documentation on how to use Capybara to interact with your page, check out <a href="http://www.rubydoc.info/github/jnicklas/capybara#The_DSL">the Domain Specific Language (DSL) documentation</a>.</p><p>To exit pry, you can use ctrl-d or type exit. The test should run, and complete successfully. You can remove the binding.pry to have the tests run without user interaction.</p><h3>Conclusion</h3><p>If all went well, you should have a complete acceptance testing framework for your Jekyll site. From here, it’s easy to set up with your Continuous Integration testing platform (we use <a href="https://circleci.com/">CircleCI</a>) to run tests on every branch before merging.</p><p>We’ve been using this to ensure our autocomplete forms work as expected, our modals don’t break as we refactor code, and that our new features work as expected. You can find an example repo <a href="https://github.com/eSpark/tested-jekyll">on Github at espark/tested-jekyll</a>. Happy testing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccfa386a8318" width="1" height="1" alt=""><hr><p><a href="https://medium.com/espark-engineering-blog/testing-your-jekyll-site-the-ruby-way-ccfa386a8318">Testing Your Jekyll Site, The Ruby Way</a> was originally published in <a href="https://medium.com/espark-engineering-blog">eSpark Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learnings from Making a Google Map Component — Ember Property Setters]]></title>
            <link>https://medium.com/@deanmarano/learnings-from-making-a-google-map-component-ember-property-setters-48718c30a6b7?source=rss-5affaac2c1aa------2</link>
            <guid isPermaLink="false">https://medium.com/p/48718c30a6b7</guid>
            <dc:creator><![CDATA[Dean Marano]]></dc:creator>
            <pubDate>Thu, 12 Feb 2015 22:10:57 GMT</pubDate>
            <atom:updated>2015-02-12T22:10:57.881Z</atom:updated>
            <content:encoded><![CDATA[<p>I was recently working on an Ember app with some people who are new to the framework. We created a Google Map component, and while reviewing the code I came across this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1d8b60cf2a55a1edcb63356b0313012/href">https://medium.com/media/d1d8b60cf2a55a1edcb63356b0313012/href</a></iframe><p>At first glance, it wasn’t too bad. Sure, in their template and everywhere in the code they used `currentLocations`, but it worked. Then, an Ember buddha whispered quietly to me “property setter.” After a quick refactor, the code looked like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/140fcaefb5e0597cd92bd8ac3d88290f/href">https://medium.com/media/140fcaefb5e0597cd92bd8ac3d88290f/href</a></iframe><p>At first glance, it’s obvious that the new code is longer. However, it removes the need to keep the separation of locations and currentLocations, which was already the source of one bug. It also reads a little more clearly since you aren’t relying on an observer but a setter function with the property name. The syntax of Ember’s setters takes a little while to get used to, but while not perfect, can have a positive impact on the code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48718c30a6b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>