Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add rspec and smoke test

  • Loading branch information...
commit 10061ef73ffae6d3f4365f07e007d66e17b9f963 1 parent ba235e8
@christophermanning christophermanning authored
View
2  .rspec
@@ -0,0 +1,2 @@
+--color
+--format progress
View
2  Gemfile
@@ -0,0 +1,2 @@
+source :rubygems
+gemspec
View
74 Gemfile.lock
@@ -0,0 +1,74 @@
+PATH
+ remote: .
+ specs:
+ multi_fetch_fragments (0.0.9)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionpack (3.2.9)
+ activemodel (= 3.2.9)
+ activesupport (= 3.2.9)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.4)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.2.1)
+ activemodel (3.2.9)
+ activesupport (= 3.2.9)
+ builder (~> 3.0.0)
+ activesupport (3.2.9)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ builder (3.0.4)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ hike (1.2.1)
+ i18n (0.6.1)
+ journey (1.0.4)
+ json (1.7.5)
+ multi_json (1.5.0)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.2)
+ rack (>= 1.0)
+ railties (3.2.9)
+ actionpack (= 3.2.9)
+ activesupport (= 3.2.9)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (10.0.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec-core (2.12.1)
+ rspec-expectations (2.12.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.12.0)
+ rspec-rails (2.12.0)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec-core (~> 2.12.0)
+ rspec-expectations (~> 2.12.0)
+ rspec-mocks (~> 2.12.0)
+ sprockets (2.2.2)
+ hike (~> 1.2)
+ multi_json (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ thor (0.16.0)
+ tilt (1.3.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ multi_fetch_fragments!
+ rspec-rails (~> 2)
View
5 mutli_fetch_fragments.gemspec
@@ -5,5 +5,6 @@ Gem::Specification.new do |s|
s.email = 'nate.kontny@gmail.com'
s.summary = 'multi_fetch_fragments allows you to render a collection of partials through Rails multi read caching mechanism.'
s.files = Dir["lib/multi_fetch_fragments.rb"]
-
-end
+ s.add_development_dependency 'rspec-rails', '~> 2'
+end
View
2  spec/models/customer.rb
@@ -0,0 +1,2 @@
+class Customer < Struct.new(:name, :id)
+end
View
10 spec/multi_fetch_fragments_spec.rb
@@ -0,0 +1,10 @@
+require 'spec_helper'
+
+describe MultiFetchFragments do
+ it "doesn't smoke" do
+ MultiFetchFragments::Railtie.run_initializers
+
+ view = ActionView::Base.new([File.dirname(__FILE__)], {})
+ view.render(:partial => "views/customer", :collection => [ Customer.new("david"), Customer.new("mary") ]).should == "Hello: david\nHello: mary\n"
+ end
+end
View
24 spec/spec_helper.rb
@@ -0,0 +1,24 @@
+require 'rails'
+require 'action_view'
+require 'action_controller'
+require 'active_support/concern'
+require 'models/customer'
+require 'multi_fetch_fragments'
+
+# This file was generated by the `rspec --init` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# Require this file using `require "spec_helper"` to ensure that it is only
+# loaded once.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+ config.treat_symbols_as_metadata_keys_with_true_values = true
+ config.run_all_when_everything_filtered = true
+ config.filter_run :focus
+
+ # Run specs in random order to surface order dependencies. If you find an
+ # order dependency and want to debug it, you can fix the order by providing
+ # the seed, which is printed after each run.
+ # --seed 1234
+ config.order = 'random'
+end
View
1  spec/views/_customer.html.erb
@@ -0,0 +1 @@
+Hello: <%= customer.name rescue "Anonymous" %>
Please sign in to comment.
Something went wrong with that request. Please try again.