simple_cells 0.0.7 → 0.0.8

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: 24c8c327d57d63929cded86497c57c1621eeeb8f
4
- data.tar.gz: f647e29ea79639971374ce6a544e3a2019d17a56
3
+ metadata.gz: 34f7183cabb8a1a315a0bfdd15ef631ff5c2a893
4
+ data.tar.gz: 367cef7f9ca30b900a6ee2890ad866358dcf57bd
5
5
  SHA512:
6
- metadata.gz: 27e9dbc928314a7748be71a61daac38bb9b72bb5fb07c75af6ead9bd4e60d0a4c96fcda6dc0407b6b079af7cd52fc1f7d4c20465d30bc688cba049e65c82c65b
7
- data.tar.gz: 6a0b3ece9a9ed339535b3470a5cfadf0f34cc9fc9cb1008638d19dae2538cb055c7c4a7a0c96e7dbb11b47bd09e9ca1d88e4ec50202e06b79124cec3c11361b5
6
+ metadata.gz: a6efd54f34a77fc6cc3ff6069237ff747b77ceff7ac802966135147c1df470359da94f23b1d09e1447211527870d1ee0fea5b27a492c4e597bb5329dd9aa0c66
7
+ data.tar.gz: 5a9e97d0b71e60f30788dbaa587c61e667f5fbf3409162305a86f77d03be98a855648fc79d5ca950c01505febd72fcabf8f1c7916cc9c5e18c6ee5ff0b62d96a
data/README.md CHANGED
@@ -58,6 +58,21 @@ class MyCell < SimpleCells::BaseCell
58
58
  end
59
59
  ```
60
60
 
61
+ ## Testing
62
+
63
+ You can test your cells individually like this:
64
+
65
+ ```ruby
66
+ require "rails_helper"
67
+
68
+ describe "my cell" do
69
+ it "renders" do
70
+ helper = SimpleCells::SpecHelper.new("users/something", :show)
71
+ expect(helper.body).to include "some text"
72
+ end
73
+ end
74
+ ```
75
+
61
76
  ## License
62
77
 
63
78
  This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,28 @@
1
+ class SimpleCells::SpecHelper
2
+ attr_reader :action_name, :cell_name, :cell_class_name, :body, :simple_cell_arguments
3
+
4
+ def initialize(cell_name, action_name, simple_cell_arguments = {})
5
+ @action_name = action_name
6
+ @cell_name = cell_name
7
+ @cell_class_name = "#{cell_name.to_s.camelize}SimpleCell"
8
+ @simple_cell_arguments = simple_cell_arguments
9
+ render
10
+ end
11
+
12
+ def cell_instance
13
+ @cell_instance ||= cell_class_name.constantize.new(view_context: view_context, simple_cell_arguments: simple_cell_arguments)
14
+ end
15
+
16
+ def controller
17
+ @controller ||= ActionController::Base.new
18
+ end
19
+
20
+ def render
21
+ cell_instance.__send__(action_name)
22
+ @body = cell_instance.render_simple_cell_view(cell_name, action_name)
23
+ end
24
+
25
+ def view_context
26
+ @view_context ||= controller.view_context
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleCells
2
- VERSION = "0.0.7".freeze
2
+ VERSION = "0.0.8".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,6 +58,7 @@ files:
58
58
  - lib/simple_cells.rb
59
59
  - lib/simple_cells/base_cell.rb
60
60
  - lib/simple_cells/engine.rb
61
+ - lib/simple_cells/spec_helper.rb
61
62
  - lib/simple_cells/version.rb
62
63
  - lib/tasks/simple_cells_tasks.rake
63
64
  homepage: https://www.github.com/kaspernj/simple_cells