forked from piclez/merb-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
including hassox's changes for rspec stories
- Loading branch information
1 parent
3205959
commit d117d44
Showing
15 changed files
with
102 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,51 @@ | ||
merb-rspec | ||
========= | ||
|
||
A plugin for the Merb framework that provides ... | ||
A plugin for the Merb framework that provides helper functionality for the rSpec testing framework. | ||
|
||
|
||
== Stories | ||
merb-rspec supports rSpec story generation for regular Merb apps. See http://rspec.info for more information | ||
on using rSpec plain text stories. | ||
|
||
When using the generators for the first time, a few extra helper files will be generated. | ||
|
||
=== Generation Examples | ||
|
||
==== Simple | ||
To generate a simple story use: | ||
|
||
{{{merb-gen story my_story}}} | ||
|
||
This will generate all files needed to support that story. | ||
- steps/my_story.rb | ||
- stories/my_story | ||
- stories/my_story.rb | ||
|
||
==== Complex | ||
You can keep your stories organized by putting stories into sub-directories. To do this with the generator use: | ||
|
||
{{{merb-gen story complex/story_group/story_file}}} | ||
|
||
This will generate the following files: | ||
- steps/complex_story_group_story_file.rb | ||
- stories/complex/story_group/story_file | ||
- stories/complex/story_group/story_file.rb | ||
|
||
=== Usage Examples | ||
merb-rspec has a rake task for running your stories. To include it you need to make merb-rspec a dependency in your app. | ||
|
||
To make the rake file available, in config/init.rb include the following line: | ||
{{{dependency "merb-rspec" if Merb.environment == "test"}}} | ||
|
||
Once you have the rake file available you can run the stories: | ||
|
||
rake story[my_story] | ||
|
||
OR for complex examples | ||
|
||
rake story[complex/story_group/story_file] | ||
|
||
OR to run all the stories | ||
|
||
rake story[all] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
module Merb::Test::Rspec::MarkupMatchers | ||
class HaveSelector | ||
def initialize(expected) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
merb_rspec/rspec_generators/merb_story_setup/merb_story_setup_generator.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class MerbStorySetupGenerator < Merb::GeneratorBase | ||
|
||
def initialize(runtime_args, runtime_options = {}) | ||
@base = File.dirname(__FILE__) | ||
super | ||
end | ||
|
||
def manifest | ||
record do |m| | ||
@m = m | ||
|
||
@assigns = {} | ||
|
||
copy_dirs | ||
copy_files | ||
|
||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +0,0 @@ | ||
Description: | ||
|
||
|
||
Usage: | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...rspec_generators/story/templates/story.rb → ...ates/stories/stories/%full_story_path%.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
require File.join(File.dirname(__FILE__), "../<%= "../" * path_levels %>helper") | ||
|
||
with_steps_for :<%= step_name %> do | ||
run File.expand_path(__FILE__).gsub(".rb",""), :type => MerbStory | ||
run File.expand_path(__FILE__).gsub(".rb",""), :type => Merb::Test::RspecStory | ||
end |