Merge pull request #5289 from svbergerem/convert-cukes-tags

Convert some cukes to rspec tests
This commit is contained in:
Jonne Haß 2014-10-14 13:26:53 +02:00
commit e892b115ac
10 changed files with 46 additions and 92 deletions

View file

@ -1,23 +0,0 @@
@javascript
Feature: The activity stream
Scenario: Sorting
Given a user with username "bob"
When I sign in as "bob@bob.bob"
And I click the publisher and post "A- I like turtles"
And I click the publisher and post "B- barack obama is your new bicycle"
And I click the publisher and post "C- barack obama is a square"
When I go to the activity stream page
Then "C- barack obama is a square" should be post 1
And "B- barack obama is your new bicycle" should be post 2
And "A- I like turtles" should be post 3
When I like the post "A- I like turtles"
And I comment "Sassy sawfish" on "C- barack obama is a square"
And I like the post "B- barack obama is your new bicycle"
When I go to the activity stream page
Then "B- barack obama is your new bicycle" should be post 1
And "C- barack obama is a square" should be post 2
And "A- I like turtles" should be post 3

View file

@ -16,22 +16,3 @@ Feature: Close account
When I try to sign in manually
Then I should be on the new user session page
And I should see a flash message with a warning
Scenario: post display should not throw error when mention is removed for the user whose account is closed
Given following users exist:
| username | email |
| Bob Jones | bob@bob.bob |
| Alice Smith | alice@alice.alice |
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
And Alice has a post mentioning Bob
Then I sign in as "bob@bob.bob"
When I go to the users edit page
And I follow "close_account"
And I put in my password in "close_account_password" in the modal window
And I press "close_account_confirm" in the modal window
And I confirm the alert
Then I should be on the new user session page
When I sign in as "alice@alice.alice"
And I am on the home page
Then I should see "Bob Jones"

View file

@ -43,10 +43,3 @@ Feature: editing your profile
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see a "img" within "#profile_photo_upload"
When I go to my new profile page
# #commented out until we bring back the profile info on new profile
# Then I should see "Gender: Fearless"
And I should see "Boba Fett"
# And I should see "Bio: This is a bio"
# And I should see "Birthday: 1986-11-30"

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

@ -44,6 +44,3 @@ Feature: editing the profile in the mobile view
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see a "img" within "#profile_photo_upload"
When I go to my new profile page
And I should see "Boba Fett"

View file

@ -36,10 +36,6 @@ module NavigationHelpers
person_photos_path p
when /^my account settings page$/
edit_user_path
when /^my new profile page$/
person_path(@me.person, :ex => true)
when /^the new stream$/
stream_path(:ex => true)
when /^forgot password page$/
new_user_password_path
when /^"(\/.*)"/

View file

@ -30,6 +30,17 @@ describe PostsController, :type => :controller do
expect(response).to be_success
end
it 'succeeds after removing a mention when closing the mentioned user\'s account' do
user = FactoryGirl.create(:user, :username => "user")
alice.share_with(user.person, alice.aspects.first)
msg = alice.build_post :status_message, text: "Mention @{User ; #{user.diaspora_handle}}", :public => true, :to => 'all'
msg.save!
expect(msg.mentioned_people.count).to eq(1)
user.destroy
get :show, "id" => msg.id
expect(response).to be_success
end
it 'renders the application layout on mobile' do
get :show, :id => @message.id, :format => :mobile
expect(response).to render_template('layouts/application')

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

View file

@ -3,10 +3,19 @@ require Rails.root.join('spec', 'shared_behaviors', 'stream')
describe Stream::Activity do
before do
@stream = Stream::Activity.new(alice, :max_time => Time.now, :order => 'updated_at')
@stream = Stream::Activity.new(alice)
end
describe 'shared behaviors' do
it_should_behave_like 'it is a stream'
end
describe "#posts" do
it "calls EvilQuery::Participation with correct parameters" do
expect(::EvilQuery::Participation).to receive(:new)
.with(alice)
.and_return(double.tap { |m| allow(m).to receive(:posts)})
@stream.posts
end
end
end