Skip to content

Commit

Permalink
Fixed mock error on comment story. Created plugin tests for superuser…
Browse files Browse the repository at this point in the history
…, for ticket 23.
  • Loading branch information
mseppae committed Jul 16, 2008
1 parent 0596b7f commit 344d6cb
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 9 deletions.
2 changes: 2 additions & 0 deletions config/environment.rb
Expand Up @@ -33,6 +33,8 @@
config.gem 'RedCloth', :lib => "redcloth"
config.gem 'rubypants', :lib => 'ruby_pants'
config.gem 'json'
config.gem 'rspec', :lib => 'spec'
config.gem 'rspec-rails', :lib => 'spec'

# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
Expand Down
7 changes: 3 additions & 4 deletions stories/steps/asset.rb
@@ -1,8 +1,7 @@
steps_for :asset do
Given "a site with an asset" do
Given "a site"
raise "STEP NOT IMPLEMENTED: a site with an asset"
end
Given "a site with an asset" # do
# Given "a site"
#end

When "the user visits admin sites assets list page" do
raise "this step expects the variable @site to be set" unless @site
Expand Down
3 changes: 2 additions & 1 deletion stories/steps/authentication.rb
Expand Up @@ -21,6 +21,7 @@
@user.verified!

post "/session", :user => {:login => @user.login, :password => @user.password}
controller.authenticated?.should be_true
end

Given "a verified user" do
Expand Down Expand Up @@ -110,4 +111,4 @@
response.should render_template('session/new')
end

end
end
7 changes: 5 additions & 2 deletions stories/steps/comment.rb
Expand Up @@ -18,7 +18,10 @@

When "the user posts a comment which Akismet thinks is $result" do |result|
result = result == 'ham'
Viking.stub!(:connect).and_return(mock('akismet', :check_comment => result))
# TODO this is just a quickfix
# For some reason mock call causes method not found error on ubuntu
akismet_mock = Spec::Mocks::Mock.new('akismet', :check_comment => result)
Viking.stub!(:connect).and_return(akismet_mock)
When "the user posts a comment to the blog article"
end

Expand Down Expand Up @@ -58,4 +61,4 @@
Then "the comment is not approved" do
@comment.approved?.should be_false
end
end
end
8 changes: 8 additions & 0 deletions stories/steps/default.rb
Expand Up @@ -62,4 +62,12 @@
Then "the 'Save as draft?' checkbox is checked by default" do
response.should have_tag("input#article-draft[type=?][value=?]", 'checkbox', 1)
end

Then "the page should not have '$link' link" do |link|
response.should_not have_tag("a", link)
end

Then "the page should have '$link' link" do |link|
response.should have_tag("a", link)
end
end
4 changes: 4 additions & 0 deletions stories/steps/site.rb
Expand Up @@ -48,6 +48,10 @@
When "the user visits the admin site edit page" do
get edit_admin_site_path(@site)
end

When "the user visits the admin site index page" do
get admin_site_path(@site)
end

When "the user fills in the admin site creation form with valid values" do
fills_in 'website name', :with => 'a new site name'
Expand Down
2 changes: 1 addition & 1 deletion stories/stories/admin/plugin.txt
Expand Up @@ -18,4 +18,4 @@ Story: Managing a site's plugins
When the user fills in the plugin config edit form
And the user clicks the 'Save' button
Then the plugin's configuration is saved


2 changes: 1 addition & 1 deletion stories/stories/blog_comments.txt
Expand Up @@ -75,4 +75,4 @@ Story: Spam control for blog comments
And a blog that allows anonymous users to create comments
And a published blog article with no comments
When the user posts a comment which Akismet thinks is ham
Then the comment is approved
Then the comment is approved
16 changes: 16 additions & 0 deletions stories/stories/superuser/plugin.txt
@@ -0,0 +1,16 @@
Story: Managing a site plugins
As an superuser
I want to manage site plugins
So I can see what's installed and change config options

Scenario: A superuser should not see plugin link before selecting a page
Given a site
And the user is logged in as superuser
When the user visits the admin sites list page
Then the page should not have 'Plugins' link

Scenario: A superuser should see plugin link after selecting a page
Given a site
And the user is logged in as superuser
When the user visits the admin site index page
Then the page should have 'Plugins' link

0 comments on commit 344d6cb

Please sign in to comment.