edit.html.haml_spec.rb
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
describe "apps/edit.html.haml", type: 'view' do
let(:app) { stub_model(App) }
let(:app_decorate) { AppDecorator.new(app) }
before do
allow(view).to receive(:app).and_return(app)
allow(view).to receive(:app_decorate).and_return(app_decorate)
allow(controller).to receive(:current_user).and_return(stub_model(User))
end
describe "content_for :action_bar" do
def action_bar
view.content_for(:action_bar)
end
it "should confirm the 'reset' link" do
render
expect(action_bar).to have_selector(
format(
'a.button[data-confirm="%s"]',
I18n.t('apps.confirm_destroy_all_problems')
)
)
end
it "should confirm the 'destroy' link" do
render
expect(action_bar).to have_selector(
format(
'a.button[data-confirm="%s"]',
I18n.t('apps.confirm_delete')
)
)
end
end
context "with unvalid app" do
let(:app) do
app = stub_model(App)
app.errors.add(:base, 'You must specify your')
app
end
it 'see the error' do
render
expect(rendered).to match(/You must specify your/)
end
end
end