mist 0.6.0
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/.gitignore +18 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +13 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +192 -0
- data/README.md +108 -0
- data/Rakefile +9 -0
- data/app/assets/images/mist/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/app/assets/images/mist/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/app/assets/images/mist/ui-bg_flat_10_000000_40x100.png +0 -0
- data/app/assets/images/mist/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/app/assets/images/mist/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/app/assets/images/mist/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/mist/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/app/assets/images/mist/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/app/assets/images/mist/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/app/assets/images/mist/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/mist/ui-icons_228ef1_256x240.png +0 -0
- data/app/assets/images/mist/ui-icons_ef8c08_256x240.png +0 -0
- data/app/assets/images/mist/ui-icons_ffd27a_256x240.png +0 -0
- data/app/assets/images/mist/ui-icons_ffffff_256x240.png +0 -0
- data/app/assets/javascripts/mist/jquery-ui-1.8.17.custom.min.js +356 -0
- data/app/assets/javascripts/mist/posts.js.coffee +3 -0
- data/app/assets/javascripts/mist_core.js +3 -0
- data/app/assets/stylesheets/mist/posts.css.sass +97 -0
- data/app/assets/stylesheets/mist/scaffolds.css.scss +56 -0
- data/app/assets/stylesheets/mist/ui-lightness/jquery-ui-1.8.17.custom.css +565 -0
- data/app/assets/stylesheets/mist_core.css +4 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/mist/posts_controller.rb +130 -0
- data/app/helpers/mist/posts_helper.rb +61 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/mist/post.rb +240 -0
- data/app/models/mist/post_sweeper.rb +63 -0
- data/app/views/layouts/mist/posts.html.erb +66 -0
- data/app/views/mist/posts/_form.html.erb +55 -0
- data/app/views/mist/posts/_post.html.erb +19 -0
- data/app/views/mist/posts/_sidebar_title.html.erb +5 -0
- data/app/views/mist/posts/edit.html.erb +16 -0
- data/app/views/mist/posts/feed.atom.builder +17 -0
- data/app/views/mist/posts/index.html.erb +31 -0
- data/app/views/mist/posts/new.html.erb +15 -0
- data/app/views/mist/posts/show.html.erb +3 -0
- data/config/cucumber.yml +8 -0
- data/config/environment.rb +1 -0
- data/config/routes.rb +7 -0
- data/features/atom_feed.feature +20 -0
- data/features/authorize_create_post.feature +14 -0
- data/features/authorize_destroy_post.feature +27 -0
- data/features/authorize_update_post.feature +28 -0
- data/features/authorize_view_unpublished.feature +22 -0
- data/features/create_post.feature +13 -0
- data/features/destroy_post.feature +13 -0
- data/features/format_with_markdown.feature +13 -0
- data/features/popular_posts.feature +35 -0
- data/features/recent_posts.feature +28 -0
- data/features/similar_posts.feature +43 -0
- data/features/step_definitions/authorization_steps.rb +17 -0
- data/features/step_definitions/filesystem_steps.rb +13 -0
- data/features/step_definitions/page_steps.rb +43 -0
- data/features/step_definitions/post_steps.rb +58 -0
- data/features/step_definitions/sidebar_steps.rb +21 -0
- data/features/support/env.rb +58 -0
- data/features/support/setup.rb +15 -0
- data/features/update_post.feature +19 -0
- data/gemfiles/common +20 -0
- data/gemfiles/rails-3.1.3 +4 -0
- data/gemfiles/rails-3.1.3.lock +195 -0
- data/gemfiles/rails-3.2.0 +4 -0
- data/lib/generators/mist/USAGE +13 -0
- data/lib/generators/mist/setup_generator.rb +21 -0
- data/lib/generators/mist/templates/initializer.rb +17 -0
- data/lib/generators/mist/templates/mist.css.scss +2 -0
- data/lib/generators/mist/templates/mist.js.coffee +1 -0
- data/lib/generators/mist/views_generator.rb +11 -0
- data/lib/mist.rb +26 -0
- data/lib/mist/code_example_parser.rb +86 -0
- data/lib/mist/configuration.rb +68 -0
- data/lib/mist/configuration/author.rb +8 -0
- data/lib/mist/engine.rb +12 -0
- data/lib/mist/git_file_system_history.rb +66 -0
- data/lib/mist/git_model.rb +154 -0
- data/lib/mist/git_model/attributes.rb +21 -0
- data/lib/mist/git_model/class_methods.rb +141 -0
- data/lib/mist/permalink.rb +5 -0
- data/lib/mist/repository.rb +15 -0
- data/lib/mist/version.rb +8 -0
- data/mist.gemspec +33 -0
- data/spec/controllers/posts_controller_spec.rb +263 -0
- data/spec/dummy_rails_app/app/assets/javascripts/mist.js.coffee +1 -0
- data/spec/dummy_rails_app/app/assets/stylesheets/mist.css.scss +2 -0
- data/spec/dummy_rails_app/app/views/layouts/mist/posts.html.erb +60 -0
- data/spec/dummy_rails_app/config.ru +4 -0
- data/spec/dummy_rails_app/config/application.rb +48 -0
- data/spec/dummy_rails_app/config/boot.rb +7 -0
- data/spec/dummy_rails_app/config/database.yml +28 -0
- data/spec/dummy_rails_app/config/environment.rb +5 -0
- data/spec/dummy_rails_app/config/environments/development.rb +32 -0
- data/spec/dummy_rails_app/config/environments/production.rb +60 -0
- data/spec/dummy_rails_app/config/environments/test.rb +42 -0
- data/spec/dummy_rails_app/config/initializers/active_gist_credentials.rb +8 -0
- data/spec/dummy_rails_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy_rails_app/config/initializers/inflections.rb +10 -0
- data/spec/dummy_rails_app/config/initializers/mime_types.rb +5 -0
- data/spec/dummy_rails_app/config/initializers/mist.rb +17 -0
- data/spec/dummy_rails_app/config/initializers/secret_token.rb +7 -0
- data/spec/dummy_rails_app/config/initializers/session_store.rb +8 -0
- data/spec/dummy_rails_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy_rails_app/config/locales/en.yml +5 -0
- data/spec/dummy_rails_app/config/routes.rb +3 -0
- data/spec/dummy_rails_app/db/schema.rb +22 -0
- data/spec/dummy_rails_app/db/seeds.rb +7 -0
- data/spec/dummy_rails_app/doc/README_FOR_APP +2 -0
- data/spec/dummy_rails_app/lib/assets/.gitkeep +0 -0
- data/spec/dummy_rails_app/lib/tasks/.gitkeep +0 -0
- data/spec/dummy_rails_app/lib/tasks/cucumber.rake +65 -0
- data/spec/dummy_rails_app/public/404.html +26 -0
- data/spec/dummy_rails_app/public/422.html +26 -0
- data/spec/dummy_rails_app/public/500.html +26 -0
- data/spec/dummy_rails_app/public/favicon.ico +0 -0
- data/spec/dummy_rails_app/public/robots.txt +5 -0
- data/spec/dummy_rails_app/script/cucumber +10 -0
- data/spec/dummy_rails_app/script/rails +6 -0
- data/spec/dummy_rails_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/dummy_rails_app/vendor/plugins/.gitkeep +0 -0
- data/spec/factories/posts.rb +8 -0
- data/spec/fixtures/gist_404 +6 -0
- data/spec/fixtures/gist_with_1_code_example +66 -0
- data/spec/helpers/posts_helper_spec.rb +64 -0
- data/spec/lib/mist/code_example_parser_spec.rb +135 -0
- data/spec/lib/mist/configuration_spec.rb +88 -0
- data/spec/lib/mist/permalink_spec.rb +17 -0
- data/spec/lib/mist/repository_spec.rb +20 -0
- data/spec/models/mist/git_model_spec.rb +260 -0
- data/spec/models/mist/post_spec.rb +575 -0
- data/spec/requests/posts_caching_spec.rb +152 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/support/cache_helpers.rb +71 -0
- data/spec/support/config.rb +42 -0
- data/spec/support/fakeweb.rb +3 -0
- data/spec/views/mist/posts/edit.html.erb_spec.rb +11 -0
- data/spec/views/mist/posts/index.html.erb_spec.rb +27 -0
- data/spec/views/mist/posts/new.html.erb_spec.rb +15 -0
- data/spec/views/mist/posts/show.html.erb_spec.rb +11 -0
- metadata +371 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: Create new post
|
|
2
|
+
As a blog owner
|
|
3
|
+
In order to add content and attract users to my blog
|
|
4
|
+
I want to create a post
|
|
5
|
+
|
|
6
|
+
Scenario: Create new post from index
|
|
7
|
+
Given I am on the posts page
|
|
8
|
+
When I follow "New Post"
|
|
9
|
+
And I fill in "Title" with "Post title"
|
|
10
|
+
And I fill in "Content" with "This is post content"
|
|
11
|
+
And I press "Save"
|
|
12
|
+
Then I should see "Post title"
|
|
13
|
+
And I should see "This is post content"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: Destroy existing post
|
|
2
|
+
As a blog owner
|
|
3
|
+
In order to remove old content that is no longer useful
|
|
4
|
+
I want to destroy an existing post
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given I have published a post called "Post title"
|
|
8
|
+
And I am on the posts page
|
|
9
|
+
|
|
10
|
+
Scenario: Update existing post from index
|
|
11
|
+
When I follow "Destroy"
|
|
12
|
+
Then I should be on the posts page
|
|
13
|
+
And I should not see "Post title"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Feature: Format posts with markdown
|
|
2
|
+
As a blog maintainer
|
|
3
|
+
In order to make pages easier to read
|
|
4
|
+
I want them to be automatically formatted using Markdown
|
|
5
|
+
|
|
6
|
+
Scenario: format posts
|
|
7
|
+
Given I am on the posts page
|
|
8
|
+
When I follow "New Post"
|
|
9
|
+
And I fill in "Title" with "Post title"
|
|
10
|
+
And I fill in "Content" with "* post text"
|
|
11
|
+
And I press "Save"
|
|
12
|
+
# it's testing content, not code! I swear!
|
|
13
|
+
Then the page source should contain "<li>post text</li>"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Feature: Popular Posts
|
|
2
|
+
As a blog owner
|
|
3
|
+
In order to direct viewers to frequently-requested information
|
|
4
|
+
I want the most popular posts to appear in the sidebar
|
|
5
|
+
|
|
6
|
+
Scenario: No posts yet
|
|
7
|
+
When I am on the posts page
|
|
8
|
+
Then I should not see "Popular"
|
|
9
|
+
|
|
10
|
+
Scenario: One post, not viewed
|
|
11
|
+
Given I have published a post called "Post title"
|
|
12
|
+
When I am on the posts page
|
|
13
|
+
Then the "popular posts" sidebar should contain "Post title"
|
|
14
|
+
|
|
15
|
+
Scenario: Ordered posts of varying popularity
|
|
16
|
+
Given I have published these posts:
|
|
17
|
+
| title | popularity |
|
|
18
|
+
| one | 10 |
|
|
19
|
+
| two | 5 |
|
|
20
|
+
| three | 1 |
|
|
21
|
+
| four | 3 |
|
|
22
|
+
| five | 7 |
|
|
23
|
+
| six | 0 |
|
|
24
|
+
| seven | 8 |
|
|
25
|
+
When I am on the posts page
|
|
26
|
+
Then the "popular posts" sidebar should contain:
|
|
27
|
+
| title |
|
|
28
|
+
| one |
|
|
29
|
+
| seven |
|
|
30
|
+
| five |
|
|
31
|
+
| two |
|
|
32
|
+
| four |
|
|
33
|
+
And the "popular posts" sidebar should not contain "three"
|
|
34
|
+
And the "popular posts" sidebar should not contain "six"
|
|
35
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Feature: Recent posts
|
|
2
|
+
In order to make up-to-date content more easily accessible
|
|
3
|
+
As a blog owner
|
|
4
|
+
I want to list the most recent posts in the sidebar
|
|
5
|
+
|
|
6
|
+
Scenario: No posts yet
|
|
7
|
+
When I go to the posts page
|
|
8
|
+
Then I should not see "Recent"
|
|
9
|
+
|
|
10
|
+
Scenario: Most recent of 7
|
|
11
|
+
Given I have published these posts:
|
|
12
|
+
| title |
|
|
13
|
+
| one |
|
|
14
|
+
| two |
|
|
15
|
+
| three |
|
|
16
|
+
| four |
|
|
17
|
+
| five |
|
|
18
|
+
| six |
|
|
19
|
+
| seven |
|
|
20
|
+
When I go to the posts page
|
|
21
|
+
Then the "recent posts" sidebar should contain:
|
|
22
|
+
| title |
|
|
23
|
+
| seven |
|
|
24
|
+
| six |
|
|
25
|
+
| five |
|
|
26
|
+
| four |
|
|
27
|
+
| three |
|
|
28
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Feature: Similar Posts
|
|
2
|
+
As a blog owner
|
|
3
|
+
In order to persuade visitors to stay longer
|
|
4
|
+
I want to show them other posts similar to the current one
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given I have published these posts:
|
|
8
|
+
| title | tags |
|
|
9
|
+
| one | t1, t2, t3 |
|
|
10
|
+
| two | t1, t4 |
|
|
11
|
+
| three | t6, t8 |
|
|
12
|
+
| four | t1, t2, t5, t7 |
|
|
13
|
+
| five | |
|
|
14
|
+
| six | t3, t4, t5 |
|
|
15
|
+
| seven | t1, t2, t3, t4 |
|
|
16
|
+
|
|
17
|
+
Scenario: Don't show similar posts on index page, because index is not a post
|
|
18
|
+
When I am on the posts page
|
|
19
|
+
Then I should not see "Similar"
|
|
20
|
+
|
|
21
|
+
Scenario: Show similar posts in order of relevance
|
|
22
|
+
# "relevance" is here defined as "number of matching tags, descending".
|
|
23
|
+
When I look at the "one" post
|
|
24
|
+
Then I should see "Similar"
|
|
25
|
+
And the "similar posts" sidebar should contain:
|
|
26
|
+
| title |
|
|
27
|
+
| seven |
|
|
28
|
+
| four |
|
|
29
|
+
| six |
|
|
30
|
+
| two |
|
|
31
|
+
And the "similar posts" sidebar should not contain:
|
|
32
|
+
| title |
|
|
33
|
+
| one |
|
|
34
|
+
| three |
|
|
35
|
+
| five |
|
|
36
|
+
|
|
37
|
+
Scenario: Don't show similar posts sidebar if there are no similar posts
|
|
38
|
+
When I look at the "three" post
|
|
39
|
+
Then I should not see "Similar"
|
|
40
|
+
|
|
41
|
+
Scenario: Don't show similar posts sidebar if there are no tags
|
|
42
|
+
When I look at the "five" post
|
|
43
|
+
Then I should not see "Similar"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Given /^I am not authorized$/ do
|
|
2
|
+
Mist.reset_authorizations!
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Given /^I am authorized$/ do
|
|
6
|
+
Mist.authorize { |controller| true }
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Given /^I am authorized to (.*)$/ do |what|
|
|
10
|
+
what = what.gsub(/ /, '_').underscore.to_sym
|
|
11
|
+
Mist.authorize(what) { |controller| true }
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Given /^I am not authorized to (.*)$/ do |what|
|
|
15
|
+
what = what.gsub(/ /, '_').underscore.to_sym
|
|
16
|
+
Mist.authorize(what) { |controller| false }
|
|
17
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
When /^I run "([^"]*)"$/ do |arg1|
|
|
2
|
+
@execution_results = %x[#{arg1}]
|
|
3
|
+
$?.should be_success
|
|
4
|
+
@execution_results.should_not match(/Could not find generator/)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Then /^there should be a directory called "([^"]*)"$/ do |arg1|
|
|
8
|
+
File.should be_directory(arg1)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Then /^the "([^"]*)" directory should be a git repository$/ do |arg1|
|
|
12
|
+
step 'there should be a directory called "%s/.git"' % arg1
|
|
13
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Given /^I am on the (.*?) page$/ do |name|
|
|
2
|
+
visit Mist::Engine.routes.url_helpers.send("#{name.gsub(/ /, '_')}_path")
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Given /^I am on the (.*?) page in "([^"]*)" format$/ do |name, format|
|
|
6
|
+
visit Mist::Engine.routes.url_helpers.send("#{name.gsub(/ /, '_')}_path", :format => format)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
When /^I follow "([^"]*)"$/ do |arg1|
|
|
10
|
+
click_link arg1
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
When /^I fill in "([^"]*)" with "([^"]*)"$/ do |arg1, arg2|
|
|
14
|
+
fill_in arg1, :with => arg2
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
When /^I press "([^"]*)"$/ do |arg1|
|
|
18
|
+
click_button arg1
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Then /^I should be on the (.*?) page$/ do |name|
|
|
22
|
+
page.current_url.should =~ /^http:\/\/www.example.com\/#{name}\/?/
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Then /^I should see "([^"]*)"$/ do |arg1|
|
|
26
|
+
page.should have_content(arg1)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
When /^I go to the (.*?) page$/ do |name|
|
|
30
|
+
visit Mist::Engine.routes.url_helpers.send("#{name.gsub(/ /, '_')}_path")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Then /^I should not see "([^"]*)"$/ do |content|
|
|
34
|
+
page.should_not have_content(content)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Then /^show me the response$/ do
|
|
38
|
+
puts page.body
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Then /^the page source should contain "([^"]*)"$/ do |src|
|
|
42
|
+
page.body.should match(Regexp.compile(Regexp.escape src))
|
|
43
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
Given /^I have created a post called "([^"]*)"$/ do |title|
|
|
2
|
+
step 'I am on the posts page'
|
|
3
|
+
step 'I follow "New Post"'
|
|
4
|
+
step 'I fill in "Title" with "%s"' % title
|
|
5
|
+
step 'I fill in "Content" with "This is post content"'
|
|
6
|
+
step 'I press "Save"'
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Given /^I have published a post called "([^"]*)"$/ do |title|
|
|
10
|
+
step 'I am on the posts page'
|
|
11
|
+
step 'I follow "New Post"'
|
|
12
|
+
step 'I fill in "Published at" with "%s"' % Time.now
|
|
13
|
+
step 'I fill in "Title" with "%s"' % title
|
|
14
|
+
step 'I fill in "Content" with "This is post content"'
|
|
15
|
+
step 'I press "Save"'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Given /^I have published these posts:$/ do |table|
|
|
19
|
+
hashes = table.hashes
|
|
20
|
+
count = hashes.size
|
|
21
|
+
|
|
22
|
+
table.hashes.each_with_index do |hash, index|
|
|
23
|
+
attributes = hash.reverse_merge({'title' => "post#{index}",
|
|
24
|
+
'content' => "post#{index} content",
|
|
25
|
+
'published_at' => (count - index).minutes.ago})
|
|
26
|
+
step 'I am on the posts page'
|
|
27
|
+
step 'I follow "New Post"'
|
|
28
|
+
step 'I fill in "Published at" with "%s"' % attributes['published_at']
|
|
29
|
+
step 'I fill in "Title" with "%s"' % attributes['title']
|
|
30
|
+
step 'I fill in "Content" with "%s"' % attributes['content']
|
|
31
|
+
step 'I fill in "Tags" with "%s"' % attributes['tags']
|
|
32
|
+
step 'I press "Save"'
|
|
33
|
+
|
|
34
|
+
if attributes['popularity']
|
|
35
|
+
p = Mist::Post.last
|
|
36
|
+
p.popularity = attributes['popularity'].to_i
|
|
37
|
+
p.save!
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
When /^I create a post called "([^"]*)"$/ do |title|
|
|
43
|
+
step 'I have created a post called "%s"' % title
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
When /^I publish a post called "([^"]*)"$/ do |title|
|
|
47
|
+
step 'I have published a post called "%s"' % title
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
When /^I edit the "([^"]*)" post$/ do |post_title|
|
|
51
|
+
step 'I look at the "%s" post' % post_title
|
|
52
|
+
step 'I follow "Edit"'
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
When /^I look at the "([^"]*)" post$/ do |post_title|
|
|
56
|
+
step 'I am on the posts page'
|
|
57
|
+
step 'I follow "%s"' % post_title
|
|
58
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Then /^the "([^"]*)" sidebar should contain:$/ do |which, table|
|
|
2
|
+
table.hashes.each do |hash|
|
|
3
|
+
step 'the "%s" sidebar should contain "%s"' % [which, hash['title']]
|
|
4
|
+
end
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Then /^the "([^"]*)" sidebar should not contain:$/ do |which, table|
|
|
8
|
+
table.hashes.each do |hash|
|
|
9
|
+
step 'the "%s" sidebar should not contain "%s"' % [which, hash['title']]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then /^the "([^"]*)" sidebar should contain "([^"]*)"$/ do |which, content|
|
|
14
|
+
id = "sidebar-#{which.gsub(/ /, '-')}"
|
|
15
|
+
find('#'+id).should have_content(content)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Then /^the "([^"]*)" sidebar should not contain "([^"]*)"$/ do |which, content|
|
|
19
|
+
id = "sidebar-#{which.gsub(/ /, '-')}"
|
|
20
|
+
find('#'+id).should_not have_content(content)
|
|
21
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
|
|
2
|
+
# It is recommended to regenerate this file in the future when you upgrade to a
|
|
3
|
+
# newer version of cucumber-rails. Consider adding your own code to a new file
|
|
4
|
+
# instead of editing this one. Cucumber will automatically load all features/**/*.rb
|
|
5
|
+
# files.
|
|
6
|
+
|
|
7
|
+
require File.expand_path('../../spec/dummy_rails_app/config/environment', File.dirname(__FILE__))
|
|
8
|
+
Rails.application.config.cache_classes = true
|
|
9
|
+
require 'cucumber/rails'
|
|
10
|
+
|
|
11
|
+
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
|
|
12
|
+
# order to ease the transition to Capybara we set the default here. If you'd
|
|
13
|
+
# prefer to use XPath just remove this line and adjust any selectors in your
|
|
14
|
+
# steps to use the XPath syntax.
|
|
15
|
+
Capybara.default_selector = :css
|
|
16
|
+
|
|
17
|
+
# By default, any exception happening in your Rails application will bubble up
|
|
18
|
+
# to Cucumber so that your scenario will fail. This is a different from how
|
|
19
|
+
# your application behaves in the production environment, where an error page will
|
|
20
|
+
# be rendered instead.
|
|
21
|
+
#
|
|
22
|
+
# Sometimes we want to override this default behaviour and allow Rails to rescue
|
|
23
|
+
# exceptions and display an error page (just like when the app is running in production).
|
|
24
|
+
# Typical scenarios where you want to do this is when you test your error pages.
|
|
25
|
+
# There are two ways to allow Rails to rescue exceptions:
|
|
26
|
+
#
|
|
27
|
+
# 1) Tag your scenario (or feature) with @allow-rescue
|
|
28
|
+
#
|
|
29
|
+
# 2) Set the value below to true. Beware that doing this globally is not
|
|
30
|
+
# recommended as it will mask a lot of errors for you!
|
|
31
|
+
#
|
|
32
|
+
ActionController::Base.allow_rescue = false
|
|
33
|
+
|
|
34
|
+
# Remove/comment out the lines below if your app doesn't have a database.
|
|
35
|
+
# For some databases (like MongoDB and CouchDB) you may need to use :truncation instead.
|
|
36
|
+
begin
|
|
37
|
+
DatabaseCleaner.strategy = :transaction
|
|
38
|
+
rescue NameError
|
|
39
|
+
raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it."
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios.
|
|
43
|
+
# See the DatabaseCleaner documentation for details. Example:
|
|
44
|
+
#
|
|
45
|
+
# Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do
|
|
46
|
+
# DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
|
|
47
|
+
# end
|
|
48
|
+
#
|
|
49
|
+
# Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do
|
|
50
|
+
# DatabaseCleaner.strategy = :transaction
|
|
51
|
+
# end
|
|
52
|
+
#
|
|
53
|
+
|
|
54
|
+
# Possible values are :truncation and :transaction
|
|
55
|
+
# The :transaction strategy is faster, but might give you threading problems.
|
|
56
|
+
# See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
|
|
57
|
+
Cucumber::Rails::Database.javascript_strategy = :truncation
|
|
58
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'fakeweb'
|
|
2
|
+
|
|
3
|
+
Before do
|
|
4
|
+
FakeWeb.allow_net_connect = false
|
|
5
|
+
FileUtils.rm_rf Mist.repository_location
|
|
6
|
+
FileUtils.rm_rf Rails.root.join('tmp/cache')
|
|
7
|
+
Mist.reload_repository!
|
|
8
|
+
Mist.reset_authorizations!
|
|
9
|
+
Mist.authorize { |controller| true } # user is an admin by default
|
|
10
|
+
|
|
11
|
+
path = File.expand_path('../../spec/dummy_rails_app/public/posts.html', File.dirname(__FILE__))
|
|
12
|
+
FileUtils.rm path if File.exist?(path)
|
|
13
|
+
path = File.join(File.dirname(path), 'posts')
|
|
14
|
+
FileUtils.rm_rf path
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Feature: Update existing post
|
|
2
|
+
As a blog owner
|
|
3
|
+
In order to keep content up-to-date so users keep visiting
|
|
4
|
+
I want to update an existing post
|
|
5
|
+
|
|
6
|
+
Background:
|
|
7
|
+
Given I have published a post called "Post title"
|
|
8
|
+
|
|
9
|
+
Scenario: Update existing post from index
|
|
10
|
+
When I edit the "Post title" post
|
|
11
|
+
And I fill in "Title" with "New title"
|
|
12
|
+
And I fill in "Content" with "This is MOAR post content"
|
|
13
|
+
And I press "Save"
|
|
14
|
+
Then I should see "New title"
|
|
15
|
+
And I should see "This is MOAR post content"
|
|
16
|
+
|
|
17
|
+
When I go to the posts page
|
|
18
|
+
Then I should see "New title"
|
|
19
|
+
And I should not see "Post title"
|
data/gemfiles/common
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'sqlite3'
|
|
4
|
+
|
|
5
|
+
# Gems used only for assets and not required
|
|
6
|
+
# in production environments by default.
|
|
7
|
+
group :assets do
|
|
8
|
+
gem 'sass-rails', '>= 3.1.5'
|
|
9
|
+
gem 'coffee-rails', '>= 3.1.1'
|
|
10
|
+
gem 'uglifier', '>= 1.0.3'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
gem 'jquery-rails'
|
|
14
|
+
|
|
15
|
+
group :test, :development do
|
|
16
|
+
# Pretty printed test output
|
|
17
|
+
gem 'turn', '0.8.2', :require => false
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
gemspec :path => File.expand_path('../', File.dirname(__FILE__))
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: /Users/colin/projects/rails/mist
|
|
3
|
+
specs:
|
|
4
|
+
mist (0.6.0)
|
|
5
|
+
activegist (~> 0.6)
|
|
6
|
+
git (~> 1.2)
|
|
7
|
+
github-markup (~> 0.7)
|
|
8
|
+
redcarpet (~> 2.0)
|
|
9
|
+
|
|
10
|
+
GEM
|
|
11
|
+
remote: http://rubygems.org/
|
|
12
|
+
specs:
|
|
13
|
+
actionmailer (3.1.3)
|
|
14
|
+
actionpack (= 3.1.3)
|
|
15
|
+
mail (~> 2.3.0)
|
|
16
|
+
actionpack (3.1.3)
|
|
17
|
+
activemodel (= 3.1.3)
|
|
18
|
+
activesupport (= 3.1.3)
|
|
19
|
+
builder (~> 3.0.0)
|
|
20
|
+
erubis (~> 2.7.0)
|
|
21
|
+
i18n (~> 0.6)
|
|
22
|
+
rack (~> 1.3.5)
|
|
23
|
+
rack-cache (~> 1.1)
|
|
24
|
+
rack-mount (~> 0.8.2)
|
|
25
|
+
rack-test (~> 0.6.1)
|
|
26
|
+
sprockets (~> 2.0.3)
|
|
27
|
+
activegist (0.6.3)
|
|
28
|
+
activemodel (~> 3.1)
|
|
29
|
+
activesupport (~> 3.1)
|
|
30
|
+
rest-client (~> 1.6.7)
|
|
31
|
+
activemodel (3.1.3)
|
|
32
|
+
activesupport (= 3.1.3)
|
|
33
|
+
builder (~> 3.0.0)
|
|
34
|
+
i18n (~> 0.6)
|
|
35
|
+
activerecord (3.1.3)
|
|
36
|
+
activemodel (= 3.1.3)
|
|
37
|
+
activesupport (= 3.1.3)
|
|
38
|
+
arel (~> 2.2.1)
|
|
39
|
+
tzinfo (~> 0.3.29)
|
|
40
|
+
activeresource (3.1.3)
|
|
41
|
+
activemodel (= 3.1.3)
|
|
42
|
+
activesupport (= 3.1.3)
|
|
43
|
+
activesupport (3.1.3)
|
|
44
|
+
multi_json (~> 1.0)
|
|
45
|
+
ansi (1.4.1)
|
|
46
|
+
arel (2.2.1)
|
|
47
|
+
builder (3.0.0)
|
|
48
|
+
capybara (1.1.2)
|
|
49
|
+
mime-types (>= 1.16)
|
|
50
|
+
nokogiri (>= 1.3.3)
|
|
51
|
+
rack (>= 1.0.0)
|
|
52
|
+
rack-test (>= 0.5.4)
|
|
53
|
+
selenium-webdriver (~> 2.0)
|
|
54
|
+
xpath (~> 0.1.4)
|
|
55
|
+
childprocess (0.3.0)
|
|
56
|
+
ffi (~> 1.0.6)
|
|
57
|
+
coffee-rails (3.1.1)
|
|
58
|
+
coffee-script (>= 2.2.0)
|
|
59
|
+
railties (~> 3.1.0)
|
|
60
|
+
coffee-script (2.2.0)
|
|
61
|
+
coffee-script-source
|
|
62
|
+
execjs
|
|
63
|
+
coffee-script-source (1.2.0)
|
|
64
|
+
cucumber (1.1.4)
|
|
65
|
+
builder (>= 2.1.2)
|
|
66
|
+
diff-lcs (>= 1.1.2)
|
|
67
|
+
gherkin (~> 2.7.1)
|
|
68
|
+
json (>= 1.4.6)
|
|
69
|
+
term-ansicolor (>= 1.0.6)
|
|
70
|
+
cucumber-rails (1.2.1)
|
|
71
|
+
capybara (>= 1.1.2)
|
|
72
|
+
cucumber (>= 1.1.3)
|
|
73
|
+
nokogiri (>= 1.5.0)
|
|
74
|
+
database_cleaner (0.7.1)
|
|
75
|
+
diff-lcs (1.1.3)
|
|
76
|
+
erubis (2.7.0)
|
|
77
|
+
execjs (1.3.0)
|
|
78
|
+
multi_json (~> 1.0)
|
|
79
|
+
factory_girl (2.3.2)
|
|
80
|
+
activesupport
|
|
81
|
+
factory_girl_rails (1.4.0)
|
|
82
|
+
factory_girl (~> 2.3.0)
|
|
83
|
+
railties (>= 3.0.0)
|
|
84
|
+
fakeweb (1.3.0)
|
|
85
|
+
ffi (1.0.11)
|
|
86
|
+
gherkin (2.7.4)
|
|
87
|
+
json (>= 1.4.6)
|
|
88
|
+
git (1.2.5)
|
|
89
|
+
github-markup (0.7.0)
|
|
90
|
+
hike (1.2.1)
|
|
91
|
+
i18n (0.6.0)
|
|
92
|
+
jquery-rails (1.0.19)
|
|
93
|
+
railties (~> 3.0)
|
|
94
|
+
thor (~> 0.14)
|
|
95
|
+
json (1.6.5)
|
|
96
|
+
mail (2.3.0)
|
|
97
|
+
i18n (>= 0.4.0)
|
|
98
|
+
mime-types (~> 1.16)
|
|
99
|
+
treetop (~> 1.4.8)
|
|
100
|
+
mime-types (1.17.2)
|
|
101
|
+
multi_json (1.0.4)
|
|
102
|
+
nokogiri (1.5.0)
|
|
103
|
+
polyglot (0.3.3)
|
|
104
|
+
rack (1.3.6)
|
|
105
|
+
rack-cache (1.1)
|
|
106
|
+
rack (>= 0.4)
|
|
107
|
+
rack-mount (0.8.3)
|
|
108
|
+
rack (>= 1.0.0)
|
|
109
|
+
rack-ssl (1.3.2)
|
|
110
|
+
rack
|
|
111
|
+
rack-test (0.6.1)
|
|
112
|
+
rack (>= 1.0)
|
|
113
|
+
rails (3.1.3)
|
|
114
|
+
actionmailer (= 3.1.3)
|
|
115
|
+
actionpack (= 3.1.3)
|
|
116
|
+
activerecord (= 3.1.3)
|
|
117
|
+
activeresource (= 3.1.3)
|
|
118
|
+
activesupport (= 3.1.3)
|
|
119
|
+
bundler (~> 1.0)
|
|
120
|
+
railties (= 3.1.3)
|
|
121
|
+
railties (3.1.3)
|
|
122
|
+
actionpack (= 3.1.3)
|
|
123
|
+
activesupport (= 3.1.3)
|
|
124
|
+
rack-ssl (~> 1.3.2)
|
|
125
|
+
rake (>= 0.8.7)
|
|
126
|
+
rdoc (~> 3.4)
|
|
127
|
+
thor (~> 0.14.6)
|
|
128
|
+
rake (0.9.2.2)
|
|
129
|
+
rdoc (3.12)
|
|
130
|
+
json (~> 1.4)
|
|
131
|
+
redcarpet (2.0.1)
|
|
132
|
+
rest-client (1.6.7)
|
|
133
|
+
mime-types (>= 1.16)
|
|
134
|
+
rspec (2.8.0)
|
|
135
|
+
rspec-core (~> 2.8.0)
|
|
136
|
+
rspec-expectations (~> 2.8.0)
|
|
137
|
+
rspec-mocks (~> 2.8.0)
|
|
138
|
+
rspec-core (2.8.0)
|
|
139
|
+
rspec-expectations (2.8.0)
|
|
140
|
+
diff-lcs (~> 1.1.2)
|
|
141
|
+
rspec-mocks (2.8.0)
|
|
142
|
+
rspec-rails (2.8.1)
|
|
143
|
+
actionpack (>= 3.0)
|
|
144
|
+
activesupport (>= 3.0)
|
|
145
|
+
railties (>= 3.0)
|
|
146
|
+
rspec (~> 2.8.0)
|
|
147
|
+
rubyzip (0.9.5)
|
|
148
|
+
sass (3.1.12)
|
|
149
|
+
sass-rails (3.1.5)
|
|
150
|
+
actionpack (~> 3.1.0)
|
|
151
|
+
railties (~> 3.1.0)
|
|
152
|
+
sass (~> 3.1.10)
|
|
153
|
+
tilt (~> 1.3.2)
|
|
154
|
+
selenium-webdriver (2.17.0)
|
|
155
|
+
childprocess (>= 0.2.5)
|
|
156
|
+
ffi (~> 1.0.9)
|
|
157
|
+
multi_json (~> 1.0.4)
|
|
158
|
+
rubyzip
|
|
159
|
+
sprockets (2.0.3)
|
|
160
|
+
hike (~> 1.2)
|
|
161
|
+
rack (~> 1.0)
|
|
162
|
+
tilt (~> 1.1, != 1.3.0)
|
|
163
|
+
sqlite3 (1.3.5)
|
|
164
|
+
term-ansicolor (1.0.7)
|
|
165
|
+
thor (0.14.6)
|
|
166
|
+
tilt (1.3.3)
|
|
167
|
+
treetop (1.4.10)
|
|
168
|
+
polyglot
|
|
169
|
+
polyglot (>= 0.3.1)
|
|
170
|
+
turn (0.8.2)
|
|
171
|
+
ansi (>= 1.2.2)
|
|
172
|
+
tzinfo (0.3.31)
|
|
173
|
+
uglifier (1.2.2)
|
|
174
|
+
execjs (>= 0.3.0)
|
|
175
|
+
multi_json (>= 1.0.2)
|
|
176
|
+
xpath (0.1.4)
|
|
177
|
+
nokogiri (~> 1.3)
|
|
178
|
+
|
|
179
|
+
PLATFORMS
|
|
180
|
+
ruby
|
|
181
|
+
|
|
182
|
+
DEPENDENCIES
|
|
183
|
+
coffee-rails (>= 3.1.1)
|
|
184
|
+
cucumber-rails (~> 1.2.1)
|
|
185
|
+
database_cleaner (~> 0.7.0)
|
|
186
|
+
factory_girl_rails (= 1.4.0)
|
|
187
|
+
fakeweb (~> 1.3.0)
|
|
188
|
+
jquery-rails
|
|
189
|
+
mist!
|
|
190
|
+
rails (= 3.1.3)
|
|
191
|
+
rspec-rails (~> 2.8.1)
|
|
192
|
+
sass-rails (>= 3.1.5)
|
|
193
|
+
sqlite3
|
|
194
|
+
turn (= 0.8.2)
|
|
195
|
+
uglifier (>= 1.0.3)
|