rspec-apotomo 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -2
- data/CHANGES.mkd +4 -4
- data/Rakefile +6 -1
- data/lib/generators/rspec/templates/widget_spec.erb +7 -4
- data/lib/rspec-apotomo/version.rb +1 -1
- data/lib/rspec/rails/example/widget_example_group.rb +1 -0
- data/spec/rspec-apotomo/widget_example_group_spec.rb +8 -1
- data/spec/rspec-apotomo/widget_spec_generator_spec.rb +35 -0
- metadata +4 -3
data/.travis.yml
CHANGED
data/CHANGES.mkd
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
# 0.9.
|
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
|
-
#
|
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
@@ -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(
|
5
|
+
root << widget('<%= class_name.tableize.singularize %>')
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
@@ -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
|
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
|
-
-
|
9
|
-
version: 0.9.
|
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
|
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
|