Convert tag cukes to rspec tests

This commit is contained in:
Steffen van Bergerem 2014-10-06 01:09:00 +02:00
parent d44300c7a2
commit 823316d7f7
3 changed files with 25 additions and 35 deletions

View file

@ -1,13 +0,0 @@
@javascript
Feature: Interacting with tags
Background:
Given there is a user "Samuel Beckett" who's tagged "#rockstar"
And I am signed in
And I am on the homepage
Scenario: Searching for a tag
When I search for "#rockstar"
Then I should be on the tag page for "rockstar"
And I should see "Samuel Beckett"

View file

@ -1,21 +0,0 @@
@javascript
Feature: Issue #3382 The comments under postings are missing when using the #tags -view
Background:
Given a user named "Bob Jones" with email "bob@bob.bob"
And I sign in as "bob@bob.bob"
When I post a status with the text "This is a post with a #tag"
And I am on the homepage
Scenario:
When I search for "#tag"
Then I should be on the tag page for "tag"
And I should see "This is a post with a #tag"
Scenario:
When I comment "this is a comment on my post" on "This is a post with a #tag"
And I search for "#tag"
Then I should be on the tag page for "tag"
And I should see "this is a comment on my post"

View file

@ -47,9 +47,22 @@ describe TagsController, :type => :controller do
end
end
context 'with a tagged user' do
before do
bob.profile.tag_string = "#cats #diaspora #rad"
bob.profile.build_tags
bob.profile.save!
end
it 'includes the tagged user' do
get :show, :name => 'cats'
expect(response.body).to include(bob.diaspora_handle)
end
end
context 'with a tagged post' do
before do
eve.post(:status_message, text: "#what #yes #hellyes #foo", public: true, to: 'all')
@post = eve.post(:status_message, text: "#what #yes #hellyes #foo tagged post", public: true, to: 'all')
end
context 'signed in' do
@ -66,6 +79,17 @@ describe TagsController, :type => :controller do
get :show, :name => 'hellyes'
expect(response.status).to eq(200)
end
it 'includes the tagged post' do
get :show, :name => 'foo'
expect(assigns[:stream].posts.first.text).to include("tagged post")
end
it 'includes comments of the tagged post' do
alice.comment!(@post, "comment on a tagged post")
get :show, :name => 'foo', :format => 'json'
expect(response.body).to include("comment on a tagged post")
end
end
context "not signed in" do