mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 03:09:43 +00:00
fix most deprecations in the specs (still some left)
This commit is contained in:
parent
dd5872eecb
commit
de76b512c1
@ -35,7 +35,7 @@ class ScreenedEmail < ActiveRecord::Base
|
||||
|
||||
screened_email.record_match! if screened_email
|
||||
|
||||
screened_email && screened_email.action_type == actions[:block]
|
||||
screened_email.try(:action_type) == actions[:block]
|
||||
end
|
||||
|
||||
def self.levenshtein(first, second)
|
||||
|
@ -528,16 +528,16 @@ class Topic < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def remove_allowed_user(username)
|
||||
user = User.find_by(username: username)
|
||||
if user
|
||||
if user = User.find_by(username: username)
|
||||
topic_user = topic_allowed_users.find_by(user_id: user.id)
|
||||
if topic_user
|
||||
topic_user.destroy
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Invite a user to the topic by username or email. Returns success/failure
|
||||
def invite(invited_by, username_or_email, group_ids=nil)
|
||||
|
@ -54,15 +54,15 @@ class PostSerializer < BasicPostSerializer
|
||||
:via_email
|
||||
|
||||
def moderator?
|
||||
!!(object.user && object.user.moderator?)
|
||||
!!(object.try(:user).try(:moderator?))
|
||||
end
|
||||
|
||||
def admin?
|
||||
!!(object.user && object.user.admin?)
|
||||
!!(object.try(:user).try(:admin?))
|
||||
end
|
||||
|
||||
def staff?
|
||||
!!(object.user && object.user.staff?)
|
||||
!!(object.try(:user).try(:staff?))
|
||||
end
|
||||
|
||||
def yours
|
||||
@ -119,11 +119,11 @@ class PostSerializer < BasicPostSerializer
|
||||
end
|
||||
|
||||
def user_title
|
||||
object.user.try(:title)
|
||||
object.try(:user).try(:title)
|
||||
end
|
||||
|
||||
def trust_level
|
||||
object.user.try(:trust_level)
|
||||
object.try(:user).try(:trust_level)
|
||||
end
|
||||
|
||||
def reply_to_user
|
||||
|
@ -35,14 +35,16 @@ module Scheduler
|
||||
|
||||
def valid_every?
|
||||
return false unless @klass.every
|
||||
@prev_run &&
|
||||
!!@prev_run &&
|
||||
@prev_run <= Time.now.to_i &&
|
||||
@next_run < @prev_run + @klass.every * (1 + @manager.random_ratio)
|
||||
end
|
||||
|
||||
def valid_daily?
|
||||
return false unless @klass.daily
|
||||
@prev_run && @prev_run <= Time.now.to_i && @next_run < @prev_run + 1.day
|
||||
!!@prev_run &&
|
||||
@prev_run <= Time.now.to_i &&
|
||||
@next_run < @prev_run + 1.day
|
||||
end
|
||||
|
||||
def schedule_every!
|
||||
|
@ -3,8 +3,8 @@ module UrlHelper
|
||||
def is_local(url)
|
||||
url.present? && (
|
||||
Discourse.store.has_been_uploaded?(url) ||
|
||||
url =~ /^\/assets\// ||
|
||||
url =~ /^\/plugins\// ||
|
||||
!!(url =~ /^\/assets\//) ||
|
||||
!!(url =~ /^\/plugins\//) ||
|
||||
url.start_with?(Discourse.asset_host || Discourse.base_url_no_prefix)
|
||||
)
|
||||
end
|
||||
|
@ -7,20 +7,20 @@ describe PollPlugin::Poll do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
it "should detect poll post correctly" do
|
||||
expect(poll.is_poll?).to be_true
|
||||
expect(poll.is_poll?).should == true
|
||||
post2 = create_post(topic: topic, raw: "This is a generic reply.")
|
||||
expect(PollPlugin::Poll.new(post2).is_poll?).to be_false
|
||||
expect(PollPlugin::Poll.new(post2).is_poll?).should == false
|
||||
post.topic.title = "Not a poll"
|
||||
expect(poll.is_poll?).to be_false
|
||||
expect(poll.is_poll?).should == false
|
||||
end
|
||||
|
||||
it "strips whitespace from the prefix translation" do
|
||||
topic.title = "Polll: This might be a poll"
|
||||
topic.save
|
||||
expect(PollPlugin::Poll.new(post).is_poll?).to be_false
|
||||
expect(PollPlugin::Poll.new(post).is_poll?).should == false
|
||||
I18n.expects(:t).with('poll.prefix').returns("Polll ")
|
||||
I18n.expects(:t).with('poll.closed_prefix').returns("Closed Poll ")
|
||||
expect(PollPlugin::Poll.new(post).is_poll?).to be_true
|
||||
expect(PollPlugin::Poll.new(post).is_poll?).should == true
|
||||
end
|
||||
|
||||
it "should get options correctly" do
|
||||
|
@ -15,11 +15,11 @@ describe PostCreator do
|
||||
|
||||
it "cannot have options changed after 5 minutes" do
|
||||
poll_post.raw = "[poll]\n* option 1\n* option 2\n* option 3\n[/poll]"
|
||||
poll_post.valid?.should be_true
|
||||
poll_post.valid?.should == true
|
||||
poll_post.save
|
||||
Timecop.freeze(Time.now + 6.minutes) do
|
||||
poll_post.raw = "[poll]\n* option 1\n* option 2\n* option 3\n* option 4\n[/poll]"
|
||||
poll_post.valid?.should be_false
|
||||
poll_post.valid?.should == false
|
||||
poll_post.errors[:poll_options].should be_present
|
||||
end
|
||||
end
|
||||
@ -28,9 +28,9 @@ describe PostCreator do
|
||||
poll_post.last_editor_id = admin.id
|
||||
Timecop.freeze(Time.now + 6.minutes) do
|
||||
poll_post.raw = "[poll]\n* option 1\n* option 2\n* option 3\n* option 4.1\n[/poll]"
|
||||
poll_post.valid?.should be_true
|
||||
poll_post.valid?.should == true
|
||||
poll_post.raw = "[poll]\n* option 1\n* option 2\n* option 3\n[/poll]"
|
||||
poll_post.valid?.should be_false
|
||||
poll_post.valid?.should == false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ describe Auth::FacebookAuthenticator do
|
||||
|
||||
result = authenticator.after_authenticate(hash)
|
||||
|
||||
result.user.should be_nil
|
||||
result.user.should == nil
|
||||
result.extra_data[:name].should == "bob bob"
|
||||
end
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ describe Auth::GoogleOAuth2Authenticator do
|
||||
authenticator = described_class.new
|
||||
result = authenticator.after_authenticate(hash)
|
||||
|
||||
result.user.should be_nil
|
||||
result.user.should == nil
|
||||
result.extra_data[:name].should == "Jane Doe"
|
||||
end
|
||||
end
|
||||
|
@ -12,11 +12,11 @@ describe AvatarLookup do
|
||||
end
|
||||
|
||||
it 'returns nil if user_id does not exists' do
|
||||
@avatar_lookup[0].should be_nil
|
||||
@avatar_lookup[0].should == nil
|
||||
end
|
||||
|
||||
it 'returns nil if user_id is nil' do
|
||||
@avatar_lookup[nil].should be_nil
|
||||
@avatar_lookup[nil].should == nil
|
||||
end
|
||||
|
||||
it 'returns user if user_id exists' do
|
||||
|
@ -23,7 +23,7 @@ describe Cache do
|
||||
cache.write("hello1", "world")
|
||||
cache.clear
|
||||
|
||||
cache.read("hello0").should be_nil
|
||||
cache.read("hello0").should == nil
|
||||
end
|
||||
|
||||
it "can delete by family" do
|
||||
@ -32,8 +32,8 @@ describe Cache do
|
||||
|
||||
cache.delete_by_family("my_family")
|
||||
|
||||
cache.fetch("key").should be_nil
|
||||
cache.fetch("key2").should be_nil
|
||||
cache.fetch("key").should == nil
|
||||
cache.fetch("key2").should == nil
|
||||
|
||||
end
|
||||
|
||||
@ -43,7 +43,7 @@ describe Cache do
|
||||
end
|
||||
|
||||
cache.delete("key")
|
||||
cache.fetch("key").should be_nil
|
||||
cache.fetch("key").should == nil
|
||||
end
|
||||
|
||||
#TODO yuck on this mock
|
||||
|
@ -40,10 +40,10 @@ describe CategoryList do
|
||||
CategoryList.new(Guardian.new(admin)).categories.find { |x| x.name == private_cat.name }.displayable_topics.count.should == 1
|
||||
|
||||
CategoryList.new(Guardian.new(user)).categories.find { |x| x.name == public_cat.name }.displayable_topics.count.should == 1
|
||||
CategoryList.new(Guardian.new(user)).categories.find { |x| x.name == private_cat.name }.should be_nil
|
||||
CategoryList.new(Guardian.new(user)).categories.find { |x| x.name == private_cat.name }.should == nil
|
||||
|
||||
CategoryList.new(Guardian.new(nil)).categories.find { |x| x.name == public_cat.name }.displayable_topics.count.should == 1
|
||||
CategoryList.new(Guardian.new(nil)).categories.find { |x| x.name == private_cat.name }.should be_nil
|
||||
CategoryList.new(Guardian.new(nil)).categories.find { |x| x.name == private_cat.name }.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -98,7 +98,7 @@ describe CategoryList do
|
||||
end
|
||||
|
||||
it "should contain our topic" do
|
||||
category.featured_topics.include?(topic).should be_true
|
||||
category.featured_topics.include?(topic).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -102,7 +102,7 @@ describe ComposerMessagesFinder do
|
||||
end
|
||||
|
||||
it "creates a notified_about_avatar log" do
|
||||
UserHistory.exists_for_user?(user, :notified_about_avatar).should be_true
|
||||
UserHistory.exists_for_user?(user, :notified_about_avatar).should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -185,7 +185,7 @@ describe ComposerMessagesFinder do
|
||||
end
|
||||
|
||||
it "creates a notified_about_sequential_replies log" do
|
||||
UserHistory.exists_for_user?(user, :notified_about_sequential_replies).should be_true
|
||||
UserHistory.exists_for_user?(user, :notified_about_sequential_replies).should == true
|
||||
end
|
||||
|
||||
end
|
||||
@ -270,7 +270,7 @@ describe ComposerMessagesFinder do
|
||||
end
|
||||
|
||||
it "creates a notified_about_dominating_topic log" do
|
||||
UserHistory.exists_for_user?(user, :notified_about_dominating_topic).should be_true
|
||||
UserHistory.exists_for_user?(user, :notified_about_dominating_topic).should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -106,7 +106,7 @@ describe CookedPostProcessor do
|
||||
|
||||
it "adds a topic image if there's one in the post" do
|
||||
FastImage.stubs(:size)
|
||||
post.topic.image_url.should be_nil
|
||||
post.topic.image_url.should == nil
|
||||
cpp.post_process_images
|
||||
post.topic.reload
|
||||
post.topic.image_url.should be_present
|
||||
@ -364,12 +364,12 @@ describe CookedPostProcessor do
|
||||
|
||||
it "is true when the image is inside a link" do
|
||||
img = doc.css("img#linked_image").first
|
||||
cpp.is_a_hyperlink?(img).should be_true
|
||||
cpp.is_a_hyperlink?(img).should == true
|
||||
end
|
||||
|
||||
it "is false when the image is not inside a link" do
|
||||
img = doc.css("img#standard_image").first
|
||||
cpp.is_a_hyperlink?(img).should be_false
|
||||
cpp.is_a_hyperlink?(img).should == false
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -53,7 +53,7 @@ describe DiscoursePluginRegistry do
|
||||
end
|
||||
|
||||
it 'is returned by DiscoursePluginRegistry.stylesheets' do
|
||||
registry_instance.stylesheets.include?('hello.css').should be_true
|
||||
registry_instance.stylesheets.include?('hello.css').should == true
|
||||
end
|
||||
|
||||
it "won't add the same file twice" do
|
||||
@ -67,7 +67,7 @@ describe DiscoursePluginRegistry do
|
||||
end
|
||||
|
||||
it 'is returned by DiscoursePluginRegistry.javascripts' do
|
||||
registry_instance.javascripts.include?('hello.js').should be_true
|
||||
registry_instance.javascripts.include?('hello.js').should == true
|
||||
end
|
||||
|
||||
it "won't add the same file twice" do
|
||||
|
@ -6,19 +6,19 @@ describe Email do
|
||||
describe "is_valid?" do
|
||||
|
||||
it 'treats a good email as valid' do
|
||||
Email.is_valid?('sam@sam.com').should be_true
|
||||
Email.is_valid?('sam@sam.com').should == true
|
||||
end
|
||||
|
||||
it 'treats a bad email as invalid' do
|
||||
Email.is_valid?('sam@sam').should be_false
|
||||
Email.is_valid?('sam@sam').should == false
|
||||
end
|
||||
|
||||
it 'allows museum tld' do
|
||||
Email.is_valid?('sam@nic.museum').should be_true
|
||||
Email.is_valid?('sam@nic.museum').should == true
|
||||
end
|
||||
|
||||
it 'does not think a word is an email' do
|
||||
Email.is_valid?('sam').should be_false
|
||||
Email.is_valid?('sam').should == false
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -28,7 +28,7 @@ describe Email::Receiver do
|
||||
expect { test_parse_body(fixture_file("emails/no_content_reply.eml")) }.to raise_error(Email::Receiver::EmptyEmailError)
|
||||
end
|
||||
|
||||
pending "raises EmailUnparsableError if the headers are corrupted" do
|
||||
skip "raises EmailUnparsableError if the headers are corrupted" do
|
||||
expect { ; }.to raise_error(Email::Receiver::EmailUnparsableError)
|
||||
end
|
||||
|
||||
@ -130,7 +130,7 @@ Thanks for listening."
|
||||
|
||||
topic.posts.count.should == (start_count + 1)
|
||||
created_post = topic.posts.last
|
||||
created_post.via_email.should be_true
|
||||
created_post.via_email.should == true
|
||||
created_post.cooked.strip.should == fixture_file("emails/valid_reply.cooked").strip
|
||||
end
|
||||
end
|
||||
@ -168,7 +168,7 @@ Thanks for listening."
|
||||
|
||||
topic.posts.count.should == (start_count + 1)
|
||||
topic.posts.last.cooked.should match /<img src=['"](\/uploads\/default\/\d+\/\w{16}\.png)['"] width=['"]289['"] height=['"]126['"]>/
|
||||
Upload.find_by(sha1: upload_sha).should_not be_nil
|
||||
Upload.find_by(sha1: upload_sha).should_not == nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -16,11 +16,11 @@ describe Enum do
|
||||
|
||||
describe ".valid?" do
|
||||
it "returns true if a key exists" do
|
||||
enum.valid?(:finn).should be_true
|
||||
enum.valid?(:finn).should == true
|
||||
end
|
||||
|
||||
it "returns false if a key does not exist" do
|
||||
enum.valid?(:obama).should be_false
|
||||
enum.valid?(:obama).should == false
|
||||
end
|
||||
end
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,11 +13,11 @@ describe ImageSizer do
|
||||
end
|
||||
|
||||
it 'returns nil if the width is nil' do
|
||||
ImageSizer.resize(nil, 100).should be_nil
|
||||
ImageSizer.resize(nil, 100).should == nil
|
||||
end
|
||||
|
||||
it 'returns nil if the height is nil' do
|
||||
ImageSizer.resize(100, nil).should be_nil
|
||||
ImageSizer.resize(100, nil).should == nil
|
||||
end
|
||||
|
||||
it 'works with string parameters' do
|
||||
|
@ -71,7 +71,7 @@ describe JsLocaleHelper do
|
||||
}))
|
||||
|
||||
ctx.eval('I18n.translations')["en"]["js"]["hello"].should == "world"
|
||||
ctx.eval('I18n.translations')["en"]["js"]["test_MF"].should be_nil
|
||||
ctx.eval('I18n.translations')["en"]["js"]["test_MF"].should == nil
|
||||
|
||||
ctx.eval('I18n.messageFormat("test_MF", { HELLO: "hi", COUNT: 3 })').should == "hi 3 ducks"
|
||||
ctx.eval('I18n.messageFormat("error_MF", { HELLO: "hi", COUNT: 3 })').should =~ /Invalid Format/
|
||||
|
@ -13,15 +13,15 @@ describe Middleware::AnonymousCache::Helper do
|
||||
|
||||
context "cachable?" do
|
||||
it "true by default" do
|
||||
new_helper.cacheable?.should be_true
|
||||
new_helper.cacheable?.should == true
|
||||
end
|
||||
|
||||
it "is false for non GET" do
|
||||
new_helper("ANON_CACHE_DURATION" => 10, "REQUEST_METHOD" => "POST").cacheable?.should be_false
|
||||
new_helper("ANON_CACHE_DURATION" => 10, "REQUEST_METHOD" => "POST").cacheable?.should == false
|
||||
end
|
||||
|
||||
it "is false if it has an auth cookie" do
|
||||
new_helper("HTTP_COOKIE" => "jack=1; _t=#{"1"*32}; jill=2").cacheable?.should be_false
|
||||
new_helper("HTTP_COOKIE" => "jack=1; _t=#{"1"*32}; jill=2").cacheable?.should == false
|
||||
end
|
||||
end
|
||||
|
||||
@ -41,14 +41,14 @@ describe Middleware::AnonymousCache::Helper do
|
||||
|
||||
it "returns cached data for cached requests" do
|
||||
helper.is_mobile = true
|
||||
helper.cached.should be_nil
|
||||
helper.cached.should == nil
|
||||
helper.cache([200, {"HELLO" => "WORLD"}, ["hello ", "my world"]])
|
||||
|
||||
helper = new_helper("ANON_CACHE_DURATION" => 10)
|
||||
helper.is_mobile = true
|
||||
helper.cached.should == [200, {"HELLO" => "WORLD"}, ["hello my world"]]
|
||||
|
||||
crawler.cached.should be_nil
|
||||
crawler.cached.should == nil
|
||||
crawler.cache([200, {"HELLO" => "WORLD"}, ["hello ", "world"]])
|
||||
crawler.cached.should == [200, {"HELLO" => "WORLD"}, ["hello world"]]
|
||||
end
|
||||
|
@ -10,11 +10,11 @@ describe PinnedCheck do
|
||||
context "without a topic_user record (either anonymous or never been in the topic)" do
|
||||
|
||||
it "returns false if the topic is not pinned" do
|
||||
PinnedCheck.pinned?(unpinned_topic).should be_false
|
||||
PinnedCheck.pinned?(unpinned_topic).should == false
|
||||
end
|
||||
|
||||
it "returns true if the topic is pinned" do
|
||||
PinnedCheck.pinned?(unpinned_topic).should be_false
|
||||
PinnedCheck.pinned?(unpinned_topic).should == false
|
||||
end
|
||||
|
||||
end
|
||||
@ -27,7 +27,7 @@ describe PinnedCheck do
|
||||
let(:topic_user) { TopicUser.new(topic: unpinned_topic, user: user) }
|
||||
|
||||
it "returns false" do
|
||||
PinnedCheck.pinned?(unpinned_topic, topic_user).should be_false
|
||||
PinnedCheck.pinned?(unpinned_topic, topic_user).should == false
|
||||
end
|
||||
|
||||
end
|
||||
@ -36,17 +36,17 @@ describe PinnedCheck do
|
||||
let(:topic_user) { TopicUser.new(topic: pinned_topic, user: user) }
|
||||
|
||||
it "is pinned if the topic_user's cleared_pinned_at is blank" do
|
||||
PinnedCheck.pinned?(pinned_topic, topic_user).should be_true
|
||||
PinnedCheck.pinned?(pinned_topic, topic_user).should == true
|
||||
end
|
||||
|
||||
it "is not pinned if the topic_user's cleared_pinned_at is later than when it was pinned_at" do
|
||||
topic_user.cleared_pinned_at = (pinned_at + 1.hour)
|
||||
PinnedCheck.pinned?(pinned_topic, topic_user).should be_false
|
||||
PinnedCheck.pinned?(pinned_topic, topic_user).should == false
|
||||
end
|
||||
|
||||
it "is pinned if the topic_user's cleared_pinned_at is earlier than when it was pinned_at" do
|
||||
topic_user.cleared_pinned_at = (pinned_at - 3.hours)
|
||||
PinnedCheck.pinned?(pinned_topic, topic_user).should be_true
|
||||
PinnedCheck.pinned?(pinned_topic, topic_user).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -123,11 +123,11 @@ describe Plugin::Instance do
|
||||
# calls ensure_assets! make sure they are there
|
||||
plugin.assets.count.should == 1
|
||||
plugin.assets.each do |a, opts|
|
||||
File.exists?(a).should be_true
|
||||
File.exists?(a).should == true
|
||||
end
|
||||
|
||||
# ensure it cleans up all crap in autogenerated directory
|
||||
File.exists?(junk_file).should be_false
|
||||
File.exists?(junk_file).should == false
|
||||
end
|
||||
|
||||
it "finds all the custom assets" do
|
||||
|
@ -59,7 +59,7 @@ describe PostCreator do
|
||||
|
||||
it "doesn't return true for spam" do
|
||||
creator.create
|
||||
creator.spam?.should be_false
|
||||
creator.spam?.should == false
|
||||
end
|
||||
|
||||
it "does not notify on system messages" do
|
||||
@ -70,8 +70,8 @@ describe PostCreator do
|
||||
end
|
||||
# don't notify on system messages they introduce too much noise
|
||||
channels = messages.map(&:channel)
|
||||
channels.find{|s| s =~ /unread/}.should be_nil
|
||||
channels.find{|s| s =~ /new/}.should be_nil
|
||||
channels.find{|s| s =~ /unread/}.should == nil
|
||||
channels.find{|s| s =~ /new/}.should == nil
|
||||
end
|
||||
|
||||
it "generates the correct messages for a secure topic" do
|
||||
@ -104,7 +104,7 @@ describe PostCreator do
|
||||
].sort
|
||||
admin_ids = [Group[:admins].id]
|
||||
|
||||
messages.any?{|m| m.group_ids != admin_ids && m.user_ids != [admin.id]}.should be_false
|
||||
messages.any?{|m| m.group_ids != admin_ids && m.user_ids != [admin.id]}.should == false
|
||||
end
|
||||
|
||||
it 'generates the correct messages for a normal topic' do
|
||||
@ -115,16 +115,16 @@ describe PostCreator do
|
||||
end
|
||||
|
||||
latest = messages.find{|m| m.channel == "/latest"}
|
||||
latest.should_not be_nil
|
||||
latest.should_not == nil
|
||||
|
||||
latest = messages.find{|m| m.channel == "/new"}
|
||||
latest.should_not be_nil
|
||||
latest.should_not == nil
|
||||
|
||||
read = messages.find{|m| m.channel == "/unread/#{p.user_id}"}
|
||||
read.should_not be_nil
|
||||
read.should_not == nil
|
||||
|
||||
user_action = messages.find{|m| m.channel == "/users/#{p.user.username}"}
|
||||
user_action.should_not be_nil
|
||||
user_action.should_not == nil
|
||||
|
||||
messages.length.should == 5
|
||||
end
|
||||
@ -207,7 +207,7 @@ describe PostCreator do
|
||||
it 'ensures the user can auto-close the topic, but ignores auto-close param silently' do
|
||||
Guardian.any_instance.stubs(:can_moderate?).returns(false)
|
||||
post = PostCreator.new(user, basic_topic_params.merge(auto_close_time: 2)).create
|
||||
post.topic.auto_close_at.should be_nil
|
||||
post.topic.auto_close_at.should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -288,7 +288,7 @@ describe PostCreator do
|
||||
GroupMessage.stubs(:create)
|
||||
creator.create
|
||||
creator.errors.should be_present
|
||||
creator.spam?.should be_true
|
||||
creator.spam?.should == true
|
||||
end
|
||||
|
||||
it "sends a message to moderators" do
|
||||
@ -358,7 +358,7 @@ describe PostCreator do
|
||||
post.topic.topic_allowed_users.count.should == 3
|
||||
|
||||
# PMs can't have a category
|
||||
post.topic.category.should be_nil
|
||||
post.topic.category.should == nil
|
||||
|
||||
# does not notify an unrelated user
|
||||
unrelated.notifications.count.should == 0
|
||||
@ -469,7 +469,7 @@ describe PostCreator do
|
||||
it 'can save a post' do
|
||||
creator = PostCreator.new(user, raw: 'q', title: 'q', skip_validations: true)
|
||||
creator.create
|
||||
creator.errors.should be_nil
|
||||
creator.errors.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -494,7 +494,7 @@ describe PostCreator do
|
||||
title: 'Reviews of Science Ovens',
|
||||
raw: 'Did you know that you can use microwaves to cook your dinner? Science!')
|
||||
creator.create
|
||||
TopicEmbed.where(embed_url: embed_url).exists?.should be_true
|
||||
TopicEmbed.where(embed_url: embed_url).exists?.should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -106,7 +106,7 @@ describe PostDestroyer do
|
||||
|
||||
post2.deleted_at.should be_blank
|
||||
post2.deleted_by.should be_blank
|
||||
post2.user_deleted.should be_true
|
||||
post2.user_deleted.should == true
|
||||
post2.raw.should == I18n.t('js.post.deleted_by_author', {count: 24})
|
||||
post2.version.should == 2
|
||||
|
||||
@ -114,7 +114,7 @@ describe PostDestroyer do
|
||||
PostDestroyer.new(post2.user, post2).recover
|
||||
post2.reload
|
||||
post2.version.should == 3
|
||||
post2.user_deleted.should be_false
|
||||
post2.user_deleted.should == false
|
||||
post2.cooked.should == @orig
|
||||
end
|
||||
|
||||
@ -177,7 +177,7 @@ describe PostDestroyer do
|
||||
let(:topic_user) { second_user.topic_users.find_by(topic_id: topic.id) }
|
||||
|
||||
it 'clears the posted flag for the second user' do
|
||||
topic_user.posted?.should be_false
|
||||
topic_user.posted?.should == false
|
||||
end
|
||||
|
||||
it "sets the second user's last_read_post_number back to 1" do
|
||||
@ -314,8 +314,8 @@ describe PostDestroyer do
|
||||
|
||||
PostDestroyer.new(moderator, second_post).destroy
|
||||
|
||||
expect(UserAction.find_by(id: bookmark.id)).to be_nil
|
||||
expect(UserAction.find_by(id: like.id)).to be_nil
|
||||
expect(UserAction.find_by(id: bookmark.id)).should == nil
|
||||
expect(UserAction.find_by(id: like.id)).should == nil
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -16,7 +16,7 @@ describe PostRevisor do
|
||||
describe 'with the same body' do
|
||||
it "doesn't change version" do
|
||||
lambda {
|
||||
subject.revise!(post.user, post.raw).should be_false
|
||||
subject.revise!(post.user, post.raw).should == false
|
||||
post.reload
|
||||
}.should_not change(post, :version)
|
||||
end
|
||||
@ -110,7 +110,7 @@ describe PostRevisor do
|
||||
|
||||
let(:new_description) { "this is my new description." }
|
||||
|
||||
it "should have to description by default" do
|
||||
it "should have no description by default" do
|
||||
category.description.should be_blank
|
||||
end
|
||||
|
||||
@ -120,8 +120,8 @@ describe PostRevisor do
|
||||
category.reload
|
||||
end
|
||||
|
||||
it "returns true for category_changed" do
|
||||
subject.category_changed.should be_true
|
||||
it "returns the changed category info" do
|
||||
subject.category_changed.should == category
|
||||
end
|
||||
|
||||
it "updates the description of the category" do
|
||||
@ -155,7 +155,7 @@ describe PostRevisor do
|
||||
category.description.should be_blank
|
||||
end
|
||||
|
||||
it "returns true for category_changed" do
|
||||
it "returns the changed category info" do
|
||||
subject.category_changed.should == category
|
||||
end
|
||||
end
|
||||
@ -211,7 +211,7 @@ describe PostRevisor do
|
||||
let!(:result) { subject.revise!(changed_by, "lets update the body") }
|
||||
|
||||
it 'returns true' do
|
||||
result.should be_true
|
||||
result.should == true
|
||||
end
|
||||
|
||||
it 'updates the body' do
|
||||
|
@ -53,23 +53,23 @@ describe PrettyText do
|
||||
end
|
||||
|
||||
it "should not inject nofollow in all local links" do
|
||||
(PrettyText.cook("<a href='#{Discourse.base_url}/test.html'>cnn</a>") !~ /nofollow/).should be_true
|
||||
(PrettyText.cook("<a href='#{Discourse.base_url}/test.html'>cnn</a>") !~ /nofollow/).should == true
|
||||
end
|
||||
|
||||
it "should not inject nofollow in all subdomain links" do
|
||||
(PrettyText.cook("<a href='#{Discourse.base_url.sub('http://', 'http://bla.')}/test.html'>cnn</a>") !~ /nofollow/).should be_true
|
||||
(PrettyText.cook("<a href='#{Discourse.base_url.sub('http://', 'http://bla.')}/test.html'>cnn</a>") !~ /nofollow/).should == true
|
||||
end
|
||||
|
||||
it "should not inject nofollow for foo.com" do
|
||||
(PrettyText.cook("<a href='http://foo.com/test.html'>cnn</a>") !~ /nofollow/).should be_true
|
||||
(PrettyText.cook("<a href='http://foo.com/test.html'>cnn</a>") !~ /nofollow/).should == true
|
||||
end
|
||||
|
||||
it "should not inject nofollow for bar.foo.com" do
|
||||
(PrettyText.cook("<a href='http://bar.foo.com/test.html'>cnn</a>") !~ /nofollow/).should be_true
|
||||
(PrettyText.cook("<a href='http://bar.foo.com/test.html'>cnn</a>") !~ /nofollow/).should == true
|
||||
end
|
||||
|
||||
it "should not inject nofollow if omit_nofollow option is given" do
|
||||
(PrettyText.cook('<a href="http://cnn.com">cnn</a>', omit_nofollow: true) !~ /nofollow/).should be_true
|
||||
(PrettyText.cook('<a href="http://cnn.com">cnn</a>', omit_nofollow: true) !~ /nofollow/).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,7 +26,7 @@ describe Promotion do
|
||||
let!(:result) { promotion.review }
|
||||
|
||||
it "returns false" do
|
||||
result.should be_false
|
||||
result.should == false
|
||||
end
|
||||
|
||||
it "has not changed the user's trust level" do
|
||||
@ -45,7 +45,7 @@ describe Promotion do
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
@result.should be_true
|
||||
@result.should == true
|
||||
end
|
||||
|
||||
it "has upgraded the user to basic" do
|
||||
@ -64,7 +64,7 @@ describe Promotion do
|
||||
let!(:result) { promotion.review }
|
||||
|
||||
it "returns false" do
|
||||
result.should be_false
|
||||
result.should == false
|
||||
end
|
||||
|
||||
it "has not changed the user's trust level" do
|
||||
@ -88,7 +88,7 @@ describe Promotion do
|
||||
end
|
||||
|
||||
it "returns true" do
|
||||
@result.should be_true
|
||||
@result.should == true
|
||||
end
|
||||
|
||||
it "has upgraded the user to regular" do
|
||||
|
@ -14,7 +14,7 @@ describe RateLimiter do
|
||||
end
|
||||
|
||||
it "returns true for can_perform?" do
|
||||
rate_limiter.can_perform?.should be_true
|
||||
rate_limiter.can_perform?.should == true
|
||||
end
|
||||
|
||||
it "doesn't raise an error on performed!" do
|
||||
@ -31,7 +31,7 @@ describe RateLimiter do
|
||||
|
||||
context 'never done' do
|
||||
it "should perform right away" do
|
||||
rate_limiter.can_perform?.should be_true
|
||||
rate_limiter.can_perform?.should == true
|
||||
end
|
||||
|
||||
it "performs without an error" do
|
||||
@ -46,7 +46,7 @@ describe RateLimiter do
|
||||
end
|
||||
|
||||
it "returns false for can_perform when the limit has been hit" do
|
||||
rate_limiter.can_perform?.should be_false
|
||||
rate_limiter.can_perform?.should == false
|
||||
end
|
||||
|
||||
it "raises an error the third time called" do
|
||||
@ -57,7 +57,7 @@ describe RateLimiter do
|
||||
|
||||
it "returns true for can_perform if the user is an admin" do
|
||||
user.admin = true
|
||||
rate_limiter.can_perform?.should be_true
|
||||
rate_limiter.can_perform?.should == true
|
||||
end
|
||||
|
||||
it "doesn't raise an error when an admin performs the task" do
|
||||
@ -67,7 +67,7 @@ describe RateLimiter do
|
||||
|
||||
it "returns true for can_perform if the user is a mod" do
|
||||
user.moderator = true
|
||||
rate_limiter.can_perform?.should be_true
|
||||
rate_limiter.can_perform?.should == true
|
||||
end
|
||||
|
||||
it "doesn't raise an error when a moderator performs the task" do
|
||||
@ -84,7 +84,7 @@ describe RateLimiter do
|
||||
end
|
||||
|
||||
it "returns true for can_perform since there is now room" do
|
||||
rate_limiter.can_perform?.should be_true
|
||||
rate_limiter.can_perform?.should == true
|
||||
end
|
||||
|
||||
it "raises no error now that there is room" do
|
||||
|
@ -51,7 +51,7 @@ describe "Redis Store" do
|
||||
end
|
||||
|
||||
store.clear
|
||||
store.read("key").should be_nil
|
||||
store.read("key").should == nil
|
||||
cache.fetch("key").should == "key in cache"
|
||||
|
||||
end
|
||||
|
@ -32,25 +32,25 @@ describe Scheduler::ScheduleInfo do
|
||||
end
|
||||
|
||||
it 'starts off invalid' do
|
||||
@info.valid?.should be_false
|
||||
@info.valid?.should == false
|
||||
end
|
||||
|
||||
it 'will have a due date in the next 5 minutes if it was blank' do
|
||||
@info.schedule!
|
||||
@info.valid?.should be_true
|
||||
@info.valid?.should == true
|
||||
@info.next_run.should be_within(5.minutes).of(Time.now.to_i)
|
||||
end
|
||||
|
||||
it 'will have a due date within the next hour if it just ran' do
|
||||
@info.prev_run = Time.now.to_i
|
||||
@info.schedule!
|
||||
@info.valid?.should be_true
|
||||
@info.valid?.should == true
|
||||
@info.next_run.should be_within(1.hour * manager.random_ratio).of(Time.now.to_i + 1.hour)
|
||||
end
|
||||
|
||||
it 'is invalid if way in the future' do
|
||||
@info.next_run = Time.now.to_i + 1.year
|
||||
@info.valid?.should be_false
|
||||
@info.valid?.should == false
|
||||
end
|
||||
end
|
||||
|
||||
@ -79,19 +79,18 @@ describe Scheduler::ScheduleInfo do
|
||||
end
|
||||
|
||||
it "starts off invalid" do
|
||||
@info.valid?.should be_false
|
||||
@info.valid?.should == false
|
||||
end
|
||||
|
||||
it "will have a due date at the appropriate time if blank" do
|
||||
pending
|
||||
@info.next_run.should be_nil
|
||||
skip "will have a due date at the appropriate time if blank" do
|
||||
@info.next_run.should == nil
|
||||
@info.schedule!
|
||||
@info.valid?.should be_true
|
||||
@info.valid?.should == true
|
||||
end
|
||||
|
||||
it 'is invalid if way in the future' do
|
||||
@info.next_run = Time.now.to_i + 1.year
|
||||
@info.valid?.should be_false
|
||||
@info.valid?.should == false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -39,14 +39,14 @@ describe ScoreCalculator do
|
||||
it "won't update the site settings when the site settings don't match" do
|
||||
ScoreCalculator.new(reads: 3).calculate
|
||||
topic.reload
|
||||
topic.has_summary.should be_false
|
||||
topic.has_summary.should == false
|
||||
end
|
||||
|
||||
it "removes the summary flag if the topic no longer qualifies" do
|
||||
topic.update_column(:has_summary, true)
|
||||
ScoreCalculator.new(reads: 3).calculate
|
||||
topic.reload
|
||||
topic.has_summary.should be_false
|
||||
topic.has_summary.should == false
|
||||
end
|
||||
|
||||
it "won't update the site settings when the site settings don't match" do
|
||||
@ -56,7 +56,7 @@ describe ScoreCalculator do
|
||||
|
||||
ScoreCalculator.new(reads: 3).calculate
|
||||
topic.reload
|
||||
topic.has_summary.should be_true
|
||||
topic.has_summary.should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -45,7 +45,7 @@ describe SuggestedTopicsBuilder do
|
||||
end
|
||||
|
||||
it "has the correct defaults" do
|
||||
builder.excluded_topic_ids.include?(topic.id).should be_true
|
||||
builder.excluded_topic_ids.include?(topic.id).should == true
|
||||
builder.results_left.should == 5
|
||||
builder.size.should == 0
|
||||
builder.should_not be_full
|
||||
@ -77,8 +77,8 @@ describe SuggestedTopicsBuilder do
|
||||
builder.size.should == 1
|
||||
builder.results_left.should == 4
|
||||
builder.should_not be_full
|
||||
builder.excluded_topic_ids.include?(topic.id).should be_true
|
||||
builder.excluded_topic_ids.include?(other_topic.id).should be_true
|
||||
builder.excluded_topic_ids.include?(topic.id).should == true
|
||||
builder.excluded_topic_ids.include?(other_topic.id).should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -19,7 +19,7 @@ describe SystemMessage do
|
||||
topic.should be_private_message
|
||||
topic.should be_valid
|
||||
topic.subtype.should == TopicSubtype.system_message
|
||||
topic.allowed_users.include?(user).should be_true
|
||||
topic.allowed_users.include?(user).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ describe TopicCreator do
|
||||
it "ignores auto_close_time without raising an error" do
|
||||
topic = TopicCreator.create(user, Guardian.new(user), valid_attrs.merge(auto_close_time: '24'))
|
||||
topic.should be_valid
|
||||
topic.auto_close_at.should be_nil
|
||||
topic.auto_close_at.should == nil
|
||||
end
|
||||
|
||||
it "category name is case insensitive" do
|
||||
|
@ -151,10 +151,10 @@ describe TopicQuery do
|
||||
topics.map(&:id).should == [pinned_topic, future_topic, closed_topic, archived_topic, regular_topic].map(&:id)
|
||||
|
||||
# includes the invisible topic if you're a moderator
|
||||
TopicQuery.new(moderator).list_latest.topics.include?(invisible_topic).should be_true
|
||||
TopicQuery.new(moderator).list_latest.topics.include?(invisible_topic).should == true
|
||||
|
||||
# includes the invisible topic if you're an admin" do
|
||||
TopicQuery.new(admin).list_latest.topics.include?(invisible_topic).should be_true
|
||||
TopicQuery.new(admin).list_latest.topics.include?(invisible_topic).should == true
|
||||
end
|
||||
|
||||
context 'sort_order' do
|
||||
@ -351,7 +351,7 @@ describe TopicQuery do
|
||||
let!(:created_topic) { create_post(user: user).topic }
|
||||
|
||||
it "includes the created topic" do
|
||||
topics.include?(created_topic).should be_true
|
||||
topics.include?(created_topic).should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -360,7 +360,7 @@ describe TopicQuery do
|
||||
let!(:your_post) { create_post(user: user, topic: other_users_topic )}
|
||||
|
||||
it "includes the posted topic" do
|
||||
topics.include?(other_users_topic).should be_true
|
||||
topics.include?(other_users_topic).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -193,14 +193,14 @@ describe TopicView do
|
||||
context '.read?' do
|
||||
it 'tracks correctly' do
|
||||
# anon is assumed to have read everything
|
||||
TopicView.new(topic.id).read?(1).should be_true
|
||||
TopicView.new(topic.id).read?(1).should == true
|
||||
|
||||
# random user has nothing
|
||||
topic_view.read?(1).should be_false
|
||||
topic_view.read?(1).should == false
|
||||
|
||||
# a real user that just read it should have it marked
|
||||
PostTiming.process_timings(coding_horror, topic.id, 1, [[1,1000]])
|
||||
TopicView.new(topic.id, coding_horror).read?(1).should be_true
|
||||
TopicView.new(topic.id, coding_horror).read?(1).should == true
|
||||
TopicView.new(topic.id, coding_horror).topic_user.should be_present
|
||||
end
|
||||
end
|
||||
@ -225,8 +225,8 @@ describe TopicView do
|
||||
recent_posts.count.should == 25
|
||||
|
||||
# ordering
|
||||
recent_posts.include?(p1).should be_false
|
||||
recent_posts.include?(p3).should be_true
|
||||
recent_posts.include?(p1).should == false
|
||||
recent_posts.include?(p3).should == true
|
||||
recent_posts.first.created_at.should > recent_posts.last.created_at
|
||||
end
|
||||
end
|
||||
@ -259,13 +259,13 @@ describe TopicView do
|
||||
describe "contains_gaps?" do
|
||||
it "works" do
|
||||
# does not contain contains_gaps with default filtering
|
||||
topic_view.contains_gaps?.should be_false
|
||||
topic_view.contains_gaps?.should == false
|
||||
# contains contains_gaps when filtered by username" do
|
||||
TopicView.new(topic.id, coding_horror, username_filters: ['eviltrout']).contains_gaps?.should be_true
|
||||
TopicView.new(topic.id, coding_horror, username_filters: ['eviltrout']).contains_gaps?.should == true
|
||||
# contains contains_gaps when filtered by summary
|
||||
TopicView.new(topic.id, coding_horror, filter: 'summary').contains_gaps?.should be_true
|
||||
TopicView.new(topic.id, coding_horror, filter: 'summary').contains_gaps?.should == true
|
||||
# contains contains_gaps when filtered by best
|
||||
TopicView.new(topic.id, coding_horror, best: 5).contains_gaps?.should be_true
|
||||
TopicView.new(topic.id, coding_horror, best: 5).contains_gaps?.should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -309,21 +309,21 @@ describe TopicView do
|
||||
near_view = topic_view_near(p1)
|
||||
near_view.desired_post.should == p1
|
||||
near_view.posts.should == [p1, p2, p3]
|
||||
near_view.contains_gaps?.should be_false
|
||||
near_view.contains_gaps?.should == false
|
||||
end
|
||||
|
||||
it "snaps to the upper boundary" do
|
||||
near_view = topic_view_near(p5)
|
||||
near_view.desired_post.should == p5
|
||||
near_view.posts.should == [p2, p3, p5]
|
||||
near_view.contains_gaps?.should be_false
|
||||
near_view.contains_gaps?.should == false
|
||||
end
|
||||
|
||||
it "returns the posts in the middle" do
|
||||
near_view = topic_view_near(p2)
|
||||
near_view.desired_post.should == p2
|
||||
near_view.posts.should == [p1, p2, p3]
|
||||
near_view.contains_gaps?.should be_false
|
||||
near_view.contains_gaps?.should == false
|
||||
end
|
||||
|
||||
it "gaps deleted posts to an admin" do
|
||||
@ -340,7 +340,7 @@ describe TopicView do
|
||||
near_view = topic_view_near(p3, true)
|
||||
near_view.desired_post.should == p3
|
||||
near_view.posts.should == [p2, p3, p4]
|
||||
near_view.contains_gaps?.should be_false
|
||||
near_view.contains_gaps?.should == false
|
||||
end
|
||||
|
||||
it "gaps deleted posts by nuked users to an admin" do
|
||||
@ -358,7 +358,7 @@ describe TopicView do
|
||||
near_view = topic_view_near(p5, true)
|
||||
near_view.desired_post.should == p5
|
||||
near_view.posts.should == [p4, p5, p6]
|
||||
near_view.contains_gaps?.should be_false
|
||||
near_view.contains_gaps?.should == false
|
||||
end
|
||||
|
||||
context "when 'posts per page' exceeds the number of posts" do
|
||||
@ -367,7 +367,7 @@ describe TopicView do
|
||||
it 'returns all the posts' do
|
||||
near_view = topic_view_near(p5)
|
||||
near_view.posts.should == [p1, p2, p3, p5]
|
||||
near_view.contains_gaps?.should be_false
|
||||
near_view.contains_gaps?.should == false
|
||||
end
|
||||
|
||||
it 'gaps deleted posts to admins' do
|
||||
@ -382,7 +382,7 @@ describe TopicView do
|
||||
coding_horror.admin = true
|
||||
near_view = topic_view_near(p5, true)
|
||||
near_view.posts.should == [p1, p2, p3, p4, p5, p6, p7]
|
||||
near_view.contains_gaps?.should be_false
|
||||
near_view.contains_gaps?.should == false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -15,21 +15,21 @@ describe UrlHelper do
|
||||
store = stub
|
||||
store.expects(:has_been_uploaded?).returns(true)
|
||||
Discourse.stubs(:store).returns(store)
|
||||
helper.is_local("http://discuss.site.com/path/to/file.png").should be_true
|
||||
helper.is_local("http://discuss.site.com/path/to/file.png").should == true
|
||||
end
|
||||
|
||||
it "is true for relative assets" do
|
||||
store = stub
|
||||
store.expects(:has_been_uploaded?).returns(false)
|
||||
Discourse.stubs(:store).returns(store)
|
||||
helper.is_local("/assets/javascripts/all.js").should be_true
|
||||
helper.is_local("/assets/javascripts/all.js").should == true
|
||||
end
|
||||
|
||||
it "is true for plugin assets" do
|
||||
store = stub
|
||||
store.expects(:has_been_uploaded?).returns(false)
|
||||
Discourse.stubs(:store).returns(store)
|
||||
helper.is_local("/plugins/all.js").should be_true
|
||||
helper.is_local("/plugins/all.js").should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -15,7 +15,7 @@ describe UserNameSuggester do
|
||||
end
|
||||
|
||||
it "doesn't raise an error on nil username" do
|
||||
UserNameSuggester.suggest(nil).should be_nil
|
||||
UserNameSuggester.suggest(nil).should == nil
|
||||
end
|
||||
|
||||
it 'corrects weird characters' do
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::ApiController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::ApiController < Admin::AdminController).should be_true
|
||||
(Admin::ApiController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let!(:user) { log_in(:admin) }
|
||||
|
@ -3,7 +3,7 @@ require "spec_helper"
|
||||
describe Admin::BackupsController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::BackupsController < Admin::AdminController).should be_true
|
||||
(Admin::BackupsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let(:backup_filename) { "2014-02-10-065935.tar.gz" }
|
||||
@ -81,7 +81,7 @@ describe Admin::BackupsController do
|
||||
# response.should be_success
|
||||
|
||||
# json = JSON.parse(response.body)
|
||||
# json["message"].should_not be_nil
|
||||
# json["message"].should_not == nil
|
||||
# end
|
||||
|
||||
end
|
||||
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe Admin::ColorSchemesController do
|
||||
it "is a subclass of AdminController" do
|
||||
(described_class < Admin::AdminController).should be_true
|
||||
(described_class < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context "while logged in as an admin" do
|
||||
|
@ -8,7 +8,7 @@ describe Admin::DashboardController do
|
||||
end
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::DashboardController < Admin::AdminController).should be_true
|
||||
(Admin::DashboardController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::EmailController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::EmailController < Admin::AdminController).should be_true
|
||||
(Admin::EmailController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let!(:user) { log_in(:admin) }
|
||||
|
@ -3,7 +3,7 @@ require "spec_helper"
|
||||
describe Admin::ExportCsvController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::ExportCsvController < Admin::AdminController).should be_true
|
||||
(Admin::ExportCsvController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let(:export_filename) { "export_b6a2bc87.csv" }
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::FlagsController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::FlagsController < Admin::AdminController).should be_true
|
||||
(Admin::FlagsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -7,7 +7,7 @@ describe Admin::GroupsController do
|
||||
end
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::GroupsController < Admin::AdminController).should be_true
|
||||
(Admin::GroupsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
it "produces valid json for groups" do
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::ImpersonateController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::ImpersonateController < Admin::AdminController).should be_true
|
||||
(Admin::ImpersonateController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::ReportsController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::ReportsController < Admin::AdminController).should be_true
|
||||
(Admin::ReportsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe Admin::ScreenedEmailsController do
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::ScreenedEmailsController < Admin::AdminController).should be_true
|
||||
(Admin::ScreenedEmailsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let!(:user) { log_in(:admin) }
|
||||
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe Admin::ScreenedIpAddressesController do
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::ScreenedIpAddressesController < Admin::AdminController).should be_true
|
||||
(Admin::ScreenedIpAddressesController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let!(:user) { log_in(:admin) }
|
||||
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe Admin::ScreenedUrlsController do
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::ScreenedUrlsController < Admin::AdminController).should be_true
|
||||
(Admin::ScreenedUrlsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let!(:user) { log_in(:admin) }
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::SiteCustomizationsController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::UsersController < Admin::AdminController).should be_true
|
||||
(Admin::UsersController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::SiteSettingsController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::SiteSettingsController < Admin::AdminController).should be_true
|
||||
(Admin::SiteSettingsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::SiteTextController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::SiteTextController < Admin::AdminController).should be_true
|
||||
(Admin::SiteTextController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::SiteTextTypesController do
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::SiteTextTypesController < Admin::AdminController).should be_true
|
||||
(Admin::SiteTextTypesController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe Admin::StaffActionLogsController do
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::StaffActionLogsController < Admin::AdminController).should be_true
|
||||
(Admin::StaffActionLogsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
let!(:user) { log_in(:admin) }
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe Admin::UsersController do
|
||||
|
||||
it 'is a subclass of AdminController' do
|
||||
(Admin::UsersController < Admin::AdminController).should be_true
|
||||
(Admin::UsersController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
@ -214,7 +214,7 @@ describe Admin::UsersController do
|
||||
it 'updates the moderator flag' do
|
||||
xhr :put, :revoke_moderation, user_id: @moderator.id
|
||||
@moderator.reload
|
||||
@moderator.moderator.should_not be_true
|
||||
@moderator.moderator.should_not == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -237,7 +237,7 @@ describe Admin::UsersController do
|
||||
it 'updates the moderator flag' do
|
||||
xhr :put, :grant_moderation, user_id: @another_user.id
|
||||
@another_user.reload
|
||||
@another_user.moderator.should be_true
|
||||
@another_user.moderator.should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -11,7 +11,7 @@ describe Admin::VersionsController do
|
||||
end
|
||||
|
||||
it "is a subclass of AdminController" do
|
||||
(Admin::VersionsController < Admin::AdminController).should be_true
|
||||
(Admin::VersionsController < Admin::AdminController).should == true
|
||||
end
|
||||
|
||||
context 'while logged in as an admin' do
|
||||
|
@ -16,7 +16,7 @@ describe DraftController do
|
||||
user = log_in
|
||||
Draft.set(user, 'xxx', 0, 'hi')
|
||||
delete :destroy, draft_key: 'xxx', sequence: 0
|
||||
Draft.get(user, 'xxx', 0).should be_nil
|
||||
Draft.get(user, 'xxx', 0).should == nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -30,7 +30,7 @@ describe EmailController do
|
||||
end
|
||||
|
||||
it 'subscribes the user' do
|
||||
user.email_digests.should be_true
|
||||
user.email_digests.should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -47,7 +47,7 @@ describe EmailController do
|
||||
end
|
||||
|
||||
it 'unsubscribes the user' do
|
||||
user.email_digests.should be_false
|
||||
user.email_digests.should == false
|
||||
end
|
||||
|
||||
it "sets the appropriate instance variables" do
|
||||
@ -74,7 +74,7 @@ describe EmailController do
|
||||
end
|
||||
|
||||
it 'does not unsubscribe the user' do
|
||||
user.email_digests.should be_true
|
||||
user.email_digests.should == true
|
||||
end
|
||||
|
||||
it 'sets the appropriate instance variables' do
|
||||
@ -92,7 +92,7 @@ describe EmailController do
|
||||
end
|
||||
|
||||
it 'unsubscribes the user' do
|
||||
user.email_digests.should be_false
|
||||
user.email_digests.should == false
|
||||
end
|
||||
|
||||
it 'sets the appropriate instance variables' do
|
||||
@ -102,7 +102,7 @@ describe EmailController do
|
||||
|
||||
it "sets not_found when the key didn't match anything" do
|
||||
get :unsubscribe, key: 'asdfasdf'
|
||||
assigns(:not_found).should be_true
|
||||
assigns(:not_found).should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -94,7 +94,7 @@ describe PostActionsController do
|
||||
|
||||
it 'deletes the action' do
|
||||
xhr :delete, :destroy, id: post.id, post_action_type_id: 1
|
||||
PostAction.exists?(user_id: user.id, post_id: post.id, post_action_type_id: 1, deleted_at: nil).should be_false
|
||||
PostAction.exists?(user_id: user.id, post_id: post.id, post_action_type_id: 1, deleted_at: nil).should == false
|
||||
end
|
||||
|
||||
it 'ensures it can be deleted' do
|
||||
|
@ -341,7 +341,7 @@ describe PostsController do
|
||||
xhr :put, :wiki, post_id: post.id, wiki: 'true'
|
||||
|
||||
post.reload
|
||||
post.wiki.should be_true
|
||||
post.wiki.should == true
|
||||
end
|
||||
|
||||
it "can unwiki a post" do
|
||||
@ -351,7 +351,7 @@ describe PostsController do
|
||||
xhr :put, :wiki, post_id: wikied_post.id, wiki: 'false'
|
||||
|
||||
wikied_post.reload
|
||||
wikied_post.wiki.should be_false
|
||||
wikied_post.wiki.should == false
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ describe TopicsController do
|
||||
it "returns success" do
|
||||
response.should be_success
|
||||
result = ::JSON.parse(response.body)
|
||||
result['success'].should be_true
|
||||
result['success'].should == true
|
||||
result['url'].should be_present
|
||||
end
|
||||
end
|
||||
@ -85,7 +85,7 @@ describe TopicsController do
|
||||
it "returns JSON with a false success" do
|
||||
response.should be_success
|
||||
result = ::JSON.parse(response.body)
|
||||
result['success'].should be_false
|
||||
result['success'].should == false
|
||||
result['url'].should be_blank
|
||||
end
|
||||
end
|
||||
@ -129,7 +129,7 @@ describe TopicsController do
|
||||
it "returns success" do
|
||||
response.should be_success
|
||||
result = ::JSON.parse(response.body)
|
||||
result['success'].should be_true
|
||||
result['success'].should == true
|
||||
result['url'].should be_present
|
||||
end
|
||||
end
|
||||
@ -145,7 +145,7 @@ describe TopicsController do
|
||||
it "returns JSON with a false success" do
|
||||
response.should be_success
|
||||
result = ::JSON.parse(response.body)
|
||||
result['success'].should be_false
|
||||
result['success'].should == false
|
||||
result['url'].should be_blank
|
||||
end
|
||||
end
|
||||
@ -185,7 +185,7 @@ describe TopicsController do
|
||||
it "returns success" do
|
||||
response.should be_success
|
||||
result = ::JSON.parse(response.body)
|
||||
result['success'].should be_true
|
||||
result['success'].should == true
|
||||
result['url'].should be_present
|
||||
end
|
||||
end
|
||||
|
@ -19,7 +19,7 @@ describe UserActionsController do
|
||||
actions.length.should == 1
|
||||
action = actions[0]
|
||||
action["acting_name"].should == post.user.name
|
||||
action["email"].should be_nil
|
||||
action["email"].should == nil
|
||||
action["post_number"].should == 1
|
||||
end
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ describe UserBadgesController do
|
||||
xhr :get, :index, badge_id: badge.id
|
||||
response.status.should == 200
|
||||
parsed = JSON.parse(response.body)
|
||||
parsed["topics"].should be_nil
|
||||
parsed["topics"].should == nil
|
||||
parsed["user_badges"][0]["post_id"].should == nil
|
||||
end
|
||||
end
|
||||
@ -46,7 +46,7 @@ describe UserBadgesController do
|
||||
|
||||
response.status.should == 200
|
||||
parsed = JSON.parse(response.body)
|
||||
parsed["user_badges"].first.has_key?('count').should be_true
|
||||
parsed["user_badges"].first.has_key?('count').should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -102,7 +102,7 @@ describe UserBadgesController do
|
||||
StaffActionLogger.any_instance.expects(:log_badge_revoke).once
|
||||
xhr :delete, :destroy, id: user_badge.id
|
||||
response.status.should == 200
|
||||
UserBadge.find_by(id: user_badge.id).should be_nil
|
||||
UserBadge.find_by(id: user_badge.id).should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -251,7 +251,7 @@ describe UsersController do
|
||||
it 'disallows login' do
|
||||
flash[:error].should be_present
|
||||
session[:current_user_id].should be_blank
|
||||
assigns[:invalid_token].should be_nil
|
||||
assigns[:invalid_token].should == nil
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
@ -264,7 +264,7 @@ describe UsersController do
|
||||
it 'disallows login' do
|
||||
flash[:error].should be_present
|
||||
session[:current_user_id].should be_blank
|
||||
assigns[:invalid_token].should be_true
|
||||
assigns[:invalid_token].should == true
|
||||
response.should be_success
|
||||
end
|
||||
end
|
||||
@ -345,7 +345,7 @@ describe UsersController do
|
||||
SiteSetting.stubs(:allow_new_registrations).returns(false)
|
||||
post_user
|
||||
json = JSON.parse(response.body)
|
||||
json['success'].should be_false
|
||||
json['success'].should == false
|
||||
json['message'].should be_present
|
||||
end
|
||||
|
||||
@ -355,7 +355,7 @@ describe UsersController do
|
||||
|
||||
post_user
|
||||
|
||||
expect(JSON.parse(response.body)['active']).to be_false
|
||||
expect(JSON.parse(response.body)['active']).to be_falsey
|
||||
end
|
||||
|
||||
context "and 'must approve users' site setting is enabled" do
|
||||
@ -373,14 +373,12 @@ describe UsersController do
|
||||
|
||||
it 'indicates the user is not active in the response' do
|
||||
post_user
|
||||
expect(JSON.parse(response.body)['active']).to be_false
|
||||
expect(JSON.parse(response.body)['active']).to be_falsey
|
||||
end
|
||||
|
||||
it "shows the 'waiting approval' message" do
|
||||
post_user
|
||||
expect(JSON.parse(response.body)['message']).to eq(
|
||||
I18n.t 'login.wait_approval'
|
||||
)
|
||||
expect(JSON.parse(response.body)['message']).to eq(I18n.t 'login.wait_approval')
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -410,14 +408,14 @@ describe UsersController do
|
||||
it 'indicates the user is active in the response' do
|
||||
User.any_instance.expects(:enqueue_welcome_message)
|
||||
post_user
|
||||
expect(JSON.parse(response.body)['active']).to be_true
|
||||
expect(JSON.parse(response.body)['active']).to be_truthy
|
||||
end
|
||||
|
||||
it 'returns 500 status when new registrations are disabled' do
|
||||
SiteSetting.stubs(:allow_new_registrations).returns(false)
|
||||
post_user
|
||||
json = JSON.parse(response.body)
|
||||
json['success'].should be_false
|
||||
json['success'].should == false
|
||||
json['message'].should be_present
|
||||
end
|
||||
|
||||
@ -449,11 +447,11 @@ describe UsersController do
|
||||
|
||||
it 'has the proper JSON' do
|
||||
json = JSON::parse(response.body)
|
||||
json["success"].should be_true
|
||||
json["success"].should == true
|
||||
end
|
||||
|
||||
it 'should not result in an active account' do
|
||||
User.find_by(username: @user.username).active.should be_false
|
||||
User.find_by(username: @user.username).active.should == false
|
||||
end
|
||||
end
|
||||
|
||||
@ -472,7 +470,7 @@ describe UsersController do
|
||||
it 'should say it was successful' do
|
||||
xhr :post, :create, create_params
|
||||
json = JSON::parse(response.body)
|
||||
json["success"].should be_true
|
||||
json["success"].should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -513,7 +511,7 @@ describe UsersController do
|
||||
it 'should report failed' do
|
||||
xhr :post, :create, create_params
|
||||
json = JSON::parse(response.body)
|
||||
json["success"].should_not be_true
|
||||
json["success"].should_not == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -593,7 +591,7 @@ describe UsersController do
|
||||
end
|
||||
|
||||
it 'should return available as false in the JSON' do
|
||||
::JSON.parse(response.body)['available'].should be_false
|
||||
::JSON.parse(response.body)['available'].should == false
|
||||
end
|
||||
|
||||
it 'should return a suggested username' do
|
||||
@ -607,7 +605,7 @@ describe UsersController do
|
||||
end
|
||||
|
||||
it 'should return available in the JSON' do
|
||||
::JSON.parse(response.body)['available'].should be_true
|
||||
::JSON.parse(response.body)['available'].should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -637,7 +635,7 @@ describe UsersController do
|
||||
end
|
||||
|
||||
it 'should not return an available key' do
|
||||
::JSON.parse(response.body)['available'].should be_nil
|
||||
::JSON.parse(response.body)['available'].should == nil
|
||||
end
|
||||
|
||||
it 'should return an error message' do
|
||||
|
@ -19,38 +19,38 @@ describe ApplicationHelper do
|
||||
|
||||
it "is true if mobile_view is '1' in the session" do
|
||||
session[:mobile_view] = '1'
|
||||
helper.mobile_view?.should be_true
|
||||
helper.mobile_view?.should == true
|
||||
end
|
||||
|
||||
it "is false if mobile_view is '0' in the session" do
|
||||
session[:mobile_view] = '0'
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should == false
|
||||
end
|
||||
|
||||
context "mobile_view is not set" do
|
||||
it "is false if user agent is not mobile" do
|
||||
controller.request.stubs(:user_agent).returns('Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36')
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should be_falsey
|
||||
end
|
||||
|
||||
it "is true for iPhone" do
|
||||
controller.request.stubs(:user_agent).returns('Mozilla/5.0 (iPhone; U; ru; CPU iPhone OS 4_2_1 like Mac OS X; ru) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148a Safari/6533.18.5')
|
||||
helper.mobile_view?.should be_true
|
||||
helper.mobile_view?.should == true
|
||||
end
|
||||
|
||||
it "is false for iPad" do
|
||||
controller.request.stubs(:user_agent).returns("Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B176 Safari/7534.48.3")
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should == false
|
||||
end
|
||||
|
||||
it "is false for Nexus 10 tablet" do
|
||||
controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.2.1; Nexus 10 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should be_falsey
|
||||
end
|
||||
|
||||
it "is true for Nexus 7 tablet" do
|
||||
controller.request.stubs(:user_agent).returns("Mozilla/5.0 (Linux; Android 4.1.2; Nexus 7 Build/JZ054K) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19")
|
||||
helper.mobile_view?.should be_true
|
||||
helper.mobile_view?.should == true
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -62,23 +62,23 @@ describe ApplicationHelper do
|
||||
|
||||
it "is false if mobile_view is '1' in the session" do
|
||||
session[:mobile_view] = '1'
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should == false
|
||||
end
|
||||
|
||||
it "is false if mobile_view is '0' in the session" do
|
||||
session[:mobile_view] = '0'
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should == false
|
||||
end
|
||||
|
||||
context "mobile_view is not set" do
|
||||
it "is false if user agent is not mobile" do
|
||||
controller.request.stubs(:user_agent).returns('Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36')
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should == false
|
||||
end
|
||||
|
||||
it "is false for iPhone" do
|
||||
controller.request.stubs(:user_agent).returns('Mozilla/5.0 (iPhone; U; ru; CPU iPhone OS 4_2_1 like Mac OS X; ru) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148a Safari/6533.18.5')
|
||||
helper.mobile_view?.should be_false
|
||||
helper.mobile_view?.should == false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ describe SpamRulesEnforcer do
|
||||
|
||||
When { PostAction.act(user2, spam_post, PostActionType.types[:spam]) }
|
||||
|
||||
Invariant { expect(Guardian.new(spammer).can_create_topic?(nil)).to be_false }
|
||||
Invariant { expect(Guardian.new(spammer).can_create_topic?(nil)).should == false }
|
||||
Invariant { expect{PostCreator.create(spammer, {title: 'limited time offer for you', raw: 'better buy this stuff ok', archetype_id: 1})}.to raise_error(Discourse::InvalidAccess) }
|
||||
Invariant { expect{PostCreator.create(spammer, {topic_id: another_topic.id, raw: 'my reply is spam in your topic', archetype_id: 1})}.to raise_error(Discourse::InvalidAccess) }
|
||||
|
||||
@ -73,7 +73,7 @@ describe SpamRulesEnforcer do
|
||||
Given { SiteSetting.stubs(:flags_required_to_hide_post).returns(2) }
|
||||
When { PostAction.act(user2, spam_post, PostActionType.types[:spam]) }
|
||||
Then { expect(spammer.reload).to be_blocked }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).to be_false }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).should == false }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -87,7 +87,7 @@ describe SpamRulesEnforcer do
|
||||
When { PostAction.act(user1, spam_post, PostActionType.types[:spam]) }
|
||||
When { PostAction.act(user2, spam_post, PostActionType.types[:spam]) }
|
||||
Then { expect(spam_post.reload).to_not be_hidden }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).to be_true }
|
||||
And { expect(Guardian.new(spammer).can_create_topic?(nil)).should == true }
|
||||
And { expect{PostCreator.create(spammer, {title: 'limited time offer for you', raw: 'better buy this stuff ok', archetype_id: 1})}.to_not raise_error }
|
||||
And { expect(spammer.reload.private_topics_count).to eq(private_messages_count) }
|
||||
end
|
||||
|
@ -29,13 +29,13 @@ describe Topic do
|
||||
|
||||
context 'uncategorized' do
|
||||
Given(:category) { nil }
|
||||
Then { topic.auto_close_at.should be_nil }
|
||||
Then { topic.auto_close_at.should == nil }
|
||||
And { scheduled_jobs_for(:close_topic).should be_empty }
|
||||
end
|
||||
|
||||
context 'category without default auto-close' do
|
||||
Given(:category) { Fabricate(:category, auto_close_hours: nil) }
|
||||
Then { topic.auto_close_at.should be_nil }
|
||||
Then { topic.auto_close_at.should == nil }
|
||||
And { scheduled_jobs_for(:close_topic).should be_empty }
|
||||
end
|
||||
|
||||
@ -63,8 +63,8 @@ describe Topic do
|
||||
|
||||
context 'topic is closed manually' do
|
||||
When { staff_topic.update_status('closed', true, admin) }
|
||||
Then { staff_topic.reload.auto_close_at.should be_nil }
|
||||
And { staff_topic.auto_close_started_at.should be_nil }
|
||||
Then { staff_topic.reload.auto_close_at.should == nil }
|
||||
And { staff_topic.auto_close_started_at.should == nil }
|
||||
end
|
||||
end
|
||||
|
||||
@ -92,8 +92,8 @@ describe Topic do
|
||||
Given(:admin) { Fabricate(:admin) }
|
||||
Given!(:auto_closed_topic) { Fabricate(:topic, user: admin, closed: true, auto_close_at: 1.day.ago, auto_close_user_id: admin.id, auto_close_started_at: 6.days.ago) }
|
||||
When { auto_closed_topic.update_status('closed', false, admin) }
|
||||
Then { auto_closed_topic.reload.auto_close_at.should be_nil }
|
||||
And { auto_closed_topic.auto_close_started_at.should be_nil }
|
||||
Then { auto_closed_topic.reload.auto_close_at.should == nil }
|
||||
And { auto_closed_topic.auto_close_started_at.should == nil }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ describe Jobs::BulkInvite do
|
||||
it 'reads csv file' do
|
||||
bulk_invite.current_user = user
|
||||
bulk_invite.read_csv_file(csv_file)
|
||||
Invite.where(email: "robin@outlook.com").exists?.should be_true
|
||||
Invite.where(email: "robin@outlook.com").exists?.should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ describe Jobs::BulkInvite do
|
||||
|
||||
bulk_invite.current_user = user
|
||||
bulk_invite.send_invite(csv_info, 1)
|
||||
Invite.where(email: email).exists?.should be_true
|
||||
Invite.where(email: email).exists?.should == true
|
||||
end
|
||||
|
||||
it 'creates an invite with group' do
|
||||
@ -52,7 +52,7 @@ describe Jobs::BulkInvite do
|
||||
bulk_invite.send_invite(csv_info, 1)
|
||||
invite = Invite.where(email: email).first
|
||||
invite.should be_present
|
||||
InvitedGroup.where(invite_id: invite.id, group_id: group.id).exists?.should be_true
|
||||
InvitedGroup.where(invite_id: invite.id, group_id: group.id).exists?.should == true
|
||||
end
|
||||
|
||||
it 'creates an invite with topic' do
|
||||
@ -63,7 +63,7 @@ describe Jobs::BulkInvite do
|
||||
bulk_invite.send_invite(csv_info, 1)
|
||||
invite = Invite.where(email: email).first
|
||||
invite.should be_present
|
||||
TopicInvite.where(invite_id: invite.id, topic_id: topic.id).exists?.should be_true
|
||||
TopicInvite.where(invite_id: invite.id, topic_id: topic.id).exists?.should == true
|
||||
end
|
||||
|
||||
it 'creates an invite with group and topic' do
|
||||
@ -75,8 +75,8 @@ describe Jobs::BulkInvite do
|
||||
bulk_invite.send_invite(csv_info, 1)
|
||||
invite = Invite.where(email: email).first
|
||||
invite.should be_present
|
||||
InvitedGroup.where(invite_id: invite.id, group_id: group.id).exists?.should be_true
|
||||
TopicInvite.where(invite_id: invite.id, topic_id: topic.id).exists?.should be_true
|
||||
InvitedGroup.where(invite_id: invite.id, group_id: group.id).exists?.should == true
|
||||
TopicInvite.where(invite_id: invite.id, topic_id: topic.id).exists?.should == true
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ describe Jobs::EnqueueDigestEmails do
|
||||
let!(:user_no_digests) { Fabricate(:active_user, email_digests: false, last_emailed_at: 8.days.ago, last_seen_at: 10.days.ago) }
|
||||
|
||||
it "doesn't return users with email disabled" do
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user_no_digests.id).should be_false
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user_no_digests.id).should == false
|
||||
end
|
||||
end
|
||||
|
||||
@ -36,7 +36,7 @@ describe Jobs::EnqueueDigestEmails do
|
||||
let!(:user_emailed_recently) { Fabricate(:active_user, last_emailed_at: 6.days.ago) }
|
||||
|
||||
it "doesn't return users who have been emailed recently" do
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user_emailed_recently.id).should be_false
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user_emailed_recently.id).should == false
|
||||
end
|
||||
|
||||
end
|
||||
@ -45,7 +45,7 @@ describe Jobs::EnqueueDigestEmails do
|
||||
let!(:inactive_user) { Fabricate(:user, active: false) }
|
||||
|
||||
it "doesn't return users who have been emailed recently" do
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(inactive_user.id).should be_false
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(inactive_user.id).should == false
|
||||
end
|
||||
end
|
||||
|
||||
@ -55,12 +55,12 @@ describe Jobs::EnqueueDigestEmails do
|
||||
|
||||
it "doesn't return users who have been emailed recently" do
|
||||
user = user_visited_this_week
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user.id).should be_false
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user.id).should == false
|
||||
end
|
||||
|
||||
it "does return users who have been emailed recently but have email_always set" do
|
||||
user = user_visited_this_week_email_always
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user.id).should be_true
|
||||
Jobs::EnqueueDigestEmails.new.target_user_ids.include?(user.id).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -22,22 +22,22 @@ describe Jobs::FeatureTopicUsers do
|
||||
|
||||
it "won't feature the OP" do
|
||||
Jobs::FeatureTopicUsers.new.execute(topic_id: topic.id)
|
||||
topic.reload.featured_user_ids.include?(topic.user_id).should be_false
|
||||
topic.reload.featured_user_ids.include?(topic.user_id).should == false
|
||||
end
|
||||
|
||||
it "features the second poster" do
|
||||
Jobs::FeatureTopicUsers.new.execute(topic_id: topic.id)
|
||||
topic.reload.featured_user_ids.include?(coding_horror.id).should be_true
|
||||
topic.reload.featured_user_ids.include?(coding_horror.id).should == true
|
||||
end
|
||||
|
||||
it "will not feature the second poster if we supply their post to be ignored" do
|
||||
Jobs::FeatureTopicUsers.new.execute(topic_id: topic.id, except_post_id: second_post.id)
|
||||
topic.reload.featured_user_ids.include?(coding_horror.id).should be_false
|
||||
topic.reload.featured_user_ids.include?(coding_horror.id).should == false
|
||||
end
|
||||
|
||||
it "won't feature the last poster" do
|
||||
Jobs::FeatureTopicUsers.new.execute(topic_id: topic.id)
|
||||
topic.reload.featured_user_ids.include?(evil_trout.id).should be_false
|
||||
topic.reload.featured_user_ids.include?(evil_trout.id).should == false
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -84,14 +84,14 @@ describe Jobs do
|
||||
job_to_keep2 = stub_everything(klass: 'Sidekiq::Extensions::DelayedClass', args: [YAML.dump(['Jobs::DrinkBeer', :delayed_perform, [{beer_id: 44}]])])
|
||||
job_to_keep2.expects(:delete).never
|
||||
Sidekiq::ScheduledSet.stubs(:new).returns( [job_to_keep1, job_to_delete, job_to_keep2] )
|
||||
Jobs.cancel_scheduled_job(:drink_beer, {beer_id: 42}).should be_true
|
||||
Jobs.cancel_scheduled_job(:drink_beer, {beer_id: 42}).should == true
|
||||
end
|
||||
|
||||
it 'returns false when no matching job is scheduled' do
|
||||
job_to_keep = stub_everything(klass: 'Sidekiq::Extensions::DelayedClass', args: [YAML.dump(['Jobs::DrinkBeer', :delayed_perform, [{beer_id: 43}]])])
|
||||
job_to_keep.expects(:delete).never
|
||||
Sidekiq::ScheduledSet.stubs(:new).returns( [job_to_keep] )
|
||||
Jobs.cancel_scheduled_job(:drink_beer, {beer_id: 42}).should be_false
|
||||
Jobs.cancel_scheduled_job(:drink_beer, {beer_id: 42}).should == false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,13 +3,16 @@ require "spec_helper"
|
||||
describe TestMailer do
|
||||
|
||||
describe "send_test" do
|
||||
subject { TestMailer.send_test('marcheline@adventuretime.ooo') }
|
||||
|
||||
its(:to) { should == ['marcheline@adventuretime.ooo'] }
|
||||
its(:subject) { should be_present }
|
||||
its(:body) { should be_present }
|
||||
its(:from) { should == [SiteSetting.notification_email] }
|
||||
it "works" do
|
||||
test_mailer = TestMailer.send_test('marcheline@adventuretime.ooo')
|
||||
|
||||
test_mailer.from.should == [SiteSetting.notification_email]
|
||||
test_mailer.to.should == ['marcheline@adventuretime.ooo']
|
||||
test_mailer.subject.should be_present
|
||||
test_mailer.body.should be_present
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -7,17 +7,17 @@ describe AdminDashboardData do
|
||||
|
||||
it 'returns nil when running in production mode' do
|
||||
Rails.stubs(env: ActiveSupport::StringInquirer.new('production'))
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns a string when running in development mode' do
|
||||
Rails.stubs(env: ActiveSupport::StringInquirer.new('development'))
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
|
||||
it 'returns a string when running in test mode' do
|
||||
Rails.stubs(env: ActiveSupport::StringInquirer.new('test'))
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -26,17 +26,17 @@ describe AdminDashboardData do
|
||||
|
||||
it 'returns nil when host_names is set' do
|
||||
Discourse.stubs(:current_hostname).returns('something.com')
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns a string when host_name is localhost' do
|
||||
Discourse.stubs(:current_hostname).returns('localhost')
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
|
||||
it 'returns a string when host_name is production.localhost' do
|
||||
Discourse.stubs(:current_hostname).returns('production.localhost')
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -45,12 +45,12 @@ describe AdminDashboardData do
|
||||
|
||||
it 'returns nil when gc params are set' do
|
||||
ENV.stubs(:[]).with('RUBY_GC_MALLOC_LIMIT').returns(90000000)
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns a string when gc params are not set' do
|
||||
ENV.stubs(:[]).with('RUBY_GC_MALLOC_LIMIT').returns(nil)
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -60,31 +60,31 @@ describe AdminDashboardData do
|
||||
it 'returns nil when sidekiq processed a job recently' do
|
||||
Jobs.stubs(:last_job_performed_at).returns(1.minute.ago)
|
||||
Jobs.stubs(:queued).returns(0)
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns nil when last job processed was a long time ago, but no jobs are queued' do
|
||||
Jobs.stubs(:last_job_performed_at).returns(7.days.ago)
|
||||
Jobs.stubs(:queued).returns(0)
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns nil when no jobs have ever been processed, but no jobs are queued' do
|
||||
Jobs.stubs(:last_job_performed_at).returns(nil)
|
||||
Jobs.stubs(:queued).returns(0)
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns a string when no jobs were processed recently and some jobs are queued' do
|
||||
Jobs.stubs(:last_job_performed_at).returns(20.minutes.ago)
|
||||
Jobs.stubs(:queued).returns(1)
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
|
||||
it 'returns a string when no jobs have ever been processed, and some jobs are queued' do
|
||||
Jobs.stubs(:last_job_performed_at).returns(nil)
|
||||
Jobs.stubs(:queued).returns(1)
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -93,17 +93,17 @@ describe AdminDashboardData do
|
||||
|
||||
it 'returns nil when total ram is 1 GB' do
|
||||
MemInfo.any_instance.stubs(:mem_total).returns(1025272)
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns nil when total ram cannot be determined' do
|
||||
MemInfo.any_instance.stubs(:mem_total).returns(nil)
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns a string when total ram is less than 1 GB' do
|
||||
MemInfo.any_instance.stubs(:mem_total).returns(512636)
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -125,7 +125,7 @@ describe AdminDashboardData do
|
||||
|
||||
it 'returns a string when in production env' do
|
||||
Rails.stubs(env: ActiveSupport::StringInquirer.new('production'))
|
||||
expect(subject).to_not be_nil
|
||||
expect(subject).not_to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -140,12 +140,12 @@ describe AdminDashboardData do
|
||||
end
|
||||
|
||||
it 'returns a string when favicon_url is default' do
|
||||
expect(subject).to_not be_nil
|
||||
expect(subject).not_to be_nil
|
||||
end
|
||||
|
||||
it 'returns a string when favicon_url contains default filename' do
|
||||
SiteSetting.stubs(:favicon_url).returns("/prefix#{SiteSetting.defaults[:favicon_url]}")
|
||||
expect(subject).to_not be_nil
|
||||
expect(subject).not_to be_nil
|
||||
end
|
||||
|
||||
it 'returns nil when favicon_url does not match default-favicon.png' do
|
||||
@ -161,12 +161,12 @@ describe AdminDashboardData do
|
||||
end
|
||||
|
||||
it 'returns a string when logo_url is default' do
|
||||
expect(subject).to_not be_nil
|
||||
expect(subject).not_to be_nil
|
||||
end
|
||||
|
||||
it 'returns a string when logo_url contains default filename' do
|
||||
SiteSetting.stubs(:logo_url).returns("/prefix#{SiteSetting.defaults[:logo_url]}")
|
||||
expect(subject).to_not be_nil
|
||||
expect(subject).not_to be_nil
|
||||
end
|
||||
|
||||
it 'returns nil when logo_url does not match d-logo-sketch.png' do
|
||||
@ -184,7 +184,7 @@ describe AdminDashboardData do
|
||||
context 'when disabled' do
|
||||
it 'returns nil' do
|
||||
SiteSetting.stubs(enable_setting).returns(false)
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -196,25 +196,25 @@ describe AdminDashboardData do
|
||||
it 'returns nil key and secret are set' do
|
||||
SiteSetting.stubs(key).returns('12313213')
|
||||
SiteSetting.stubs(secret).returns('12312313123')
|
||||
subject.should be_nil
|
||||
subject.should == nil
|
||||
end
|
||||
|
||||
it 'returns a string when key is not set' do
|
||||
SiteSetting.stubs(key).returns('')
|
||||
SiteSetting.stubs(secret).returns('12312313123')
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
|
||||
it 'returns a string when secret is not set' do
|
||||
SiteSetting.stubs(key).returns('123123')
|
||||
SiteSetting.stubs(secret).returns('')
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
|
||||
it 'returns a string when key and secret are not set' do
|
||||
SiteSetting.stubs(key).returns('')
|
||||
SiteSetting.stubs(secret).returns('')
|
||||
subject.should_not be_nil
|
||||
subject.should_not == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ require_dependency 'badge'
|
||||
describe Badge do
|
||||
|
||||
it 'has a valid system attribute for new badges' do
|
||||
Badge.create!(name: "test", badge_type_id: 1).system?.should be_false
|
||||
Badge.create!(name: "test", badge_type_id: 1).system?.should == false
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ describe Category do
|
||||
it "can determine read_restricted" do
|
||||
read_restricted, resolved = Category.resolve_permissions(:everyone => :full)
|
||||
|
||||
read_restricted.should be_false
|
||||
read_restricted.should == false
|
||||
resolved.should == []
|
||||
end
|
||||
end
|
||||
@ -102,13 +102,13 @@ describe Category do
|
||||
let(:group) { Fabricate(:group) }
|
||||
|
||||
it "secures categories correctly" do
|
||||
category.read_restricted?.should be_false
|
||||
category.read_restricted?.should == false
|
||||
|
||||
category.set_permissions({})
|
||||
category.read_restricted?.should be_true
|
||||
category.read_restricted?.should == true
|
||||
|
||||
category.set_permissions(:everyone => :full)
|
||||
category.read_restricted?.should be_false
|
||||
category.read_restricted?.should == false
|
||||
|
||||
user.secure_categories.should be_empty
|
||||
|
||||
@ -216,7 +216,7 @@ describe Category do
|
||||
|
||||
@topic.pinned_at.should be_present
|
||||
|
||||
Guardian.new(@category.user).can_delete?(@topic).should be_false
|
||||
Guardian.new(@category.user).can_delete?(@topic).should == false
|
||||
|
||||
@topic.posts.count.should == 1
|
||||
|
||||
@ -243,7 +243,7 @@ describe Category do
|
||||
|
||||
it "should not set its description topic to auto-close" do
|
||||
category = Fabricate(:category, name: 'Closing Topics', auto_close_hours: 1)
|
||||
category.topic.auto_close_at.should be_nil
|
||||
category.topic.auto_close_at.should == nil
|
||||
end
|
||||
|
||||
describe "creating a new category with the same slug" do
|
||||
@ -286,8 +286,8 @@ describe Category do
|
||||
end
|
||||
|
||||
it 'is deleted correctly' do
|
||||
Category.exists?(id: @category_id).should be_false
|
||||
Topic.exists?(id: @topic_id).should be_false
|
||||
Category.exists?(id: @category_id).should == false
|
||||
Topic.exists?(id: @topic_id).should == false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,7 +43,7 @@ describe ColorScheme do
|
||||
|
||||
context "hex_for_name without anything enabled" do
|
||||
it "returns nil for a missing attribute" do
|
||||
described_class.hex_for_name('undefined').should be_nil
|
||||
described_class.hex_for_name('undefined').should == nil
|
||||
end
|
||||
|
||||
it "returns the base color for an attribute" do
|
||||
@ -65,11 +65,11 @@ describe ColorScheme do
|
||||
|
||||
describe "#enabled" do
|
||||
it "returns nil when there is no enabled record" do
|
||||
described_class.enabled.should be_nil
|
||||
described_class.enabled.should == nil
|
||||
end
|
||||
|
||||
it "returns the enabled color scheme" do
|
||||
described_class.hex_for_name('$primary_background_color').should be_nil
|
||||
described_class.hex_for_name('$primary_background_color').should == nil
|
||||
c = described_class.create(valid_params.merge(enabled: true))
|
||||
described_class.enabled.id.should == c.id
|
||||
described_class.hex_for_name('$primary_background_color').should == "FFBB00"
|
||||
|
@ -3,16 +3,16 @@ require 'spec_helper'
|
||||
describe DigestEmailSiteSetting do
|
||||
describe 'valid_value?' do
|
||||
it 'returns true for a valid value as an int' do
|
||||
DigestEmailSiteSetting.valid_value?(1).should be_true
|
||||
DigestEmailSiteSetting.valid_value?(1).should == true
|
||||
end
|
||||
|
||||
it 'returns true for a valid value as a string' do
|
||||
DigestEmailSiteSetting.valid_value?('1').should be_true
|
||||
DigestEmailSiteSetting.valid_value?('1').should == true
|
||||
end
|
||||
|
||||
it 'returns false for an invalid value' do
|
||||
DigestEmailSiteSetting.valid_value?(1.5).should be_false
|
||||
DigestEmailSiteSetting.valid_value?('7 dogs').should be_false
|
||||
DigestEmailSiteSetting.valid_value?(1.5).should == false
|
||||
DigestEmailSiteSetting.valid_value?('7 dogs').should == false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -87,6 +87,6 @@ describe DiscourseSingleSignOn do
|
||||
url.should == @sso_url
|
||||
|
||||
sso = DiscourseSingleSignOn.parse(payload)
|
||||
sso.nonce.should_not be_nil
|
||||
sso.nonce.should_not == nil
|
||||
end
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ describe Draft do
|
||||
|
||||
it "uses the user id and key correctly" do
|
||||
Draft.set(@user, "test", 0,"data")
|
||||
Draft.get(Fabricate.build(:coding_horror), "test", 0).should be_nil
|
||||
Draft.get(Fabricate.build(:coding_horror), "test", 0).should == nil
|
||||
end
|
||||
|
||||
it "should overwrite draft data correctly" do
|
||||
@ -23,14 +23,14 @@ describe Draft do
|
||||
it "should clear drafts on request" do
|
||||
Draft.set(@user, "test", 0, "data")
|
||||
Draft.clear(@user, "test", 0)
|
||||
Draft.get(@user, "test", 0).should be_nil
|
||||
Draft.get(@user, "test", 0).should == nil
|
||||
end
|
||||
|
||||
it "should disregard old draft if sequence decreases" do
|
||||
Draft.set(@user, "test", 0, "data")
|
||||
Draft.set(@user, "test", 1, "hello")
|
||||
Draft.set(@user, "test", 0, "foo")
|
||||
Draft.get(@user, "test", 0).should be_nil
|
||||
Draft.get(@user, "test", 0).should == nil
|
||||
Draft.get(@user, "test", 1).should == "hello"
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ describe Draft do
|
||||
Draft.set(u, Draft::NEW_TOPIC, 0, 'my draft')
|
||||
_t = Fabricate(:topic, user: u)
|
||||
s = DraftSequence.current(u, Draft::NEW_TOPIC)
|
||||
Draft.get(u, Draft::NEW_TOPIC, s).should be_nil
|
||||
Draft.get(u, Draft::NEW_TOPIC, s).should == nil
|
||||
end
|
||||
|
||||
it 'nukes new pm draft after a pm is created' do
|
||||
@ -49,7 +49,7 @@ describe Draft do
|
||||
Draft.set(u, Draft::NEW_PRIVATE_MESSAGE, 0, 'my draft')
|
||||
t = Fabricate(:topic, user: u, archetype: Archetype.private_message, category_id: nil)
|
||||
s = DraftSequence.current(t.user, Draft::NEW_PRIVATE_MESSAGE)
|
||||
Draft.get(u, Draft::NEW_PRIVATE_MESSAGE, s).should be_nil
|
||||
Draft.get(u, Draft::NEW_PRIVATE_MESSAGE, s).should == nil
|
||||
end
|
||||
|
||||
it 'does not nuke new topic draft after a pm is created' do
|
||||
@ -67,7 +67,7 @@ describe Draft do
|
||||
Draft.set(p.user, p.topic.draft_key, 0,'hello')
|
||||
|
||||
PostCreator.new(user, raw: Fabricate.build(:post).raw).create
|
||||
Draft.get(p.user, p.topic.draft_key, DraftSequence.current(p.user, p.topic.draft_key)).should be_nil
|
||||
Draft.get(p.user, p.topic.draft_key, DraftSequence.current(p.user, p.topic.draft_key)).should == nil
|
||||
end
|
||||
|
||||
it 'nukes the post draft when a post is revised' do
|
||||
@ -75,7 +75,7 @@ describe Draft do
|
||||
Draft.set(p.user, p.topic.draft_key, 0,'hello')
|
||||
p.revise(p.user, 'another test')
|
||||
s = DraftSequence.current(p.user, p.topic.draft_key)
|
||||
Draft.get(p.user, p.topic.draft_key, s).should be_nil
|
||||
Draft.get(p.user, p.topic.draft_key, s).should == nil
|
||||
end
|
||||
|
||||
it 'increases the sequence number when a post is revised' do
|
||||
|
@ -49,7 +49,7 @@ describe EmailLog do
|
||||
|
||||
context "when user's email does not exist email logs" do
|
||||
it "returns nil" do
|
||||
expect(user.email_logs.last_sent_email_address).to be_nil
|
||||
expect(user.email_logs.last_sent_email_address).should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -89,7 +89,7 @@ describe EmailToken do
|
||||
context 'welcome message' do
|
||||
it 'sends a welcome message when the user is activated' do
|
||||
user = EmailToken.confirm(email_token.token)
|
||||
user.send_welcome_message.should be_true
|
||||
user.send_welcome_message.should == true
|
||||
end
|
||||
|
||||
context "when using the code a second time" do
|
||||
@ -98,7 +98,7 @@ describe EmailToken do
|
||||
SiteSetting.email_token_grace_period_hours = 1
|
||||
EmailToken.confirm(email_token.token)
|
||||
user = EmailToken.confirm(email_token.token)
|
||||
user.send_welcome_message.should be_false
|
||||
user.send_welcome_message.should == false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ describe ErrorLog do
|
||||
it "creates a non empty file on first call" do
|
||||
ErrorLog.clear_all!
|
||||
ErrorLog.add_row!(hello: "world")
|
||||
File.exists?(ErrorLog.filename).should be_true
|
||||
File.exists?(ErrorLog.filename).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -15,17 +15,17 @@ describe Group do
|
||||
|
||||
it "is invalid for blank" do
|
||||
group.name = ""
|
||||
group.valid?.should be_false
|
||||
group.valid?.should == false
|
||||
end
|
||||
|
||||
it "is valid for a longer name" do
|
||||
group.name = "this_is_a_name"
|
||||
group.valid?.should be_true
|
||||
group.valid?.should == true
|
||||
end
|
||||
|
||||
it "is invalid for non names" do
|
||||
group.name = "this is_a_name"
|
||||
group.valid?.should be_false
|
||||
group.valid?.should == false
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -16,7 +16,7 @@ describe Invite do
|
||||
end
|
||||
|
||||
it "should not allow a user to invite themselves" do
|
||||
invite.email_already_exists.should be_true
|
||||
invite.email_already_exists.should == true
|
||||
end
|
||||
|
||||
end
|
||||
@ -26,7 +26,7 @@ describe Invite do
|
||||
context 'saved' do
|
||||
subject { Fabricate(:invite) }
|
||||
its(:invite_key) { should be_present }
|
||||
its(:email_already_exists) { should be_false }
|
||||
its(:email_already_exists) { should == false }
|
||||
|
||||
it 'should store a lower case version of the email' do
|
||||
subject.email.should == iceking
|
||||
@ -117,7 +117,7 @@ describe Invite do
|
||||
invite.should be_blank
|
||||
|
||||
# gives the user permission to access the topic
|
||||
topic.allowed_users.include?(coding_horror).should be_true
|
||||
topic.allowed_users.include?(coding_horror).should == true
|
||||
end
|
||||
|
||||
end
|
||||
@ -177,8 +177,8 @@ describe Invite do
|
||||
let!(:user) { invite.redeem }
|
||||
|
||||
it 'works correctly' do
|
||||
user.is_a?(User).should be_true
|
||||
user.send_welcome_message.should be_true
|
||||
user.is_a?(User).should == true
|
||||
user.send_welcome_message.should == true
|
||||
user.trust_level.should == SiteSetting.default_invitee_trust_level
|
||||
end
|
||||
|
||||
@ -214,7 +214,7 @@ describe Invite do
|
||||
|
||||
it 'will not redeem twice' do
|
||||
invite.redeem.should be_present
|
||||
invite.redeem.send_welcome_message.should be_false
|
||||
invite.redeem.send_welcome_message.should == false
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -233,8 +233,8 @@ describe Invite do
|
||||
it 'adds the user to the topic_users' do
|
||||
user = invite.redeem
|
||||
topic.reload
|
||||
topic.allowed_users.include?(user).should be_true
|
||||
Guardian.new(user).can_see?(topic).should be_true
|
||||
topic.allowed_users.include?(user).should == true
|
||||
Guardian.new(user).can_see?(topic).should == true
|
||||
end
|
||||
|
||||
end
|
||||
@ -246,7 +246,7 @@ describe Invite do
|
||||
|
||||
it 'adds the user to the topic_users' do
|
||||
topic.reload
|
||||
topic.allowed_users.include?(user).should be_true
|
||||
topic.allowed_users.include?(user).should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -258,8 +258,8 @@ describe Invite do
|
||||
let(:another_topic) { Fabricate(:topic, category_id: nil, archetype: "private_message", user: coding_horror) }
|
||||
|
||||
it 'adds the user to the topic_users of the first topic' do
|
||||
topic.allowed_users.include?(user).should be_true
|
||||
another_topic.allowed_users.include?(user).should be_true
|
||||
topic.allowed_users.include?(user).should == true
|
||||
another_topic.allowed_users.include?(user).should == true
|
||||
another_invite.reload
|
||||
another_invite.should_not be_redeemed
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ describe OptimizedImage do
|
||||
|
||||
it "returns nil" do
|
||||
OptimizedImage.expects(:resize).returns(false)
|
||||
OptimizedImage.create_for(upload, 100, 200).should be_nil
|
||||
OptimizedImage.create_for(upload, 100, 200).should == nil
|
||||
end
|
||||
|
||||
end
|
||||
@ -59,7 +59,7 @@ describe OptimizedImage do
|
||||
|
||||
it "returns nil" do
|
||||
OptimizedImage.expects(:resize).returns(false)
|
||||
OptimizedImage.create_for(upload, 100, 200).should be_nil
|
||||
OptimizedImage.create_for(upload, 100, 200).should == nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -29,7 +29,7 @@ describe Permalink do
|
||||
|
||||
it "returns nil when topic_id is set but topic is not found" do
|
||||
permalink.topic_id = 99999
|
||||
target_url.should be_nil
|
||||
target_url.should == nil
|
||||
end
|
||||
|
||||
it "returns a post url when post_id is set" do
|
||||
@ -39,7 +39,7 @@ describe Permalink do
|
||||
|
||||
it "returns nil when post_id is set but post is not found" do
|
||||
permalink.post_id = 99999
|
||||
target_url.should be_nil
|
||||
target_url.should == nil
|
||||
end
|
||||
|
||||
it "returns a post url when post_id and topic_id are both set" do
|
||||
@ -55,7 +55,7 @@ describe Permalink do
|
||||
|
||||
it "returns nil when category_id is set but category is not found" do
|
||||
permalink.category_id = 99999
|
||||
target_url.should be_nil
|
||||
target_url.should == nil
|
||||
end
|
||||
|
||||
it "returns a post url when topic_id, post_id, and category_id are all set for some reason" do
|
||||
@ -66,7 +66,7 @@ describe Permalink do
|
||||
end
|
||||
|
||||
it "returns nil when nothing is set" do
|
||||
target_url.should be_nil
|
||||
target_url.should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ describe PostAction do
|
||||
# reply to PM should not clear flag
|
||||
PostCreator.new(mod, topic_id: posts[0].topic_id, raw: "This is my test reply to the user, it should clear flags").create
|
||||
action.reload
|
||||
action.deleted_at.should be_nil
|
||||
action.deleted_at.should == nil
|
||||
|
||||
# Acting on the flag should post an automated status message
|
||||
topic.posts.count.should == 2
|
||||
@ -113,19 +113,19 @@ describe PostAction do
|
||||
post = create_post
|
||||
|
||||
PostAction.act(codinghorror, post, PostActionType.types[:off_topic])
|
||||
post.hidden.should be_false
|
||||
post.hidden.should == false
|
||||
post.hidden_at.should be_blank
|
||||
PostAction.defer_flags!(post, admin)
|
||||
PostAction.flagged_posts_count.should == 0
|
||||
|
||||
post.reload
|
||||
post.hidden.should be_false
|
||||
post.hidden.should == false
|
||||
post.hidden_at.should be_blank
|
||||
|
||||
PostAction.hide_post!(post, PostActionType.types[:off_topic])
|
||||
|
||||
post.reload
|
||||
post.hidden.should be_true
|
||||
post.hidden.should == true
|
||||
post.hidden_at.should be_present
|
||||
end
|
||||
|
||||
@ -292,38 +292,38 @@ describe PostAction do
|
||||
|
||||
post.reload
|
||||
|
||||
post.hidden.should be_true
|
||||
post.hidden.should == true
|
||||
post.hidden_at.should be_present
|
||||
post.hidden_reason_id.should == Post.hidden_reasons[:flag_threshold_reached]
|
||||
post.topic.visible.should be_false
|
||||
post.topic.visible.should == false
|
||||
|
||||
post.revise(post.user, post.raw + " ha I edited it ")
|
||||
|
||||
post.reload
|
||||
|
||||
post.hidden.should be_false
|
||||
post.hidden_reason_id.should be_nil
|
||||
post.hidden.should == false
|
||||
post.hidden_reason_id.should == nil
|
||||
post.hidden_at.should be_blank
|
||||
post.topic.visible.should be_true
|
||||
post.topic.visible.should == true
|
||||
|
||||
PostAction.act(eviltrout, post, PostActionType.types[:spam])
|
||||
PostAction.act(walterwhite, post, PostActionType.types[:off_topic])
|
||||
|
||||
post.reload
|
||||
|
||||
post.hidden.should be_true
|
||||
post.hidden.should == true
|
||||
post.hidden_at.should be_present
|
||||
post.hidden_reason_id.should == Post.hidden_reasons[:flag_threshold_reached_again]
|
||||
post.topic.visible.should be_false
|
||||
post.topic.visible.should == false
|
||||
|
||||
post.revise(post.user, post.raw + " ha I edited it again ")
|
||||
|
||||
post.reload
|
||||
|
||||
post.hidden.should be_true
|
||||
post.hidden_at.should be_true
|
||||
post.hidden.should == true
|
||||
post.hidden_at.should be_present
|
||||
post.hidden_reason_id.should == Post.hidden_reasons[:flag_threshold_reached_again]
|
||||
post.topic.visible.should be_false
|
||||
post.topic.visible.should == false
|
||||
end
|
||||
|
||||
it "can flag the topic instead of a post" do
|
||||
|
@ -121,7 +121,7 @@ describe PostMover do
|
||||
p2.post_number.should == 2
|
||||
p2.topic_id.should == moved_to.id
|
||||
p2.reply_count.should == 1
|
||||
p2.reply_to_post_number.should be_nil
|
||||
p2.reply_to_post_number.should == nil
|
||||
|
||||
p4.reload
|
||||
p4.post_number.should == 3
|
||||
@ -207,7 +207,7 @@ describe PostMover do
|
||||
p2.post_number.should == 3
|
||||
p2.topic_id.should == moved_to.id
|
||||
p2.reply_count.should == 1
|
||||
p2.reply_to_post_number.should be_nil
|
||||
p2.reply_to_post_number.should == nil
|
||||
|
||||
p4.reload
|
||||
p4.post_number.should == 4
|
||||
|
@ -66,8 +66,8 @@ describe PostRevision do
|
||||
r = create_rev("wiki" => [false, true])
|
||||
|
||||
changes = r.wiki_changes
|
||||
changes[:previous_wiki].should be_false
|
||||
changes[:current_wiki].should be_true
|
||||
changes[:previous_wiki].should == false
|
||||
changes[:current_wiki].should == true
|
||||
end
|
||||
|
||||
it "can find post_type changes" do
|
||||
|
@ -468,7 +468,7 @@ describe Post do
|
||||
it 'has no revision' do
|
||||
post.revisions.size.should == 0
|
||||
first_version_at.should be_present
|
||||
post.revise(post.user, post.raw).should be_false
|
||||
post.revise(post.user, post.raw).should == false
|
||||
end
|
||||
|
||||
describe 'with the same body' do
|
||||
@ -563,7 +563,7 @@ describe Post do
|
||||
let!(:result) { post.revise(changed_by, 'updated body') }
|
||||
|
||||
it 'acts correctly' do
|
||||
result.should be_true
|
||||
result.should == true
|
||||
post.raw.should == 'updated body'
|
||||
post.invalidate_oneboxes.should == true
|
||||
post.version.should == 2
|
||||
@ -594,7 +594,7 @@ describe Post do
|
||||
let(:post) { Fabricate(:post, post_args) }
|
||||
|
||||
it "has correct info set" do
|
||||
post.user_deleted?.should be_false
|
||||
post.user_deleted?.should == false
|
||||
post.post_number.should be_present
|
||||
post.excerpt.should be_present
|
||||
post.post_type.should == Post.types[:regular]
|
||||
@ -671,8 +671,8 @@ describe Post do
|
||||
|
||||
it 'has the correct info set' do
|
||||
multi_reply.quote_count.should == 2
|
||||
post.replies.include?(multi_reply).should be_true
|
||||
reply.replies.include?(multi_reply).should be_true
|
||||
post.replies.include?(multi_reply).should == true
|
||||
reply.replies.include?(multi_reply).should == true
|
||||
end
|
||||
end
|
||||
|
||||
@ -763,14 +763,14 @@ describe Post do
|
||||
SiteSetting.stubs(:tl3_links_no_follow).returns(false)
|
||||
post.user.trust_level = 3
|
||||
post.save
|
||||
(post.cooked =~ /nofollow/).should be_false
|
||||
post.cooked.should_not =~ /nofollow/
|
||||
end
|
||||
|
||||
it "when tl3_links_no_follow is true, should add nofollow for trust level 3 and higher" do
|
||||
SiteSetting.stubs(:tl3_links_no_follow).returns(true)
|
||||
post.user.trust_level = 3
|
||||
post.save
|
||||
(post.cooked =~ /nofollow/).should be_true
|
||||
post.cooked.should =~ /nofollow/
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,7 +7,7 @@ describe QuotedPost do
|
||||
raw: "[quote=\"#{post1.user.username}, post: 1, topic:#{post1.topic_id}\"]\ntest\n[/quote]\nthis is a test post",
|
||||
reply_to_post_number: 1)
|
||||
|
||||
QuotedPost.find_by(post_id: post2.id, quoted_post_id: post1.id).should_not be_nil
|
||||
QuotedPost.find_by(post_id: post2.id, quoted_post_id: post1.id).should_not == nil
|
||||
post2.reply_quoted.should == true
|
||||
end
|
||||
|
||||
@ -23,7 +23,7 @@ HTML
|
||||
|
||||
QuotedPost.extract_from(post2)
|
||||
QuotedPost.where(post_id: post2.id).count.should == 1
|
||||
QuotedPost.find_by(post_id: post2.id, quoted_post_id: post1.id).should_not be_nil
|
||||
QuotedPost.find_by(post_id: post2.id, quoted_post_id: post1.id).should_not == nil
|
||||
|
||||
post2.reply_quoted.should == false
|
||||
end
|
||||
|
@ -13,7 +13,7 @@ describe ScreenedEmail do
|
||||
it "last_match_at is null" do
|
||||
# If we manually load the table with some emails, we can see whether those emails
|
||||
# have ever been blocked by looking at last_match_at.
|
||||
ScreenedEmail.create(email: email).last_match_at.should be_nil
|
||||
ScreenedEmail.create(email: email).last_match_at.should == nil
|
||||
end
|
||||
|
||||
it "downcases the email" do
|
||||
@ -56,24 +56,24 @@ describe ScreenedEmail do
|
||||
subject { ScreenedEmail.should_block?(email) }
|
||||
|
||||
it "returns false if a record with the email doesn't exist" do
|
||||
subject.should be_false
|
||||
subject.should == false
|
||||
end
|
||||
|
||||
it "returns true when there is a record with the email" do
|
||||
ScreenedEmail.should_block?(email).should be_false
|
||||
ScreenedEmail.should_block?(email).should == false
|
||||
ScreenedEmail.create(email: email).save
|
||||
ScreenedEmail.should_block?(email).should be_true
|
||||
ScreenedEmail.should_block?(email).should == true
|
||||
end
|
||||
|
||||
it "returns true when there is a record with a similar email" do
|
||||
ScreenedEmail.should_block?(email).should be_false
|
||||
ScreenedEmail.should_block?(email).should == false
|
||||
ScreenedEmail.create(email: similar_email).save
|
||||
ScreenedEmail.should_block?(email).should be_true
|
||||
ScreenedEmail.should_block?(email).should == true
|
||||
end
|
||||
|
||||
it "returns true when it's same email, but all caps" do
|
||||
ScreenedEmail.create(email: email).save
|
||||
ScreenedEmail.should_block?(email.upcase).should be_true
|
||||
ScreenedEmail.should_block?(email.upcase).should == true
|
||||
end
|
||||
|
||||
shared_examples "when a ScreenedEmail record matches" do
|
||||
@ -87,13 +87,13 @@ describe ScreenedEmail do
|
||||
|
||||
context "action_type is :block" do
|
||||
let!(:screened_email) { Fabricate(:screened_email, email: email, action_type: ScreenedEmail.actions[:block]) }
|
||||
it { should be_true }
|
||||
it { should == true }
|
||||
include_examples "when a ScreenedEmail record matches"
|
||||
end
|
||||
|
||||
context "action_type is :do_nothing" do
|
||||
let!(:screened_email) { Fabricate(:screened_email, email: email, action_type: ScreenedEmail.actions[:do_nothing]) }
|
||||
it { should be_false }
|
||||
it { should == false }
|
||||
include_examples "when a ScreenedEmail record matches"
|
||||
end
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ describe ScreenedIpAddress do
|
||||
|
||||
describe "ip_address_with_mask" do
|
||||
it "returns nil when ip_address is nil" do
|
||||
described_class.new.ip_address_with_mask.should be_nil
|
||||
described_class.new.ip_address_with_mask.should == nil
|
||||
end
|
||||
|
||||
it "returns ip_address without mask if there is no mask" do
|
||||
|
@ -13,7 +13,7 @@ describe ScreenedUrl do
|
||||
end
|
||||
|
||||
it "last_match_at is null" do
|
||||
described_class.create(valid_params).last_match_at.should be_nil
|
||||
described_class.create(valid_params).last_match_at.should == nil
|
||||
end
|
||||
|
||||
it "normalizes the url and domain" do
|
||||
@ -88,7 +88,7 @@ describe ScreenedUrl do
|
||||
|
||||
describe 'find_match' do
|
||||
it 'returns nil when there is no match' do
|
||||
described_class.find_match('http://spamspot.com/buy/it').should be_nil
|
||||
described_class.find_match('http://spamspot.com/buy/it').should == nil
|
||||
end
|
||||
|
||||
it 'returns the record when there is an exact match' do
|
||||
|
@ -31,7 +31,7 @@ describe SiteCustomization do
|
||||
end
|
||||
|
||||
it 'finds no style when none enabled' do
|
||||
SiteCustomization.enabled_style_key.should be_nil
|
||||
SiteCustomization.enabled_style_key.should == nil
|
||||
end
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ describe SiteCustomization do
|
||||
# this bypasses the before / after stuff
|
||||
SiteCustomization.exec_sql('delete from site_customizations')
|
||||
|
||||
SiteCustomization.enabled_style_key.should be_nil
|
||||
SiteCustomization.enabled_style_key.should == nil
|
||||
end
|
||||
end
|
||||
|
||||
@ -156,13 +156,13 @@ describe SiteCustomization do
|
||||
it 'should compile scss' do
|
||||
c = SiteCustomization.create!(user_id: user.id, name: "test", stylesheet: '$black: #000; #a { color: $black; }', header: '')
|
||||
s = c.stylesheet_baked.gsub(' ', '').gsub("\n", '')
|
||||
(s.include?("#a{color:#000;}") || s.include?("#a{color:black;}")).should be_true
|
||||
(s.include?("#a{color:#000;}") || s.include?("#a{color:black;}")).should == true
|
||||
end
|
||||
|
||||
it 'should compile mobile scss' do
|
||||
c = SiteCustomization.create!(user_id: user.id, name: "test", stylesheet: '', header: '', mobile_stylesheet: '$black: #000; #a { color: $black; }', mobile_header: '')
|
||||
s = c.mobile_stylesheet_baked.gsub(' ', '').gsub("\n", '')
|
||||
(s.include?("#a{color:#000;}") || s.include?("#a{color:black;}")).should be_true
|
||||
(s.include?("#a{color:#000;}") || s.include?("#a{color:black;}")).should == true
|
||||
end
|
||||
|
||||
it 'should allow including discourse styles' do
|
||||
|
@ -12,21 +12,21 @@ describe TopMenuItem do
|
||||
|
||||
it 'has a filter' do
|
||||
expect(items[0].filter).to eq('nope')
|
||||
expect(items[0].has_filter?).to be_true
|
||||
expect(items[0].has_filter?).to be_truthy
|
||||
expect(items[2].filter).to eq('not')
|
||||
expect(items[2].has_filter?).to be_true
|
||||
expect(items[2].has_filter?).to be_truthy
|
||||
end
|
||||
|
||||
it 'does not have a filter' do
|
||||
expect(items[1].filter).to be_nil
|
||||
expect(items[1].has_filter?).to be_false
|
||||
expect(items[1].has_filter?).to be_falsey
|
||||
expect(items[3].filter).to be_nil
|
||||
expect(items[3].has_filter?).to be_false
|
||||
expect(items[3].has_filter?).to be_falsey
|
||||
end
|
||||
|
||||
it "has a specific category" do
|
||||
expect(items.first.has_specific_category?).to be_false
|
||||
expect(items.last.has_specific_category?).to be_true
|
||||
expect(items.first.has_specific_category?).to be_falsey
|
||||
expect(items.last.has_specific_category?).to be_truthy
|
||||
end
|
||||
|
||||
it "does not have a specific category" do
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user