presenter-pattern 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -2,7 +2,7 @@ README.rdoc
2
2
  Rakefile
3
3
  lib/presenter-pattern.rb
4
4
  lib/presenter-pattern/railtie.rb
5
- presenter-pattern.gemspec
5
+ lib/presenter-pattern/test_case.rb
6
6
  rails/init.rb
7
7
  test/bad_controller_test.rb
8
8
  test/foos_controller_test.rb
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('presenter-pattern', '0.3.1') do |p|
5
+ Echoe.new('presenter-pattern', '0.3.3') do |p|
6
6
  p.description = "Enables and enforces the presenter pattern in rails"
7
7
  p.url = "https://github.com/jleven/presenter-pattern"
8
8
  p.author = "Josh Leven"
@@ -0,0 +1,11 @@
1
+ module PresenterPattern
2
+ module TestCase
3
+ def assigns(key = nil)
4
+ name = @controller.instance_variable_get :@view_var_name
5
+ value = @controller.instance_variable_get :@__rval
6
+ assigns = {}.with_indifferent_access
7
+ assigns[name] = value
8
+ key.nil? ? assigns : assigns[key]
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  require 'presenter-pattern/railtie'
2
-
2
+ require 'presenter-pattern/test_case'
3
3
 
4
4
  # PresenterPattern::API enables and enforces very simple api controllers.
5
5
  # Essentially, your controller has the settings:
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{presenter-pattern}
5
- s.version = "0.3.1"
5
+ s.version = "0.3.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Josh Leven"]
9
- s.date = %q{2011-05-25}
9
+ s.date = %q{2011-05-26}
10
10
  s.description = %q{Enables and enforces the presenter pattern in rails}
11
11
  s.email = %q{josh.leven@gmail.com}
12
- s.extra_rdoc_files = ["README.rdoc", "lib/presenter-pattern.rb", "lib/presenter-pattern/railtie.rb"]
13
- s.files = ["README.rdoc", "Rakefile", "lib/presenter-pattern.rb", "lib/presenter-pattern/railtie.rb", "presenter-pattern.gemspec", "rails/init.rb", "test/bad_controller_test.rb", "test/foos_controller_test.rb", "test/setup_test.rb", "test/test_helper.rb", "Manifest"]
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/presenter-pattern.rb", "lib/presenter-pattern/railtie.rb", "lib/presenter-pattern/test_case.rb"]
13
+ s.files = ["README.rdoc", "Rakefile", "lib/presenter-pattern.rb", "lib/presenter-pattern/railtie.rb", "lib/presenter-pattern/test_case.rb", "rails/init.rb", "test/bad_controller_test.rb", "test/foos_controller_test.rb", "test/setup_test.rb", "test/test_helper.rb", "Manifest", "presenter-pattern.gemspec"]
14
14
  s.homepage = %q{https://github.com/jleven/presenter-pattern}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Presenter-pattern", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
@@ -1,6 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class FoosControllerTest < ActionController::TestCase
4
+ include PresenterPattern::TestCase
4
5
  tests FoosController
5
6
 
6
7
  def setup
@@ -58,4 +59,14 @@ class FoosControllerTest < ActionController::TestCase
58
59
  assert_response :success
59
60
  assert_equal "{}", @response.body
60
61
  end
62
+
63
+ def test_assigns_test
64
+ get :new
65
+ assert assigns(:foo)
66
+ end
67
+
68
+ def test_assigns_test_plural
69
+ get :index
70
+ assert assigns(:foos)
71
+ end
61
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: presenter-pattern
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-25 00:00:00.000000000Z
12
+ date: 2011-05-26 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Enables and enforces the presenter pattern in rails
15
15
  email: josh.leven@gmail.com
@@ -19,18 +19,20 @@ extra_rdoc_files:
19
19
  - README.rdoc
20
20
  - lib/presenter-pattern.rb
21
21
  - lib/presenter-pattern/railtie.rb
22
+ - lib/presenter-pattern/test_case.rb
22
23
  files:
23
24
  - README.rdoc
24
25
  - Rakefile
25
26
  - lib/presenter-pattern.rb
26
27
  - lib/presenter-pattern/railtie.rb
27
- - presenter-pattern.gemspec
28
+ - lib/presenter-pattern/test_case.rb
28
29
  - rails/init.rb
29
30
  - test/bad_controller_test.rb
30
31
  - test/foos_controller_test.rb
31
32
  - test/setup_test.rb
32
33
  - test/test_helper.rb
33
34
  - Manifest
35
+ - presenter-pattern.gemspec
34
36
  homepage: https://github.com/jleven/presenter-pattern
35
37
  licenses: []
36
38
  post_install_message: