rspec-apotomo 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ # Changes
2
+
3
+ # 0.9.1
4
+
5
+ *URL helpers now work in view.
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe <%= class_name %>Widget do
4
+ has_widgets do |root|
5
+ root << widget(:<%= class_name %>)
6
+ end
7
+
8
+ it "should render :display" do
9
+ render_widget(:<%= class_name %>).should have_selector("h1")
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ require 'generators/cells/base'
2
+
3
+ module Rspec
4
+ module Generators
5
+ class WidgetGenerator < ::Cells::Generators::Base
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ def create_cell_spec_file
9
+ template "widget_spec.erb", File.join("spec/widgets/#{file_name}_widget_spec.rb")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,4 +1,4 @@
1
- require "rspec-apotomo/version"
1
+ require "rspec/core"
2
2
 
3
3
  module RSpec
4
4
  module Apotomo
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module Apotomo
3
- VERSION = "0.9.0"
3
+ VERSION = "0.9.1"
4
4
  end
5
5
  end
@@ -6,13 +6,26 @@ module RSpec::Rails
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  include Apotomo::TestCase::TestMethods
9
-
9
+
10
+ included do
11
+ before do
12
+ @parent_controller = Class.new(ActionController::Base).new
13
+ @parent_controller.instance_eval do
14
+ extend Apotomo::Rails::ControllerMethods
15
+ def controller_path; 'barn'; end
16
+ end
17
+
18
+ @parent_controller.request = ::ActionController::TestRequest.new
19
+ end
20
+ end
21
+
22
+
10
23
  module InstanceMethods
11
24
  # TODO documentation
12
25
  def response
13
26
  @last_invoke
14
27
  end
15
-
28
+
16
29
  attr_reader :parent_controller
17
30
  include ::Apotomo::WidgetShortcuts
18
31
  end
@@ -0,0 +1 @@
1
+ Hey from DummyWidget! <%= url_for_event :click %>
@@ -1,11 +1,22 @@
1
1
  require 'spec_helper'
2
- require 'rails/all' # TODO This probably should be someplace else
2
+ require "action_controller/railtie"
3
3
  require 'rspec/rails/example/widget_example_group'
4
4
 
5
5
  # This class is used as a dummy widget for testing
6
6
  class DummyWidget < Apotomo::Widget
7
7
  responds_to_event :doo
8
+
9
+ def display
10
+ render
11
+ end
8
12
  end
13
+ DummyWidget.append_view_path "spec/fixtures"
14
+
15
+
16
+ Rails.application = Class.new(Rails::Application)
17
+ #Rails.application.routes.append do |r|
18
+ # r.match "/render_event_response", :as => :apotomo_event_path
19
+ #end
9
20
 
10
21
  module RSpec::Rails
11
22
  describe WidgetExampleGroup do
@@ -25,6 +36,21 @@ module RSpec::Rails
25
36
  # the rails rspec would include it automagically.
26
37
  include WidgetExampleGroup
27
38
 
39
+ context "light-weight integration tests" do
40
+ has_widgets do |root|
41
+ root << widget(:dummy)
42
+ root[:dummy].instance_eval do
43
+ def apotomo_event_path(*args)
44
+ "i should be mixed in properly from @routes"
45
+ end
46
+ end
47
+ end
48
+
49
+ it "should render a view" do
50
+ render_widget(:dummy).should == "Hey from DummyWidget! i should be mixed in properly from @routes\n"
51
+ end
52
+ end
53
+
28
54
  context "- ::has_widget" do
29
55
  has_widgets do |root|
30
56
  root << widget(:dummy)
@@ -68,7 +94,9 @@ module RSpec::Rails
68
94
  root << widget(:dummy)
69
95
  end
70
96
 
71
- pending "gets the widget controller variables"
97
+ it "gets the widget controller variables" do
98
+
99
+ end
72
100
  pending "sets the widget view variables"
73
101
  end
74
102
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 0
9
- version: 0.9.0
8
+ - 1
9
+ version: 0.9.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nick Sutterer
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-09-26 00:00:00 +02:00
19
+ date: 2011-09-27 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -115,16 +115,20 @@ extra_rdoc_files: []
115
115
  files:
116
116
  - .gitignore
117
117
  - .travis.yml
118
+ - CHANGES.mkd
118
119
  - Gemfile
119
120
  - Guardfile
120
121
  - MIT-LICENSE
121
122
  - README.mkd
122
123
  - Rakefile
124
+ - lib/generators/rspec/templates/widget_spec.erb
125
+ - lib/generators/rspec/widget_generator.rb
123
126
  - lib/rspec-apotomo.rb
124
127
  - lib/rspec-apotomo/tasks.rake
125
128
  - lib/rspec-apotomo/version.rb
126
129
  - lib/rspec/rails/example/widget_example_group.rb
127
130
  - rspec-apotomo.gemspec
131
+ - spec/fixtures/dummy/display.html.erb
128
132
  - spec/rspec-apotomo/widget_example_group_spec.rb
129
133
  - spec/spec_helper.rb
130
134
  has_rdoc: true