spec/generator_spec.rb in keynote-0.3.1 vs spec/generator_spec.rb in keynote-1.0.0
- old
+ new
@@ -26,11 +26,11 @@
def output_path
File.expand_path('../../tmp', __FILE__)
end
def file_contents(path)
- file_contents = File.read(File.join(output_path, path))
+ File.read(File.join(output_path, path))
end
describe "when the test_framework is :test_unit" do
before do
Rails.application.config.generators do |g|
@@ -44,59 +44,59 @@
app/presenters/post_presenter.rb
test/unit/presenters/post_presenter_test.rb
)
file_contents('app/presenters/post_presenter.rb').
- must_match /class PostPresenter < Keynote::Presenter/
+ must_match(/class PostPresenter < Keynote::Presenter/)
file_contents('test/unit/presenters/post_presenter_test.rb').
- must_match /class PostPresenterTest < Keynote::TestCase/
+ must_match(/class PostPresenterTest < Keynote::TestCase/)
end
end
it "does not add a 'presents' line" do
invoke_generator 'post' do |files|
file_contents('app/presenters/post_presenter.rb').
- wont_match /presents/
+ wont_match(/presents/)
end
end
it "generates an appropriate present() call" do
invoke_generator 'post' do |files|
file_contents('test/unit/presenters/post_presenter_test.rb').
- must_match /present\(:post\)/
+ must_match(/present\(:post\)/)
end
end
describe "when the presenter has one parameter" do
it "adds a 'presents' line" do
invoke_generator 'post', 'foo' do |files|
file_contents('app/presenters/post_presenter.rb').
- must_match /presents :foo$/
+ must_match(/presents :foo$/)
end
end
it "generates an appropriate present() call" do
invoke_generator 'post', 'foo' do |files|
file_contents('test/unit/presenters/post_presenter_test.rb').
- must_match /present\(:post, :foo\)/
+ must_match(/present\(:post, :foo\)/)
end
end
end
describe "when the presenter has two parameters" do
it "adds a 'presents' line" do
invoke_generator 'post', 'foo', 'bar' do |files|
file_contents('app/presenters/post_presenter.rb').
- must_match /presents :foo, :bar$/
+ must_match(/presents :foo, :bar$/)
end
end
it "generates an appropriate present() call" do
invoke_generator 'post', 'foo', 'bar' do |files|
file_contents('test/unit/presenters/post_presenter_test.rb').
- must_match /present\(:post, :foo, :bar\)/
+ must_match(/present\(:post, :foo, :bar\)/)
end
end
end
end
@@ -110,14 +110,14 @@
app/presenters/post_presenter.rb
spec/presenters/post_presenter_spec.rb
)
file_contents('app/presenters/post_presenter.rb').
- must_match /class PostPresenter < Keynote::Presenter/
+ must_match(/class PostPresenter < Keynote::Presenter/)
file_contents('spec/presenters/post_presenter_spec.rb').
- must_match /describe PostPresenter do/
+ must_match(/describe PostPresenter do/)
end
end
it "generates a presenter and MiniTest::Rails spec file" do
Rails.application.config.generators do |g|
@@ -129,14 +129,14 @@
app/presenters/post_presenter.rb
test/presenters/post_presenter_test.rb
)
file_contents('app/presenters/post_presenter.rb').
- must_match /class PostPresenter < Keynote::Presenter/
+ must_match(/class PostPresenter < Keynote::Presenter/)
file_contents('test/presenters/post_presenter_test.rb').
- must_match /describe PostPresenter do/
+ must_match(/describe PostPresenter do/)
end
end
it "generates a presenter and MiniTest::Rails unit file" do
Rails.application.config.generators do |g|
@@ -148,12 +148,12 @@
app/presenters/post_presenter.rb
test/presenters/post_presenter_test.rb
)
file_contents('app/presenters/post_presenter.rb').
- must_match /class PostPresenter < Keynote::Presenter/
+ must_match(/class PostPresenter < Keynote::Presenter/)
file_contents('test/presenters/post_presenter_test.rb').
- must_match /class PostPresenterTest < Keynote::TestCase/
+ must_match(/class PostPresenterTest < Keynote::TestCase/)
end
end
end