travis-web/tests/unit/components/repo-actions-test.coffee
Piotr Sarnacki d9cb754879 Refactor repo actions support
This commit refactors repo-actions support to use components and make
the implementation much simpler. It also fixes a bug with buttons being
displayed when they shouldn't be.
2015-03-13 10:30:19 +01:00

26 lines
1003 B
CoffeeScript

`import { test, moduleForComponent } from 'ember-qunit'`
moduleForComponent 'repo-actions', 'RepoActionsComponent', {
# specify the other units that are required for this test
needs: ['component:build-repo-actions', 'component:job-repo-actions']
}
test 'it displays code climate if the repo language is ruby', ->
# creates the component instance
repo = Ember.Object.create(githubLanguage: 'Ruby')
component = @subject(repo: repo)
@append()
ok component.get('displayCodeClimate'), 'component should try to display code climate'
ok component.$('a[name=code-climate]').length, 'component should render a code climate button'
test 'it doesn\'t display code climate for other languages', ->
repo = Ember.Object.create(githubLanguage: 'Go')
component = @subject(repo: repo)
@append()
ok !component.get('displayCodeClimate'), 'component should not try to display code climate'
ok !component.$('a[name=code-climate]').length, 'component should not render a code climate button'