discourse/spec/controllers/directory_items_controller_spec.rb
Robin Ward 7ef306cd3b A bunch of tweaks to the Users directory
- Move user directory from `/directory` to `/users/`
- Defaults to 'weekly' time period
- Don't include deleted topics/posts in the results
- Move heart icon to header instead of on each row
- "Users" instead of "Users found"
2015-03-19 12:29:38 -04:00

32 lines
742 B
Ruby

require 'spec_helper'
describe DirectoryItemsController do
it "requires a `period` param" do
->{ xhr :get, :index }.should raise_error
end
it "requires a proper `period` param" do
xhr :get, :index, period: 'eviltrout'
response.should_not be_success
end
context "with data" do
before do
Fabricate(:user)
DirectoryItem.refresh!
end
it "succeeds with a valid value" do
xhr :get, :index, period: 'all'
response.should be_success
json = ::JSON.parse(response.body)
json.should be_present
json['directory_items'].should be_present
json['total_rows_directory_items'].should be_present
json['load_more_directory_items'].should be_present
end
end
end