use of org.mamute.model.News in project mamute by caelum.
the class NewsController method newNews.
@Post
@CustomBrutauthRules({ LoggedRule.class, InputRule.class })
public void newNews(String title, MarkedText description) {
NewsInformation information = new NewsInformation(title, description, currentUser, "new news");
User author = currentUser.getCurrent();
News news = new News(information, author);
result.include("news", news);
newses.save(news);
result.redirectTo(this).showNews(news, news.getSluggedTitle());
}
use of org.mamute.model.News in project mamute by caelum.
the class VoteDAOTest method should_find_news_from_votable.
@Test
public void should_find_news_from_votable() throws Exception {
News news = new NewsBuilder().build();
ReputationEventContext context = votes.contextOf(news);
assertEquals(news, context);
}
use of org.mamute.model.News in project mamute by caelum.
the class NewsTest method not_approved_news_should_be_visible_to_moderator.
@Test
public void not_approved_news_should_be_visible_to_moderator() {
News news = news("news title", "news description", author);
assertTrue(news.checkVisibilityFor(loggedUser(moderator)));
}
use of org.mamute.model.News in project mamute by caelum.
the class NewsTest method approved_news_should_be_visible.
@Test
public void approved_news_should_be_visible() {
News news = news("news title", "news description", author).approved();
news.checkVisibilityFor(loggedUser(regularUser));
news.checkVisibilityFor(loggedUser(author));
news.checkVisibilityFor(loggedUser(moderator));
}
use of org.mamute.model.News in project mamute by caelum.
the class PostViewCounterTest method should_increase_count_only_the_news_counter.
@Test
public void should_increase_count_only_the_news_counter() {
Question question = new QuestionBuilder().withId(1l).build();
News news = new NewsBuilder().withId(1l).build();
questionViewCounter.ping(question);
mockQuestionVisited(question);
questionViewCounter.ping(news);
assertEquals(1l, question.getViews());
assertEquals(1l, news.getViews());
}
Aggregations