rspec-cells 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b00052a706101e635fbfd70d6d3b38feef321326
4
- data.tar.gz: 22ae5044d29a41ca4107dc3be88e888b21177c35
3
+ metadata.gz: ed05686b72ee47371a5a7d6b5a50d7e0ab256b6a
4
+ data.tar.gz: 7fcf7b3f409de782f98d2f3a8ec8f3641b94ca38
5
5
  SHA512:
6
- metadata.gz: 3d8d79e4ffc7bac6710ae8f2ed3c50a9b721726e44129001aed422f791a7b3394c8ce45e26509d78627629f216c4680934ae5fbf45cbc42feeba750696831b0d
7
- data.tar.gz: 5443a773b0ac3191fd81bed77f5d11507f192eacdd14e114241ccf7e48bcf46d6dc62f69676f19f63b445ea723bd8175d9571d185d534cde2c857669076ca705
6
+ metadata.gz: 7d046919ad6c50ff2326bfb31c00d4238aabaa3e1c6d2fdfc94321c7bd48b75edb3a0ab3a9cba1cc17cb56157ea3e44f062c688ec49936f3a000fcffe13e1e9d
7
+ data.tar.gz: 30ce8f0aa270760828eeefb4469acda3909a54ee8f9c931851ee5821dbe310730a3548f96164bebaaabc0acbb9bb0f3ba7867895910d7ca17cef82931959785e
data/Appraisals CHANGED
@@ -1,5 +1,5 @@
1
1
  appraise "rspec2" do
2
- gem "rspec-rails", "2.99"
2
+ gem "rspec-rails", "~> 2.14.0"
3
3
  end
4
4
 
5
5
  appraise "rspec3" do
data/CHANGES.textile CHANGED
@@ -1,6 +1,11 @@
1
+ h2. 0.2.1
2
+
3
+ * Relaxed rspec dependency to >= 2.14.
4
+ * Added `enable_cell_caching!` for specs.
5
+
1
6
  h2. 0.2.0
2
7
 
3
- * rspec-cells only works with rspec >= 2.99 and uses the expect syntax. Thanks to @seuros for his help.
8
+ * rspec-cells depends on rspec >= 2.99 and uses the expect syntax. Thanks to @seuros for his help.
4
9
 
5
10
  h2. 0.1.12
6
11
 
data/MIT-LICENSE CHANGED
@@ -1,4 +1,5 @@
1
- Copyright (c) 2008 Dmytro Shteflyuk
1
+ Copyright (c) 2008-2009 Dmytro Shteflyuk
2
+ Copyright (c) 2010-2014, Nick Sutterer
2
3
 
3
4
  Permission is hereby granted, free of charge, to any person obtaining
4
5
  a copy of this software and associated documentation files (the
data/README.rdoc CHANGED
@@ -18,7 +18,8 @@ This gem runs with RSpec2 and Rails >= 3.x, so just add it to your app's +Gemfil
18
18
 
19
19
  = Usage
20
20
 
21
- Simply put all your specs in the <tt>spec/cells</tt> directory. However, let the cell generator do that for you!
21
+ Simply put all your specs in the <tt>spec/cells</tt> directory or add type: :cell to the describe block.
22
+ However, let the cell generator do that for you!
22
23
 
23
24
  rails g cell blog_post show -t rspec
24
25
 
@@ -105,14 +106,30 @@ Run your examples with
105
106
 
106
107
  If you need more helpers, matchers and stuff, {just let us know}[http://cells.rubyforge.org/community.html].
107
108
 
109
+ == Test cells with caching
110
+
111
+ By default your code for caching code is not run if you set <tt>ActionController::Base.perform_caching = false</tt>
112
+ That's a reasonable default but you might want to increase coverage by running caching code at least once.
113
+ Here is an example:
114
+
115
+ describe SomeCell do
116
+ describe 'caching' do
117
+ enable_cell_caching!
118
+ # Code for testing...
119
+ end
120
+ end
121
+
122
+
108
123
  == Contributors
109
124
 
110
125
  * Jorge Calás Lozano <calas@qvitta.net> (Cleanup, capybara string matchers)
126
+ * Abdelkader Boudih <@seuros>
127
+ *
111
128
 
112
129
  == LICENSE
113
130
 
114
131
  Copyright (c) 2010, Nick Sutterer
115
132
 
116
- Copyright (c) 2007-2009, Dmytro Shteflyuk <kpumuk@kpumuk.info> http://kpumuk.info
133
+ Copyright (c) 2008-2009, Dmytro Shteflyuk <kpumuk@kpumuk.info> http://kpumuk.info
117
134
 
118
135
  Released under the MIT License.
@@ -4,6 +4,6 @@ source "http://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 3.2"
6
6
  gem "appraisal"
7
- gem "rspec-rails", "2.99"
7
+ gem "rspec-rails", "~> 2.14.0"
8
8
 
9
9
  gemspec :path => "../"
@@ -1,5 +1,8 @@
1
1
  require 'generators/cells/base'
2
2
 
3
+ # ensure that we can see the test-libraries like Capybara
4
+ Bundler.require :test if Bundler
5
+
3
6
  module Rspec
4
7
  module Generators
5
8
  class CellGenerator < ::Cells::Generators::Base
@@ -7,7 +7,7 @@ describe <%= class_name %>Cell, type: :cell do
7
7
  context 'rendering <%= state %>' do
8
8
  subject { render_cell(<%= cell_name %>, :<%= state %>) }
9
9
 
10
- <%- if defined?(Capybara) -%>
10
+ <%- if defined?(::Capybara) -%>
11
11
  it { is_expected.to have_selector('h1', text: '<%= class_name %>#<%= state %>') }
12
12
  it { is_expected.to have_selector('p', text: 'Find me in app/cells/<%= file_path %>/<%= state %>.html') }
13
13
  <%- else -%>
@@ -0,0 +1,29 @@
1
+ module RSpec
2
+ module Cells
3
+ module Caching
4
+ extend ActiveSupport::Concern
5
+
6
+ module ClassMethods
7
+ def enable_cell_caching!
8
+ before :each do
9
+ ActionController::Base.perform_caching = true
10
+ end
11
+ after :each do
12
+ ActionController::Base.perform_caching = false
13
+ end
14
+ end
15
+
16
+ def disable_cell_caching!
17
+ before :each do
18
+ ActionController::Base.perform_caching = false
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ RSpec.configure do |c|
27
+ c.include RSpec::Cells::Caching, type: :cell
28
+ end
29
+
@@ -4,5 +4,6 @@ namespace :spec do
4
4
  desc "Run the code examples in spec/cells"
5
5
  RSpec::Core::RakeTask.new("cells") do |t|
6
6
  t.pattern = "./spec/cells/**/*_spec.rb"
7
+ t.rspec_opts = '--tag cell'
7
8
  end
8
9
  end
@@ -1,6 +1,6 @@
1
1
  module RSpec
2
2
  module Cells
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  end
6
6
 
data/lib/rspec/cells.rb CHANGED
@@ -3,3 +3,4 @@ require 'rspec/core'
3
3
  require 'rspec/rails/adapters'
4
4
  require 'rspec/rails/example/rails_example_group'
5
5
  require 'rspec/cells/cell_example_group'
6
+ require 'rspec/cells/caching'
data/rspec-cells.gemspec CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_runtime_dependency "railties", ">= 3.0"
23
- s.add_runtime_dependency 'rspec-rails', '>= 2.99'
23
+ s.add_runtime_dependency 'rspec-rails', '>= 2.14'
24
24
  s.add_runtime_dependency "cells", ">= 3.4.0"
25
25
  end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Caching' do
4
+ let(:subject) { self.class }
5
+
6
+ it 'module is included' do
7
+ expect(subject.included_modules).to include(RSpec::Cells::Caching)
8
+ end
9
+
10
+ it { expect(subject).to respond_to(:enable_cell_caching!) }
11
+ it { expect(subject).to respond_to(:disable_cell_caching!) }
12
+
13
+ end
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,6 @@ require 'action_view/railtie'
8
8
  require 'rspec-cells'
9
9
  require 'rspec/rails'
10
10
  require 'cell/base'
11
- require 'cell/test_case'
12
11
  require 'rspec/cells'
13
12
 
14
13
  module RSpecCells
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-11 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.99'
33
+ version: '2.14'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.99'
40
+ version: '2.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cells
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -73,10 +73,12 @@ files:
73
73
  - lib/generators/rspec/templates/cell_spec.erb
74
74
  - lib/rspec-cells.rb
75
75
  - lib/rspec/cells.rb
76
+ - lib/rspec/cells/caching.rb
76
77
  - lib/rspec/cells/cell_example_group.rb
77
78
  - lib/rspec/cells/tasks.rake
78
79
  - lib/rspec/cells/version.rb
79
80
  - rspec-cells.gemspec
81
+ - spec/cells/caching_spec.rb
80
82
  - spec/cells/cell_generator_spec.rb
81
83
  - spec/cells/cell_spec_spec.rb
82
84
  - spec/spec_helper.rb
@@ -105,6 +107,7 @@ signing_key:
105
107
  specification_version: 4
106
108
  summary: Spec your cells.
107
109
  test_files:
110
+ - spec/cells/caching_spec.rb
108
111
  - spec/cells/cell_generator_spec.rb
109
112
  - spec/cells/cell_spec_spec.rb
110
113
  - spec/spec_helper.rb