rspec-apotomo 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml CHANGED
@@ -1,4 +1,8 @@
1
- rvm: 1.9.2
2
- script: "bundle exec rspec -f documentation"
1
+ rvm:
2
+ - jruby
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ script: "bundle exec rake travis"
3
7
  notifications:
4
8
  irc: "irc.freenode.org#cells"
data/CHANGES.mkd CHANGED
@@ -1,13 +1,13 @@
1
- # 0.9.3
1
+ # 0.9.4
2
+
3
+ * Generated specs now contain the correct name when having nested widgets. Thanks to Felipe Iketani [felipeik].
2
4
 
3
- # Changes
5
+ # 0.9.3
4
6
 
5
7
  *Using path/url helpers in spec works.
6
8
 
7
9
  # 0.9.2
8
10
 
9
- # Changes
10
-
11
11
  *Accessing `view_assigns` now works.
12
12
 
13
13
 
data/Rakefile CHANGED
@@ -4,4 +4,9 @@ require 'rspec/core/rake_task'
4
4
 
5
5
  desc "Run all specs"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
- task :default => :spec
7
+ task :default => :spec
8
+
9
+ desc "Travis-CI Tests"
10
+ task :travis do
11
+ Rake::Task["spec"].invoke
12
+ end
@@ -2,10 +2,13 @@ require 'spec_helper'
2
2
 
3
3
  describe <%= class_name %>Widget do
4
4
  has_widgets do |root|
5
- root << widget(:<%= class_name %>)
5
+ root << widget('<%= class_name.tableize.singularize %>')
6
6
  end
7
7
 
8
- it "should render :display" do
9
- render_widget(:<%= class_name %>).should have_selector("h1")
10
- end
8
+ <% for action in actions %>
9
+ it "should render :<%= action %>" do
10
+ render_widget('<%= class_name.tableize.singularize %>', :<%= action %>).should have_selector("h1")
11
+ end
12
+ <% end %>
13
+
11
14
  end
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module Apotomo
3
- VERSION = "0.9.3"
3
+ VERSION = "0.9.4"
4
4
  end
5
5
  end
@@ -9,6 +9,7 @@ module RSpec::Rails
9
9
  include RSpec::Rails::RailsExampleGroup
10
10
 
11
11
  include Apotomo::TestCase::TestMethods
12
+ include ActionController::UrlFor
12
13
 
13
14
  if defined?(Webrat)
14
15
  include Webrat::Matchers
@@ -29,7 +29,7 @@ module RSpec::Rails
29
29
  end
30
30
 
31
31
  it "should render a view" do
32
- render_widget(:dummy).text.should == "Hey from DummyWidget! I should be mixed in properly from @routes\n"
32
+ render_widget(:dummy).text.chomp.should == "Hey from DummyWidget! I should be mixed in properly from @routes"
33
33
  end
34
34
 
35
35
  it "should support _path helpers from the controller" do
@@ -38,6 +38,13 @@ module RSpec::Rails
38
38
  @controller.should_receive(:test_path).at_least(:once)
39
39
  test_path
40
40
  end
41
+
42
+ it "should support polymorphic_path from the controller" do
43
+ # We have to stub include so that things determine the route exists.
44
+ Rails.application.routes.named_routes.helpers.stub(:include?).and_return(:true)
45
+ @controller.should_receive(:test_path).at_least(:once)
46
+ polymorphic_path(:test)
47
+ end
41
48
  end
42
49
 
43
50
  context "- ::has_widget" do
@@ -0,0 +1,35 @@
1
+ require "generators/rspec/widget_generator"
2
+
3
+ describe Rspec::Generators::WidgetGenerator do
4
+ include RSpec::Rails::RailsExampleGroup
5
+
6
+ attr_accessor :test_case, :test
7
+
8
+ before(:all) do
9
+ test_case = Class.new(Rails::Generators::TestCase)
10
+ test_case.destination_root = File.expand_path("../../tmp", __FILE__)
11
+ test_case.generator_class = Rspec::Generators::WidgetGenerator
12
+ self.test = test_case.new :wow
13
+ test.run_generator %w(Twitter::Tweet display form)
14
+ end
15
+
16
+ it "creates widget spec" do
17
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /require 'spec_helper'/
18
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /describe Twitter::TweetWidget do/
19
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /has_widgets do |root|/
20
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /root << widget\('twitter\/tweet'\)/
21
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /end/
22
+ end
23
+
24
+ it 'creates display state' do
25
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /it "should render :display" do/
26
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /render_widget\('twitter\/tweet', :display\).should have_selector\("h1"\)/
27
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /end/
28
+ end
29
+
30
+ it 'creates form state' do
31
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /it "should render :form" do/
32
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /render_widget\('twitter\/tweet', :form\).should have_selector\("h1"\)/
33
+ test.assert_file "spec/widgets/tweet_widget_spec.rb", /end/
34
+ end
35
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 3
9
- version: 0.9.3
8
+ - 4
9
+ version: 0.9.4
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-10-04 00:00:00 +02:00
19
+ date: 2011-12-10 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -143,6 +143,7 @@ files:
143
143
  - rspec-apotomo.gemspec
144
144
  - spec/fixtures/dummy/display.html.erb
145
145
  - spec/rspec-apotomo/widget_example_group_spec.rb
146
+ - spec/rspec-apotomo/widget_spec_generator_spec.rb
146
147
  - spec/rspec-apotomo/with_capybara_spec.rb
147
148
  - spec/spec_helper.rb
148
149
  has_rdoc: true